PDA

View Full Version : [FMX] I need some help here...



clb
May 11th, 2005, 01:37 PM
Hi everybody!
I've got a little problem. I found this awsome tutorial to create an animated button on this page (http://www.kirupa.com/developer/mx2004/button_effect.htm). Everything works fine, but now I want to link the button to a frame with text in it called "text" in scene 1. So I tried it instead of


this.onRelease = function(){ getURL("http://www.kirupa.com","_blank"); }
with


this.onRelease = function(){ gotoAndPlay("scene 1, text");}

This doesn't work and I bet it's so wrong that it makes everybody who has a clue about ActionScript cry, but since it's my first flashpage...

Thank you for your help
mfg
clb

lunatic
May 11th, 2005, 01:59 PM
Welcome to the forums! =)

Do you actually have more than 1 scene? If not, you don't need to specify it in the gotoAndPlay - just use the frame number you want to go to like so:



this.onRelease = function(){
gotoAndPlay(5);
}


Even better (and even if you have multiple scenes) you can use frame labels. Click in the frame you want to go to and in the Properties panel on the left side you'll see a space to put in a frame label. Give it a name and then in the code you can use the name instead of a number. That way if you add frames or remove frames (e.g. if it is no longer 5) you don't have to worry about finding the code and changing the number:



this.onRelease = function(){
gotoAndPlay("myframelabel");
}


*edit* Check out the excellent tutorial on this very subject by my friend Senocular :love:

http://senocular.com/flash/tutorials/faq/#gotoscene

Hope this helps!
:hr:

benFusion
May 11th, 2005, 02:04 PM
if the button is embedded in something make sure you have your paths right too, it might be


_parent.gotoAndPlay(5)

or whatnot :)

3pinter
May 11th, 2005, 02:07 PM
It won't work because you are trying to 'gotoandplay' something which is IN your mc..


.mainStage
.....your_mc (this)
............gotoandplay blablabla

while you want:
.mainStage
.....you_mc (this)
.gotoandplay blablabla


Oh sorry now I see you're using a scene to refer to...


You forgot the " after "scene 1



this.onRelease = function(){
gotoAndPlay("scene 1", "text");
}


or putting another way of coding:



nameOfMyMc.onRelease = function(){
gotoAndPlay("scene 1", "text");
//_root.gotoAndPlay("text") if you are already in scene 1
}



EDIT: seems like more friends replied.... sorry took a while to type this message...;)


3Pinter
:smirk:

clb
May 12th, 2005, 04:19 PM
Thank you for your fast and friendly answers! I used the answer of benFusion because it's pretty simple and works good!
Thanks again
clb