8 Replies Latest reply on May 19, 2016 12:44 PM by Colin Holgate

    Add a MC and remove after playing once

    xxblindchildxx

      Hello

       

      Using AS3, I want to add a movie clip to the stage via a keystroke. 

       

      Once the MC starts playing, further keystrokes should not add another instance of the MC, and once the MC has finished playing, it should remove itself and wait to be called again.

       

      At the moment I have:

       

      function fl_KeyboardDownHandler(event:KeyboardEvent):void

      {

           SoundMixer.stopAll(); // stop the sound first

           if (event.keyCode == 49){

                vid_mc = new msg1();

           }

           addChild(vid_mc);

      }

       

      How do I make this possible?

       

      Thanks