Skip to main content
Participant
December 9, 2008
Answered

this["r" + i + "c" + j]

  • December 9, 2008
  • 8 replies
  • 565 views
hi,
I want to crate several Label with one for ;

[AS]var ["r" + i + "c" + j]:Label = new Label();[/AS]
it is false !!!
[AS]this["r" + i + "c" + j] = new Label();[/AS]
NOt work ...
any one can help me ??
tanQ.
This topic has been closed for replies.
Correct answer Craig Grummitt
To set variables without first declaring them you need to set your class to dynamic.

8 replies

kglad
Community Expert
Community Expert
December 12, 2008
you're welcome.
kiarash_MAuthor
Participant
December 12, 2008
thQ kglad , my issue has been solved ...
my loop is Okey....
thx to alllll
kglad
Community Expert
Community Expert
December 12, 2008
show the code for a for-loop that compiles.
kiarash_MAuthor
Participant
December 12, 2008
quote:

Originally posted by: Craig Grummitt
To set variables without first declaring them you need to set your class to dynamic.


Tanks a lot ....
Yes with dynamic class , my issue has been solved by Craig Grummitt (tHX)
Craig Grummitt
Craig GrummittCorrect answer
Inspiring
December 11, 2008
To set variables without first declaring them you need to set your class to dynamic.
kglad
Community Expert
Community Expert
December 11, 2008
you need to work learn about for-loops. start a new project try and make a simple one parameter for-loop.
kiarash_MAuthor
Participant
December 10, 2008
thanks ..but
..no my compiler say:
ReferenceError: Error #1056: Cannot create property r0c0 on persianCal.
at persianCal();

this is my code ::


package {
import flash.display.MovieClip;
import flash.text.TextFieldAutoSize;
import fl.controls.Label;
public class persianCal extends MovieClip {

public function persianCal() {



var i:int=0;
var j:int = 0;
for (; i < 7; j++) {;
this["r" + i + "c" + j] = new Label();
if (j==6) {
j=0;
i++;
}



}


}


}

}
kglad
Community Expert
Community Expert
December 9, 2008
your 2nd snippet should work if i and j are defined, you have a label component in your library and you import the label class.