actionscript 3 - MouseEvent Listener not working with SimpleButton AS3 -
So I had to rewrite a project using the Starling framework and using extension wings, and now I'm trying to work my button is currently in my code
package {import flash.display.bitmap; Import Flash. Display.Simpling; Import flash.events.MouseEvent; / ** * ... * @ Author Extends Fluxan * / Public Class Start Screen Screen {Public category startGameButton: SimpleButton; Public Variable Option Button: Sarbatban; [Embed (source = "Assets \\ playGameButtonUp.png")] Personal PriorityBenton: Class [Embed (source = "assets \\ playGameButtonDown.png")] private var playButtonDown: class [embed (source = "property \\" Title Screen. PNGG ")] Personal Center Background: Class; Public Function StartScreen () {mouseChildren = true; Super;) StartGameButton = New SimpleButton (new playButtonUp), new playButtonDown (); AddChild (new background ()) ; AddChild (startGameButton); StartGameButton.addEventListener (MouseEvent.CLICK, goToGame); trace (startGameButton.getBounds (forums));} Private Function goToGame (e: MouseEvent): Shun (Trace ("mouse clicked"); main (parent) .goToGame ();}} }
This code works, as my Nearly the mouse is the event listener in the whole startupphone object, but when I connect the listener to the button, this trigger is never a bit stupid, but my google-fu is not working for me right now. < P> Edit: The screen is just a base square, which extends from each of my games , Eg. GameScreen, StartScreen, OptionScreen are all categories in my project
You did not give the button with hitTestState - it was disabled You have only given it up and hover states.
startGameButton = new SimpleButton (new playButtonUp), new playButtonDown (), new playButtonDown (), new playButtonDown ());
Comments
Post a Comment