I need help with actionscript!
Started by: AlphaMan | Replies: 15 | Views: 1,514
AlphaMan2Posts: 1,039
Joined: Sep 2012
Rep: 10
View Profile When I tried to pressing a button and for some reason it won't do what it pose to do. I have to right click and press play instead of just normally left clicking it. What's the problem here? Is it the button or is it the script? :(
This is the code I used. Using ActionScript 2 btw.
on(rollOver){
gotoAndStop (2);
}
on(release){
gotoAndStop (3);
}
on(release){
gotoAndStop (1);
}
LagPosts: 483
Joined: Jun 2007
Rep: 10
View Profile Why are there 3 such events. you can do with just one goto. Also have you bound the AS to the button? Just use go to and play to 3rd frame on release.
GMR2Posts: 3,411
Joined: Aug 2012
Rep: 10
View Profile Use this:
on(release){
_root.gotoAndStop(3);
}
You have to use _root If you want those to go to frames in the main timeline. Btw, use buttons, not movieclips. If you still have trouble, PM me the flash file and I'll fix it. ;)
LagPosts: 483
Joined: Jun 2007
Rep: 10
View Profile ???, if I'm not wrong, that's AS 3. He needs AS 2.0.
AlphaMan2Posts: 1,039
Joined: Sep 2012
Rep: 10
View Profile Why are there 3 such events. you can do with just one goto. Also have you bound the AS to the button? Just use go to and play to 3rd frame on release.
Oh, I'm not using this for animation. It's for something else. And I think I believe I did what you are talking about, I just convert the object into a button symbol, click on the symbol and typed in the AS.
GMR2Posts: 3,411
Joined: Aug 2012
Rep: 10
View Profile ???, if I'm not wrong, that's AS 3. He needs AS 2.0.
No, that's AS2. I
only program in AS2, and I use that for all of my buttons.
AlphaMan2Posts: 1,039
Joined: Sep 2012
Rep: 10
View Profile No, that's AS2. I only program in AS2, and I use that for all of my buttons.
Wanna just let me send you the .fla and you can do the coding?
carstraft2Posts: 232
Joined: Aug 2005
Rep: 10
View Profile first of all you have two onRelease events which will cause it to go to the 3rd frame and stop, and then probably go to the first frame and stop.
i'm guessing the on(release) { gotoandstop(1) - is meant to make the button go back to normal if you roll off of it. there is probably some sort of on(rollOff) similar to rollOver that you can use.
and if you want it to play, but it's just stopping at the third frame, then use gotoAndPlay(3) instead.
AlphaMan2Posts: 1,039
Joined: Sep 2012
Rep: 10
View Profile Oh. I should update you guys that the roll over and the going back to frame 1 stuff is somehow working fine.
This is the only thing I'm having problem (with new codes):
on (rollOut){
gotoAndStop (1);
}
on (release){
gotoAndStop (3);
}
Those two is on the same button.
GMR2Posts: 3,411
Joined: Aug 2012
Rep: 10
View Profile Just PM your .fla and I'll program it. :D
AlphaMan2Posts: 1,039
Joined: Sep 2012
Rep: 10
View Profile GMR2Posts: 3,411
Joined: Aug 2012
Rep: 10
View Profile Yeah. :) Send it right now!
AlphaMan2Posts: 1,039
Joined: Sep 2012
Rep: 10
View Profile GMR2Posts: 3,411
Joined: Aug 2012
Rep: 10
View Profile Cool. Lets see what I can do.
GMR2Posts: 3,411
Joined: Aug 2012
Rep: 10
View Profile I fixed your problem, but we need to find someone to downgrade this...I use CS4...