|
-
variable question
I want to change the value of a variable within a movieclip from the main timeline. How would I do this?
My variable is "visited" and I want to set it to "true" or "1" from the main timeline.
My variable is located on the timeline within this movie: _root.newButtonMC.button1
I thought this might work:
Code:
_root.newButtonMC.button1.visited = 1
Thanks for you help!
-
Senior Member
Its correct if button1 also is a moviclip. ( the names has to be instance names ).
All instances has to be present in the timeline when you set the variable though.
-
Registered User
You should use true instead of 1.
That (will) matter(s) in AS 2.0.
-
hmm... I must have a problem somewhere else. I doesn't seem to be working...
-
Registered User
If newButton is a movie clip.
If button1 is a movie clip.
If you attach your code to a timeline and the buttons are both on the stage, it should be ok.
Try this, to help you debug:
code:
trace(_root.newButtonMC); // shouldn't be undefined
trace(_root.newButtonMC.button1); // shouldn't be undefined
trace(_root.newButtonMC.button1.visited); // probably is undefined
_root.newButtonMC.button1.visited = true;
trace(_root.newButtonMC.button1.visited); // shouldn't be undefined
-
I used this code:
Code:
trace("newButtonMC = " + newButtonMC); // shouldn't be undefined
trace("newButtonMC.button1" + newButtonMC.button1); // shouldn't be undefined
trace("newButtonMC.button1.visited = " + newButtonMC.button1.visited); // probably is undefined
newButtonMC.button1.visited = 1;
trace("newButtonMC.button1.visited = " + newButtonMC.button1.visited); // shouldn't be undefined
This is what was returned:
newButtonMC = _level0.butMovie.square_3.button1holder
newButtonMC.button1_level0.butMovie.square_3.butto n1holder.button1
newButtonMC.button1.visited =
newButtonMC.button1.visited = 1
So it looks like my problem is elsewhere... Hmm looks like I gotta do some diggin...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|