A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] onClick anywhere...? is this possible? please help

  1. #1
    Junior Member
    Join Date
    Feb 2010
    Posts
    11

    resolved [RESOLVED] onClick anywhere...? is this possible? please help

    Hi guys..

    This is tricky to explain but I've been struggling for a few days with something that I thought would be really simple.

    Basically I've got an introduction to an application I'm building which has photos fading in and out (created with tweens). After this, the next frame is the home screen.

    What I want is to loop frames 1-64 (the photos) which I have done with a simple gotoAndPlay(1);

    But when anywhere on the stage between frames 1-64 is clicked then it goes to frame 65. So basically, the intro loops and loops until the user clicks anywhere on the stage

    Is this possible? Thanks in advance!! xx

  2. #2
    Junior Member
    Join Date
    Feb 2010
    Posts
    11
    Hi again....

    Just made some progress (I think?!)

    stage.addEventListener(MouseEvent.CLICK,whenClicke d);

    function whenClicked(e:MouseEvent):void {
    gotoAndPlay(65);
    }


    This seems to work. But how do I effectively end this function?? Because currently it takes me to the home screen but now none of my other buttons work, the only thing that works is clicking anywhere on the stage!

    Thankyou xx

  3. #3
    Junior Member
    Join Date
    Nov 2008
    Posts
    23
    Quote Originally Posted by hanky1044 View Post
    "How do I effectively end this function??"
    I see no one has replied... I have not been on this site in a few years but hopefully these days I will be more active .

    As for how to end an function called by an eventListener you need to use removeEventListener as follows:

    PHP Code:
    stage.removeEventListener(MouseEvent.CLICK,whenClicked); 
    I hope this is what you where looking for

    -Alex

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