Skip to main content
Participating Frequently
July 25, 2007
Question

A question about accessing elements of dinamically created components

  • July 25, 2007
  • 6 replies
  • 436 views
hi, I've created a component called User_Tab. This has a label inside called "label_IDUser";

Now, the problem is that when I dinamically instantiate the component (on the root), It seems that I cannot change the text property of the label:

//inside a cicle for (for a=0;a<3;a++){

this.attachMovie("User_Tab", "mc_UserChannel"+a, this.getNextHighestDepth(), {_x:x_Pos, _y:y_Pos});

this["mc_UserChannel"+a].label_IDUser.text = "Hello";
//end cicle for
}
If i trace the property for the first movie

trace("ECHO:" + mc_UserChannel0.label_IDUser.text); //

I get the expected result. But this result DOES NOT DISPLAY IN THE MOVIE (which gets attached but whose label remains empty)...

Thanks in advance!

Davide
This topic has been closed for replies.

6 replies

kglad
Community Expert
Community Expert
July 26, 2007
either use the depth manager component or do not use getNextHighestDepth() to assign depths.
Known Participant
July 26, 2007
Hi, have you embedded all the fonts into the dynamic text field ?

Also make sure that the varialbe you are using to access it is not undefined or some other number that won't reference it..
kglad
Community Expert
Community Expert
July 25, 2007
is there a mask used in the authoring environment or setMask() used in your scripting?
Davide CAuthor
Participating Frequently
July 26, 2007
No, no mask...the problem seems to be that I cannot reach the object...If I drag the object "User_Tab" on the stage instead of using attachMovie to create it dinamically, it works...When I use attach movie, it does not. But i have to put that object on the stage dinamically.
kglad
Community Expert
Community Expert
July 25, 2007
did you create your component using actionscript only are is, at least, some of your display created in the authoring environment?
Davide CAuthor
Participating Frequently
July 25, 2007
Yes, I created my component with the editor : i dragged the Label and a Loader. Then saved and linked for Actionscript usage
kglad
Community Expert
Community Expert
July 25, 2007
are masking label_IDUser or changing its _alpha or rotating it etc?
Davide CAuthor
Participating Frequently
July 25, 2007
Ah ok, no no _alpha, nor rotating. I just make this assignment
this["mc_UserChannel"+a].label_IDUser.text = "Hello";

Sorry but I'm just moving my first steps thru Actionscript...
kglad
Community Expert
Community Expert
July 25, 2007
do you need to embed your font?
Davide CAuthor
Participating Frequently
July 25, 2007
Sorry? I don't understand...