Skip to main content
Participant
September 1, 2014
Question

Question about buttons in the script

  • September 1, 2014
  • 1 reply
  • 294 views

So, I have a file where I have the action script all ready and working, and all the buttons working.  The whole file works perfectly.

But, when I make a new file and copy and paste the action script and buttons, it doesn't work!  I have the EXACT same script, and the file setting are the same as well.

Is it because I copied and pasted the actual buttons?  Or is it because of the script?  I've created new buttons, and modified the script to use their instance names, but that doesn't work either.

The weird thing is that 1 of the buttons I copied and pasted work!  I have 4 buttons total, and 3 of them change the FPS of the stage using this code -

button1.addEventListener(MouseEvent.CLICK, goNormal);

function goNormal(event:MouseEvent):void {

  stage.frameRate = 24

The button that does work uses this code -

button4.addEventListener(MouseEvent.CLICK, goEnd);

function goEnd(event:MouseEvent):void {

  gotoAndStop(1,"Scene 2");

}

I've even changed the functions around.  I've spent the last 4 hours trying to fix it, but apparently I can't.

Thanks!

This topic has been closed for replies.

1 reply

Taesik Yun
Participating Frequently
September 1, 2014

Check List

1. Check all instance names is match with script?

2. Check all assets is copied

3. Insert break point(ctrl+b) to code and run Debug(ctrl+shift+enter)

     -which line has bug? check that.

4. Is there any undefined assets?

5. Got error massage? search why that error is occurs

Participant
September 1, 2014

I've checked all of that, and it all comes up okay, unfortunately.

Taesik Yun
Participating Frequently
September 1, 2014

Would you please share that file to me?

let's figure this out.