A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Simple if or boolean statement? I think?

Threaded View

  1. #4
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    ok this is the helmet condition, if you click helmet than you can leave.

    Instead of adding an eventlistener for each movieclip you should use the click function with e.target.name to check for movieclips clicked on. Actionscript 3.0 is faster than this javascript language
    PHP Code:
        //CODE THAT MAKES FRAMES STOP
        
    this.stop();
        
    // R O O M   1    
    // Code that makes this button live
    this.butt_hatch.addEventListener("click"butt_hatchAction.bind(this));

    // Code that makes this button work
    function butt_hatchAction() {
    this.gotoAndStop(1)
    }



    // R O O M   2    
    // Code that makes this button live
    this.butt_fridge.addEventListener("click"butt_fridgeAction.bind(this));

    // Code that makes this button work
    function butt_fridgeAction() {
    this.gotoAndStop(2)
    }



    // R O O M   3
    // Code that makes this button live
    this.butt_ladder.addEventListener("click"butt_ladderAction.bind(this));

    // Code that makes this button work
    function butt_ladderAction() {
    this.gotoAndStop(3)
    }



    // R O O M   4
    // Code that makes this button live



    // R O O M   5
    var mainStage=this
    var helmet_clicked=false


    this
    .stage.on("click", function(e) {
    if(
    e.target.name=="helmet"){
    helmet_clicked=true
    }

    if(
    e.target.name=="butt_airlock"&&helmet_clicked==true){
    mainStage.gotoAndStop(4)
    }

    }); 
    Last edited by AS3.0; 12-06-2018 at 07:50 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center