Skip to main content
Participant
January 11, 2011
Question

Button is not working..

  • January 11, 2011
  • 3 replies
  • 1938 views

Hi.
I´m John and I´m from Croatia.
So,
I´m working on some iPhone app project in Flash CS5 Pro.
And I place button, and using "Code Snippets" select "Click to go to next scene and play" but when I click nothing happends.
Type is setted to "Movie Clip", I draged and dropped "Button" from some menu (I don´t remember wich one :P).
Name of next scene is "2" (without quotes)

Here´s code:
button.addEventListener(MouseEvent.CLICK, fl_ClickToGoToNextScene_4); function fl_ClickToGoToNextScene_4(event:MouseEvent):void {     MovieClip(this.root).nextScene(); }

Please help me!
And sorry for my bad English

Thanks,
John!


This topic has been closed for replies.

3 replies

Participant
November 10, 2011

i think it is working proply,u shoud add stop(); function in your first scen and add MovieClip(this.root).nextScene(); in your button

then go 2nd scen add stop(); function

your code is working but we cat out put becose flash 2nd scen aouto play

Participating Frequently
January 14, 2011

Try this:

button.addEventListener(MouseEvent.CLICK, goToScene);

function goToScene(event:MouseEvent):void
{
     MovieClip(this.root).gotoAndPlay(1, "2");
}

Where "2" is the scene name.

Participant
January 14, 2011

ArgumentError: Error #2108: Scene 2 was not found.

at flash.display::MovieClip/gotoAndPlay()

at Untitled_fla::MainTimeline/goToScene()[Untitled_fla.MainTimeline::frame1:5]

crap.
I started thinking about buying (here in Croatia) soo overpriced Mac (In US prices are 2x lower), and start learning XCode :S

Participating Frequently
January 14, 2011

NemoStein wrote:

Where "2" is the scene name.

This error tell us that your scene isn't called "2".


It is probably "Scene 2", but could be different.

Fill the string with the correct name and try again.

I tryed here to simulate the problem, but couldn't.

There is, probably,  something wrong with your FLA or code.

kglad
Community Expert
Community Expert
January 11, 2011

go to the first keyframe that contains your button and click on that button to select it.  in the properties panel, type "button" without quotes in the <instance name> textfield.  retest.

Participant
January 11, 2011

No, It´s not working...

kglad
Community Expert
Community Expert
January 11, 2011

use the trace() function to see if your listener function is called when your button is clicked.