A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: What is wrong with this AS3

  1. #1
    Junior Member
    Join Date
    Dec 2015
    Posts
    2

    What is wrong with this AS3

    import flash.utils.Timer;
    import flash.events.TimerEvent;
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    var done:Boolean;

    skip_btn.alpha = 0;
    pause_btn.visible = false
    play_btn.alpha = 0;

    skip_btn.addEventListener(MouseEvent.CLICK, ClickToSkip);
    function ClickToSkip(event:MouseEvent):void{
    MovieClip(this.root).gotoAndStop(1, "First page");
    SoundMixer.stopAll();
    }


    play_btn.addEventListener(MouseEvent.CLICK, ClickToStop);
    function ClickToStop(event:MouseEvent):void{
    stop();
    play_btn.visible = false
    pause_btn.visible = true

    }

    pause_btn.addEventListener(MouseEvent.CLICK, ClickToPlay);
    function ClickToPlay(event:MouseEvent):void{
    play();
    play_btn.visible = true
    pause_btn.visible = false

    }

    stage.addEventListener(MouseEvent.MOUSE_MOVE, MouseMoved);
    function MouseMoved(event:MouseEvent):void{
    if (!done) {
    var playFI:Tween = new Tween(play_btn,"alpha",Strong.easeOut,0,1,2,true)
    var skipFI:Tween = new Tween(skip_btn,"alpha",Strong.easeOut,0,1,2,true)
    }
    done = true;
    }



    What is wrong with this, for some reason my playbutton and pausebutton dont seem to pause the frame, they do change form however. i used ctrl + enter to test my scene. forum.png
    Please help me out

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    I think you have some code slightly mixed up,

    PHP Code:
    pause_btn.addEventListener(MouseEvent.CLICKClickToStop);
    function 
    ClickToStop(event:MouseEvent):void
    {
        
    stop();
        
    event.currentTarget.visible false;
        
    play_btn.visible true;

    }

    play_btn.addEventListener(MouseEvent.CLICKClickToPlay);
    function 
    ClickToPlay(event:MouseEvent):void
    {
        
    play();
        
    event.currentTarget.visible false;
        
    pause_btn.visible true;


  3. #3
    Junior Member
    Join Date
    Dec 2015
    Posts
    2

    Unhappy thanks but....

    Quote Originally Posted by fruitbeard View Post
    Hi,

    I think you have some code slightly mixed up,

    PHP Code:
    pause_btn.addEventListener(MouseEvent.CLICKClickToStop);
    function 
    ClickToStop(event:MouseEvent):void
    {
        
    stop();
        
    event.currentTarget.visible false;
        
    play_btn.visible true;

    }

    play_btn.addEventListener(MouseEvent.CLICKClickToPlay);
    function 
    ClickToPlay(event:MouseEvent):void
    {
        
    play();
        
    event.currentTarget.visible false;
        
    pause_btn.visible true;

    It was my intention to mix up the stop for play since i wasn't bothered, but thanks anyway. But that wasn't the problem. When i run the code and press the actual pause button. it doesn't stop at the current frame, yet the skip button does work. There are no syntax errors or any compiler errors. really stuck here...

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Well attach your *.fla for us to see, hard to say without exploring.

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