vancechristopher
01-31-2007, 12:25 PM
I have a problem understanding flash
I have tried several times to understand movie chain variables, but cannot seem to grasp the Idea.
I have the book Actionscript (the Definitive Guide). And in it it's talking about variables.
It states that if you put a movie on the stage an then go to the movie timeline and insert a variable you can access this variable from the main timeline by using the dot notation like so...
//text on first frame of layer one main timeline
trace(_root.square.x)
I have made a square movie and made sure that the square movie is a named instance on the main stage by typing in "square" in the property title label, and then went into the movie square and put this actionscript on frame one level one of square movie.
var x;
x = 20;
now when I test the movie the output is undefined.
If I make the variable from the main timeline like this on frame one layer one of the main timeline.
_root.square.x = 20;
then
trace(_root.square.x)
it does come up as twenty in the output window.
If I cannot access a variable that is on a timeline of an imbeded movie I cannot program my movie properly.
Im not sure weather I should check the box for export for action script or not , but I think that this does not matter. I have tried several times an have allways come up with the undefined. Is there something I'm doing wrong. I need to be able to us the dot notation for all kinds of things. I have followed the book on page fourty three Scenario2, but it does not work, eventhough the book says it should. I understand the dot notation, but it doesn't seem to be working with the trace command.
any help would be gratefull.
I have tried several times to understand movie chain variables, but cannot seem to grasp the Idea.
I have the book Actionscript (the Definitive Guide). And in it it's talking about variables.
It states that if you put a movie on the stage an then go to the movie timeline and insert a variable you can access this variable from the main timeline by using the dot notation like so...
//text on first frame of layer one main timeline
trace(_root.square.x)
I have made a square movie and made sure that the square movie is a named instance on the main stage by typing in "square" in the property title label, and then went into the movie square and put this actionscript on frame one level one of square movie.
var x;
x = 20;
now when I test the movie the output is undefined.
If I make the variable from the main timeline like this on frame one layer one of the main timeline.
_root.square.x = 20;
then
trace(_root.square.x)
it does come up as twenty in the output window.
If I cannot access a variable that is on a timeline of an imbeded movie I cannot program my movie properly.
Im not sure weather I should check the box for export for action script or not , but I think that this does not matter. I have tried several times an have allways come up with the undefined. Is there something I'm doing wrong. I need to be able to us the dot notation for all kinds of things. I have followed the book on page fourty three Scenario2, but it does not work, eventhough the book says it should. I understand the dot notation, but it doesn't seem to be working with the trace command.
any help would be gratefull.