From: minzojian on
hello,dear everyone
there is problem that realy confused me.that is the textfield(or other display
objects) in MovieClip can't be defined when i jumpto that frame.check these
simple code:
[B][I]
mc.stop()
function goNext(evt:Event){
mc.nextFrame()
dosth()
}
function dosth()
{
if(mc.currentFrame==2)
{
mc.mytext.text="hello"
}
}
nextBT.addEventListener("click",goNext)
[/I][/B]

the mc is a simple MC that have 2 frames,and the textfield object is in the
second frame.
and what i try to do is when i clicked the button,the mc jumpto the second
frame.and i define a value to that textfield.but it's failed when i try to do
like that.
as i debug the program.i found that when i define the value to the
textfield,that textfield is a Null Object(should be the TextField object).not
only the textfield not work,but also other elements such as Button objects.
so,i am thinking that must because the objects are too late to initialized
before they be used.maybe there are some event can tell me that all elements
has been initialized,as i can use them then.what do you think,my friend?