7 Replies Latest reply on May 6, 2015 4:26 AM by joepontanoni@gmail.com

    Opening a SWF file, and a button to close it

    joepontanoni@gmail.com

      I'm struggling with Actionscript 3 with this functionality.

       

      So far, I have code which will open and start the SWF file, whereby I have the SWF inserted into a certain frame within a movie clip (the beakerBCI, frame 191) and so clicking the object takes you to that frame and plays the SWF file

       

      beakerBCI.addEventListener(MouseEvent.CLICK, ClickBeakerBCI);

      function ClickBeakerBCI(event:MouseEvent):void {

        beakerBCI.gotoAndPlay(191);

        SoundMixer.stopAll();

      }

      Though I'm sure this isn't the right way to do it, it can do the job. But I'm having trouble in a way to actually close the SWF video, but allow for it to be opened with another click . I tried coding a close button within the same movie clip, which functions by going back to a frame in the movie clip where the SWF is no longer present

       

      crossbuttonBCI.addEventListener(MouseEvent.CLICK, ClickCrossBeakerBCI);

      function ClickCrossBeakerBCI(event:MouseEvent):void {

      gotoAndPlay(105);}

      But right now all this code does is goes back to the frame 191 for some reason.

       

      How would I go about this?

       

      Please ask if it's not clear! If possible, I'd appreciate a way which doesn't involve me having to change the first bit of code I quoted too drastically, but if that isn't possible then fine. Thankyou.