I’m doing a thing where I need to go to a certain framelabel. Which framelabel to go to is decided by the variable costumer, and it should end with a b. How would I write this?
gotoAndPlay(_root.costumer+“b”) doesn’t go to a label, right? So what’s the syntax for this? Guess this is an easy one, but I just can’t figure it out right now…
Thanks!
I dont quite get your idea
:-\
If i get you right, declare your variable like this:
customer = "fram";
Now if the frame you want to go is labeled frame, use the following code:
this.gotoAndPlay(customer+"e");
No, that doesn’t work. That code tells flash to do like this:
[AS]gotoAndPlay(frame)[/AS] but if I want to go to a framelabel, I have to use “” around the frame-name, like this:
[AS]gotoAndPlay(“frame”)[/AS] So my question again:
How do I get the _root.costumer inside the “”?
Hope that explained what I need…
If you use the code i provided, it will gotoAndPlay the frame labeled “frame” (no quotes).
It is always best to first define the variable, then use it, instead of define-when-using. Your variable customer is stored in _root, right ? Then I think the best thing to do is:
[AS]
customer = _root.customer+“a”;//store the _root var in a local var and add a or b to it
gotoAndPlay(customer);
[/AS]
If you use an “on” event handler ( like on(release){… ), make sure that the customer = _root.customer+“a” line is also located inside the handler.
I’m sorry claudio… You’re so right I forgot to use _parent.gotoAndPlay(). The button wasn’t in the same level as the movie that should play. Thank you
Voetsjoeba: Yupp, but it did work not doing your way…
Two ways are better than one
No problem
Totally correct :thumb: Thanks for your help!