flash - Problem with instance names inside Button -
I have created a button in Flash, and within it I have a TextField and Movie clip, for example both names set I cover all 4 frames without any keyframe.
I found that I can not use the object using those instance names, so I used this piece of code to see what is happening:
< Code> var obj: DisplayObject = this.m_graphics.btnChange.upState; (Var i: int = 0; i & lt; obj.numChildren; i ++) {trace ("we have one object + + + +" + "+ obj.getChildAt (i) +": "+ Obj.getChildAt (my name); var t: TextField = obj.getChildAt (i) as TextField; if (T == blank) is issued; trace ("text field is text" "+ t.text +" ') ;}I get this as output:
We have an object 0 - [object shape]: Example 195 with us There is an object - [Object Textfield]: Text is change in the Instance 1999 textfield - Object on 2 - [Object MovieClip]: instance203
Because they are TextField and MovieClip, they have their instance name reset to normal "instance ###".
Anybody know what the problem is? If I have a movie clip on the button, it works fine (though I have to control the frames myself).
I'm going to know about this That I can use to work around it, but it means that many things Seeing this little bit, it looks as if there is no one, the keyframe in the Flash IDE button, Flash creates 4 instances of each item (Tracing through the
upstate example will give me a
TextField with the example name "instance2", while
downstat , The name of the example is "instance4"). If I change the text into a state, then it does not reflect in others.
I am thinking that when Flash creates objects, it does not copy all the properties correctly (eg name)
edit
I agree that Shane's answer is an alternative solution - I told myself that I know of different ways to get around the problem - but it neglects the problem, it Does not solve (this is the only reason I do not accept it Receives). I slept in the first place so that nobody knows why this is happening in the first place (TBH, it looks like a bug in the SDK).
I also understand the logic behind the argument: "If you want more control, use the Sprite or Movie clip", but I do not agree with it. Flash IDE lets you create buttons with nominated examples inside them, and simple button docs give you access to different states, so this is acceptable for me. If SimpleButton can only be used for very basic, non-floating stationary buttons (also consider localization), then it is very useless. You can use inspiration and movie clips, but then you have to control the different states, which becomes weird. To handle boilerplate I have my button class, but I do not want to re-write the basic SDK functionality, which is why it is a bug for me.
I will reward for the time when this is what you are present there. If I do not get anything, then I'll give it to Shane.
This is because the Flash did not receive from the Display.SimpleButton class from
DisplayObjectContainer , And state containers are not also DisplayObjectContainers:
Basically, simple buttons are simpler than their definitions. If you want more complex controls on internal objects, you will need to use Sprite or Movie Clip with the buttonmodet set to correct.
Comments
Post a Comment