• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Unload external video mp4 files in Animate

Community Beginner ,
Nov 28, 2023 Nov 28, 2023

Copy link to clipboard

Copied

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!

Views

150

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Nov 29, 2023 Nov 29, 2023

This code works

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

Votes

Translate

Translate
Community Expert ,
Nov 28, 2023 Nov 28, 2023

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

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();

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

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();
 }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

can you answer my question?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

File - Import Video - Load external video with playback component - Browse to video - skin set to none - finish

 

Then - the instance name VideoCause

 

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

 apply the stop() method in your listener function with gotoAndStop(1). ie, this

 

VideoCause.stop();

 

would work if you did this correctly.  because it's not working, you probably have many different instances of your video component (and if they're in different scenes, it's guaranteed you have different instances).  the best solution would be to eliminate scenes and just use keyframes and labels.

 

an alternative is to assign each flvplayback nstance a different instance name, and apply the stop() method to the relevant instance.

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

I didnt change the code - exported using AIR Package installed to my test station and it is working great.

 

Do you use this code to launch stage 100%? I add this action script to first frame.

stage.displayState = StageDisplayState.FULL_SCREEN;

Any updated way that works better?

 

Thank you for your help

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

The stage code above doesn't work, it launches full screen but then causes the presentation to not function properly. Any idea how too launch full screen without the title bar at top?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

is the video issue solved?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

Its working but it didn't work with the suggested -

" apply the stop() method in your listener function with gotoAndStop(1). ie, this

 

VideoCause.stop();"

It would not even publish. Thank you though, help is greatly appreciated.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

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

 

what did you do to solve the problem?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

This code works

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

LATEST

you're welcome.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines