Dynamically create Flex components

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default Dynamically create Flex components

    HI All,
    I have a requirement wherein i need to create flex components like check
    boxes, radio buttons or datagrid dynamically based on the values and type of
    the components retrieved from the db.
    What would be the best approach to achieve this.Pls help me with links and
    sample codes.
    Thanks in advance

    meticoolus Guest

  2. Similar Questions and Discussions

    1. How to load Flex 2.0 components on Flex 1.5 application
      Hello, I am currently working on an Flex 1.5 application and my client wants to import 2.0 components into it. Can we achieve that? if so how is...
    2. Flex 2B2 UI COmponents
      Hi All... I am trying to get an application prototyped fairly quickly. Initially, I started using a Java Applet but there is a good bit of high...
    3. How do I dynamically bind two components?
      How do I dynamically bind two components with out the use of the components inspector panel? My problem began when I dynamically created an...
    4. Dynamically Loading UI Components in MX 2004 Pro
      Hello, I was wondering how to load the UI components like (RadioButton, Checkboxes, etc) dynamically at runtime. I was fooling around and...
    5. components for dynamically displaying data chart or graph in ASP
      Hello, I tried to find some components I can use to dynamically generate chart or graph from database in ASP. It seems to me that only some...
  3. #2

    Default Re: Dynamically create Flex components

    To create a dynamic Flex component, you can declare that component, instantiate it, then set it's properties at run-time.
    Using method addChild , it will allow the add of this new component to an existing Flex UIComponent.
    Here an example on how to add new button:

    var buttonNew:Button;
    buttonNew = new Button; //create the button
    buttonNew.label = "Create Canvas Control"; //set some properties
    buttonNew.addEventListener("click",addCanvas); //set an event listener
    this.addChild(buttonNew); //add the button to the DisplayList
    If you go inside more generic, you can use a switch/case statement in action script,
    If the component to add, is a button, use the above code, for other types, statement will be different.
    An other solution is to think on is RSL(runtime shared libraries), here is an example following this link:
    https://flexinonroids.wordpress.com/2009/05/27/flex-3-dynamically-loading-components-at-runtime/
    Saber Chebka is offline Junior Member
    Join Date
    Jun 2011
    Posts
    1

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139