What does the container.bb refer to?
It refers to a variable bb that exists on the current frame the play head is in for that movie clip. If you have a movieclip on that stage which has a instance name bb then it refers to that object . So from the container if you call this["bb"] that refers to a variable bb . It may or may not exists in that class.
Quote:
|
Now what i actually want to do, and need help understanding, is how things behave when all this is updated. I want to alter some frames on the timeline of the container (at authortime) to contain a different instance of the bb object. The new instance will have different dimensions but the same name, and the old bb will not be on that frame, so there will only be one instance of bb at a time.
|
That being said if you have a container movie clip which has 4 frames. Each frame has a movie clip named bb. Now this is the same as programatically creating a new movie clip and adding it to the display list on each frame.
So a simple code like this :
ActionScript Code:
btn.addEventListener(MouseEvent.MOUSE_DOWN,handleMouse);
function handleMouse(e:MouseEvent){
var currentbb = container.bb; //If bb exists current bb is set to that instance
container.bb["testValue"] = "something"; //if bb exists a dyn value is created
trace("Parameters " + container.bb.x); // 8
container.bb.x += 40;
trace("Parameters " + container.bb.x+" testing current value " + container.bb["testValue"] );//works 48 , "something"
container.nextFrame();//whatever changes you made before on bb is lost here
trace("Parameters " + container.bb.x+" testing current value " + container.bb["testValue"] ); ////prints 92 and undefined
trace(currentbb == container.bb); //Prints false.this still holds reference to the old bb .
trace(currentbb["testValue"]); //Proof:: Prints something
}
will work .as in bb wont be undefined as long as a movie clip exists on the stage on that frame. But then again if you set a variable on the container.bb on one particular frame .go to someother frame where bb is a new movieclip .. the variable you have declared is lost.
Hope that clarifies it a little bit .