Skip to main content
Devoted1970
Inspiring
Nov 28, 2023 7:44 PM UTC
Answered

Unload external video mp4 files in Animate

Hello and thanks for any help in advance. I am attempting to create a simple presentation in animate that plays external videos from a button interface. I have imported the videos to 6 separate frames in the scene, frames 10, 20, 30, 40, 50, 60. The interface is on frame 1 containing 6 buttons. Code frame 1 -

 

Cause.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame);
function fl_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
gotoAndStop(10);
}
Blower.addEventListener(MouseEvent.CLICK, f2_ClickToGoToAndStopAtFrame);
function f2_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
gotoAndStop(20);
}
Leak.addEventListener(MouseEvent.CLICK, f3_ClickToGoToAndStopAtFrame);
function f3_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
gotoAndStop(30);
}
SVideo.addEventListener(MouseEvent.CLICK, f4_ClickToGoToAndStopAtFrame);
function f4_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
gotoAndStop(40);
}
SJet.addEventListener(MouseEvent.CLICK, f5_ClickToGoToAndStopAtFrame);
function f5_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
gotoAndStop(50);
}
Scan.addEventListener(MouseEvent.CLICK, f6_ClickToGoToAndStopAtFrame);
function f6_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
gotoAndStop(60);
}
 
this.stop();

 

The buttons work, play head jumps to requested frame video plays on stage. The viewer navigates back with a back button. Code -

BackButton.addEventListener(MouseEvent.CLICK, f7_ClickToGoToAndStopAtFrame);
function f7_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
gotoAndStop(1);
}

 

The problem is the videos do not unload and continue to play in the background. I know I am forgetting some code or maybe the way I have designed this won't be possible but I was trying the simplest solution. I have not worked in animate in years, any help would be GREATLY appreciated! 

 

Thank you!

    This topic is closed to new replies. Start a new post to keep the conversation going.
    Devoted1970
    Devoted1970Correct answer
    Inspiring
    Nov 30, 2023 4:06 AM UTC

    i explained why that won't work with the way you set up your fla.

     

    what did you do to solve the problem?


    This code works

    BackButton.addEventListener(MouseEvent.MOUSE_DOWN, stopVideoCause);
     function stopVideoCause(evt:MouseEvent):void
     {
    VideoCause.stop();
     }
     
    Thank you!

    13 replies

    kglad
    Community Expert
    Community Expert
    Nov 29, 2023 3:36 AM UTC

    are the videos loaded into an flvplayback component?  embedded in a timeline?  

    Translate
    Devoted1970
    Inspiring
    Nov 29, 2023 4:55 PM UTC

    Thanks for the response, I actually found an old project I did years ago and used the same code. It seems to work without issue in the swf but when launched from an exe it has issues for some reason. Still doing some testing but is their any known issues with the new way these are exported to exe?

     

    This is the code I am using. I broke the project into scenes.

    CauseOfLoss.addEventListener(MouseEvent.CLICK, CauseOfLoss1);
     
    function CauseOfLoss1(event:MouseEvent):void
    {
    MovieClip(this.root).gotoAndStop(1, "Cause");
    }
    BlowerDoor.addEventListener(MouseEvent.CLICK, BlowerDoor1);
     
    function BlowerDoor1(event:MouseEvent):void
    {
    MovieClip(this.root).gotoAndStop(1, "Blower");
    }
    LeakDetection.addEventListener(MouseEvent.CLICK, LeakDetection1);
     
    function LeakDetection1(event:MouseEvent):void
    {
    MovieClip(this.root).gotoAndStop(1, "Leak");
    }
    SewerInspect.addEventListener(MouseEvent.CLICK, SewerInspect1);
     
    function SewerInspect1(event:MouseEvent):void
    {
    MovieClip(this.root).gotoAndStop(1, "SVideo");
    }
    HydroJetting.addEventListener(MouseEvent.CLICK, HydroJetting1);
     
    function HydroJetting1(event:MouseEvent):void
    {
    MovieClip(this.root).gotoAndStop(1, "SJet");
    }
    HydroScan.addEventListener(MouseEvent.CLICK, HydroScan1);
     
    function HydroScan1(event:MouseEvent):void
    {
    MovieClip(this.root).gotoAndStop(1, "Scan");
    }
     
    stop();

     

    Translate
    Devoted1970
    Inspiring
    Nov 29, 2023 4:57 PM UTC

    Actually that is my main Nav code, Scene code below

    BackButton.addEventListener(MouseEvent.CLICK, Vid1);
     
    function Vid1(event:MouseEvent):void
    {
    MovieClip(this.root).gotoAndStop(1, "Home");
    }
    BackButton.addEventListener(MouseEvent.MOUSE_DOWN, stopVideoCause);
     function stopVideoCause(evt:MouseEvent):void
     {
    VideoCause.stop();
     }
    Translate