Professional Web Applications Themes

Dynamically create Flex components - Macromedia Flex General Discussion

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...

  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. #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

Similar Threads

  1. How to load Flex 2.0 components on Flex 1.5 application
    By SB! in forum Macromedia Flex General Discussion
    Replies: 1
    Last Post: January 31st, 07:29 PM
  2. Flex 2B2 UI COmponents
    By WebNinja1 in forum Macromedia Flex General Discussion
    Replies: 0
    Last Post: April 1st, 01:18 AM
  3. How do I dynamically bind two components?
    By web_dsnr in forum Macromedia Flash Data Integration
    Replies: 0
    Last Post: January 28th, 11:00 AM
  4. Dynamically Loading UI Components in MX 2004 Pro
    By piferdj in forum Macromedia Flash Actionscript
    Replies: 1
    Last Post: February 26th, 07:55 PM
  5. Replies: 3
    Last Post: September 15th, 10:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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