Re: [flexcoders] Accessing repeating components through ActionScript

2010-08-11 Thread Oleg Sivokon




var event:Event = arguments[0] as Event;
this.labels.push(event.currentTarget);




* Sorry, incorrect opening and closing tags.


Re: [flexcoders] Accessing repeating components through ActionScript

2010-08-11 Thread Oleg Sivokon
@id must be a simple identifier, it's the same as variable name in AS3. What
you can do though is like this: add creationComplete handler to the
repeating components and collect them into vector / array / dictionary /
etc, whatever suites you better. Something like this:





var event:Event = arguments[0] as Event;
this.labels.push(event.currentTarget);





[flexcoders] Accessing repeating components through ActionScript

2010-08-10 Thread Alexander
Hello,

I'd like to have several labels in alternating colors, 
and set their text's from XML-data coming from a server.

Unfortunately this won't compile:

  
  
  
  

And if I use Repeater, I can't set the components id's
(won't compile either; but it compiles if I change id -> text):

  

  

In Flash I could just have an array of TextFields:

  private var _leftTxt:Array = new Array(4);

  for (var i:uint = 0; i < _leftTxt.length; i++) {
_leftTxt[i] = new TextField();
..
addChild(_leftTxt[i]);
  }

and then just work with _leftTxt[i]... 
But how do you do it in Flex?

Regards
Alex