A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: as3 button not hiding

  1. #1
    Member
    Join Date
    Jul 2008
    Posts
    94

    as3 button not hiding

    I have a button which I want to use to mute audio, which will change to a un-mute icon when it is clicked, and toggle back and forth.

    The thing is, its still visible in the stage after my code. The weirdest bit is that if I trace the visibility after I call the function, it actually says that its hidden: but its clearly visible on the stage.

    Code:
    play_pause.addEventListener(MouseEvent.CLICK, change_sound);
    
    function change_sound (e:MouseEvent):void{
            fl_NS.soundTransform = muteAudio;
            e.target.visible = false;
            trace(play_pause.visible);
            muted = true;
    }
    Here are some other things I've tried which didn't work:

    Code:
    play_pause.addEventListener(MouseEvent.CLICK, change_sound);
    
    function change_sound (e:MouseEvent):void{
            fl_NS.soundTransform = muteAudio;
            play_pause.visible = false;
            trace(play_pause.visible);
            muted = true;
    }
    Another version:

    Code:
    play_pause.addEventListener(MouseEvent.CLICK, change_sound);
    
    function change_sound (e:MouseEvent):void{
            fl_NS.soundTransform = muteAudio;
            play_pause.gotoAndPlay(2);
            muted = true;
    }
    No visual change again. Just to state some key points:

    - my movieclip is definitely called play_pause
    - it traces that it is visible before the click, and invisible after the click (the trace statement comes back false) but there is no visual change
    - the function definitely fires

    I haven't used AS3 for a while, I'm guessing I'm making a really noob mistake? Full code: http://pastebin.com/RirGdS1w

    Link to .fla file: http://db.tt/51DD0Fbl

  2. #2
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    I tried your fla, and it works for me. The button goes away, I see false in the log.
    who is this? a word of friendly advice: FFS stop using AS2

Tags for this Thread

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