PDA

View Full Version : Simple Button, What Am I Missing!


Tiziano
05-12-2007, 10:46 PM
This is really got me stumped. Two years ago I was pretty confident in MX2004 but have been away since 2006. Now I have CS3 and have 'lost it.'

I have a button with a gotoAndPlay behavior on it and it just won't work.
I even cut and pasted from another doc that I made that does work but then it gets in this one and it doesn't work.

Attached is the file. My pride hopes it's a bug :m:

dwpegues
05-15-2007, 09:37 PM
are you forgetting about the onmouseevent() ? if you just put gotoandplay on a button you are obviously gonna run into problems. as well, put code on button on timeline. if you are embedding the code, then the procedure could be different. depends.

later

Huinoio
05-15-2007, 09:58 PM
It's probably just a scope thing with refering back to the main timeline from within the button event. Anyway, I never do that so can't say for sure, but I'll show you what I do that works. On the first frame you have a stop(); command. Take the actionscript stuff off the button and put it under frame one so it looks like this:

stop();
myBtn_btn.onRelease = function(){
gotoAndPlay(5);
};

make sure you name that next button myBtn_btn to match the event. That should work all day long.

Tiziano
05-15-2007, 10:14 PM
Thanks all but I figured it out. I had accidentally checked 'Export for ActionScript' in the linkage panel when I created the button.

Unchecked and all works as expected.