-
variable not working right
Hello, I am trying to write a variable in the middle of a command, like:
(in root, myvariable=12)
in another movie clip:
var movieclipnumber = _root.myvariable
_level2.this["othermovie"+movieclipnumber].gotoAndStop(5)
but flash keeps giving me the error:
"Expected a field name after '.' operator."
I am trying to get the logic to think:
_level2.othermovie12.gotoAndStop(5)
Is the syntax wrong? I think it's trying to consider "_root" in the variable "movieclip" as an actual path, where I just want it to be a reference for the variable "myMC", which happens to be in "_root". (I hope that wasnt too confusing!)
Thank you!
-
.
Hi,
Perhaps you can post your fla, or more of your code here.
-
.
_level2["othermovie" + movieclipnumber].gotoAndStop(5);
it would still help to see your fla
-
Thanks fruitbeard, that was exactly it! I wonder why you wouldnt use a dot after _level2, but who am I to question. Thanks again
-
Senior Member
I would think of it like, _level2 as being the MovieClip or location of whatever is between the square brackets. So, when you used "_level2.this[stuff]" it was using 2 locations, _level2 and this (relative to its current location).
Hope that gives you some insight.
-
Senior Member
"this" just does not ever go after "." because it is keyword - hence the error:
"Expected a field name after '.' operator."
A field name. Not keyword.
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
|