PDA

View Full Version : question regarding onRelease


alisonc
12-13-2005, 06:24 PM
Hello,

I'm attempting some simple actionscripting, where the user clicks on a button and it jumps to a new frame. The problem is, my actionscripting is working with one of the buttons (I called it new_bw_logo button, placed it in its own layer titled "bw_logo", and inserted the actionscript into frame 1). The script is this:

new_bw_logo.onRelease = function() {
gotoAndPlay(2);
}

However, I have almost identical (the frame # in the parens is different) script for two other buttons, but neither of them work and I have no idea why :(

The one button that does not work is the new_bu_logo button, in the Be U! layer, in frame 1. The script is this:

new_bu_logo.onRelease = function() {
gotoAndPlay(31);
}

The second button that does not work is the lil_bwdot_a button, in the bwdot_a layer. The script is plugged into frame 29. The script is this:

lil_bwdot_a.onRelease = function() {
gotoAndPlay(30);
}

In other words, when I press and release my mouse on the latter two buttons, nothing happens. The first button works the way it is supposed to.

I can't for the life of me figure out what is wrong. I've tried different variations of on (release) script but to no avail. I am using Flash MX 2004 on a mac. Any suggestions would be greatly appreciated -

Thanks!

Cota
12-13-2005, 07:51 PM
Its a little flash quark......the code and the button have the reside in the first frame...

alisonc
12-13-2005, 08:03 PM
hi Cota,

Thanks for the reply - I am very much new to this, so I need a bit of clarification -

you said the code and button have to reside in the first frame (I am assuming the first frame of each button's respective layers). the new_bw_logo button is in the first frame, along with the code. but, the new_bu_logo button is also in the first frame (in its own layer), and the code is plugged into that first frame, but it is not working.

I might be misunderstanding what you mean by them both residing in the first frame, tho -

Cota
12-15-2005, 12:23 PM
Is this the first frame of a movieclip or the main timeline? As a side note, you should try to keep all your actionscript on the same frame as much as possible..

ASG
12-15-2005, 07:44 PM
you could just do this i have found it to be much easier,

click on the button you want to and the code to (just so it is selected not so you see its timeline)

go to the actions panel which should now say 'actions-button'

in the actions panel typ this code
on (release) {
gotoAndPlay(2);
}

then you can just change the frame number for each button

hope that helps

alisonc
12-24-2005, 03:09 AM
Thanks so much for the suggestions! Thanks to y'all, I was able to figure out the problem - I was attaching the script to the frame, as opposed the button itself - this is why I was having these problems.