dynamic id for component?

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

  1. #1

    Default dynamic id for component?

    I'm using a repeater to create several textInputs on the stage. I'd like to
    assign each textInput a unique ID but I keep getting an error msg with my
    formatting. Is this possible? The error I get is
    '['autoCompleteMgr_'+catRepeater.currentItem.catID] is not a valid identifier'

    <mx:TextInput id="{'autoCompleteMgr_'+catRepeater.currentItem.ca tID}"
    width="300" themeColor="#F85F02"/>

    Thanks!
    Amanda

    machmila Guest

  2. Similar Questions and Discussions

    1. dynamic component positioning in Panel
      Ok, here is the problem description which I have been trying to solve out for couple of weeks. I have a static ViewStack component in Flex...
    2. Dynamic Component
      Hi, I need to instance component (Ex: cpn = new ComponentFromInternet()) and use it, but i don't how can i do this, only but ActionScript, i...
    3. Dynamic XML Schema and DataSet Component
      Hello, I am trying to use a DataSet Component to hold data loaded from a SQL table. The design of my application requires that all components be...
    4. Dynamic Sound with a Media Component
      Hello I'm having a little problem here. I am using Flash MX 2004 - Proffesional. I have a dynamic sound ("GavSound")loading in at the beginning...
    5. dynamic url from a component
      i've searched this newsgroup as well as the aspnet newsgroup without an answer to this question. i call a web service from a component. i specify...
  3. #2

    Default Re: dynamic id for component?

    One way you can do this is if you just give it an id, each individual element
    can be accessed by treating that id as an array. Not exactly giving it a
    completely dynamic id, but should be able to do everything using the array

    <mx:Script>
    <![CDATA[
    public var repeaterData:Array = [10,20,30,40];
    public function changeLabelText():void{
    for(var i:int;i<repeaterData.length;i++){
    myLabel[i].text=Math.random();
    }
    }
    ]]>
    </mx:Script>
    <mx:VBox>
    <mx:Repeater id="myRepeater" dataProvider="{repeaterData}">
    <mx:Label id="myLabel" text="{myRepeater.currentItem}"/>
    </mx:Repeater>

    <mx:Button click="changeLabelText()"/>
    </mx:VBox>

    greenhippo Guest

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