Groups | Blog | Home
all groups > flash actionscript > may 2005 >

flash actionscript : Can't write in label within attached MC?


David Stiller
5/2/2005 3:57:13 PM
[quoted text, click to view]

Can you post the relevant code you're using? This should be a matter of
pathing to the Label instance in question and setting its Label.text
property.


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

John Rock
5/2/2005 5:03:09 PM
Hi,

I'm trying to dynamicaly create a menu in Flash. I have made one MC composed
of a square button with a label component over it, and linked it in my library.
When I start the movie, I attach a couple of instances of this MC on screen. I
am able to place them where I want on the stage, but I can't change the text of
the label in each MC instance.

Can this be done?!
John Rock
5/3/2005 12:00:00 AM
Actually, I solved my problem by doing the following.

Within the mc in the library:

var labelName:String;
labelInstance.text = labelName;

When attaching the mc onto the stage:

stage.attachMovie("mcName", "mcInstance", level, {labelName:labelValue})

Previously, I was trying something like this and it didn't work. I guess you
can't tap into a object within an attached mc like you would with a mc already
on the stage :

stage.attachMovie("mcName", "mcInstance", level);
stage.mcInstance.labelInstance.text = labelValue;
AddThis Social Bookmark Button