Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 72601

how to check if a button is clicked in an if statement

$
0
0

Alright so, I'm making a game. I forgot how to do some coding over the year and I'm starting up back again. So here's the deal; I can't remember how to check if a button has been clicked in an if statement. For example, if button1 is down, than invoke this function.

 

Anyone got any ideas? Here's what I have:

 

 

package{

  import flash.display.MovieClip;

  import flash.text.TextField;

 

  public class FirstClass extends MovieClip {//

  public var b1:TextField = new TextField

  public var pic1:picture1 = new picture 1

  public var background:BG = new BG

 

  private function summonGabe(){//assigns properties to b1 and adds it

  b1.addEventListener(MouseEvent. CLICK, clickHandler);

  function ClickHandler(event:MouseEvent){

  b1.boarder = true

  b1.text = Summon Lord Gaben 

  b1.x = 300

  b1.y = 350

  b1.height = 100

  }

  }

 

  private function stateOne(){//the function in which i want to check if the button is pressed, if so than invoke summonGabe

  if( ){

      summonGabe();

      trace("You have awoken the one and only, Lord Gaben!")

    }

 

  }

 

  private function FirstClass(){//constructor

  addChild(background);

  trace(“Welcome to the Land of Lord Gaben”);

  summonGabe();

  }

 

  }//end of class

}//end of package


Help please  ^^


Viewing all articles
Browse latest Browse all 72601

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>