Copy link to clipboard
Copied
I am using AS2 and need help figuring out why this simple button script is not working:
stop();
buttonWS1.onRelease = function(){
gotoAndStop("Stage1and2_Boss",4);
};
buttonWS2.onRelease = function(){
nextFrame();
};
//end
My buttons are the square letter-puzzles below. They are images that I converted to "symbols" (specifically, buttons). I put their names as above (buttonWS1, buttonWS2, etc.) in the "instance names" boxes.
I have no idea what is going on. Please help!
Copy link to clipboard
Copied
buttonWS1 is problematic but buttonWS2 should work. does it advance the timeline that contains that code to the next frame?
Copy link to clipboard
Copied
Thanks for the response. Neither works. Neither advances the timeline. I have to put a continue button on the page for it to advance.
The strange thing is that at one point I got one of the puzzles to work as a button. But then i changed all the images, and I can't get even one of them to work.
Any ideas?
Message was edited by: sjc77
Copy link to clipboard
Copied
go to the frame that contains your button code.
click on the object you think is buttonWS2.
1. check the properties panel to see if buttonWS2 is listed as that button's instance name.
2. make sure there's no code attached to that button
if both those check out, add a trace statement to that button's onRelease and check if the onRelease executes by clicking it and watching for the trace output.
Copy link to clipboard
Copied
Hi -
1. Yes, buttonWS2 is the instance name
2. The only code attached to it is the code I pasted above.
3. onRelease does not execute because my trace statement does not appear in the output
Here is the modified code for buttonWS2:
buttonWS2.onRelease = function(){
trace("clicked!");
nextFrame();
};
Question: It shouldn't matter if I have commented-out code within that set of codes should it?:
buttonWS2.onRelease = function(){
//if (puzzleschosenarray[0] == 2 || puzzleschosenarray[1] == 2) {
// cannot be chosen -- make button non-functional
//}
//else{
//puzzleschosenarray[roundnumber-1] = 2;
trace("clicked!");
nextFrame();
//}
};
Copy link to clipboard
Copied
your commented code looks good.
now take and attach 2 screenshots. one that shows your timeline and buttonWS2 selected on stage and shows the properties panel so i can confirm buttonWS2 is named correctly and a second that shows your timeline and the actions panel with the latest buttonWS2.onRelease.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Find more inspiration, events, and resources on the new Adobe Community
Explore Now