Jump to content
Search Community

How to terminate video

lemonlemon test
Moderator Tag

Recommended Posts

hi,

 

I have loaderMax to load video and want to terminate/hide video when hitting something else in navigation.

Here´s the code so far:

 

stop();

 

import com.greensock.loading.*;

import com.greensock.loading.display.*;

import com.greensock.*;

import com.greensock.events.LoaderEvent;

 

//video loader

 

//create a VideoLoader

var video:VideoLoader = new VideoLoader("images/mat_sss.m4v",

{name:"myVideo", container:this, x:500, y:250, width:320, height:240,

scaleMode:"proportionalInside", bgColor:0x000000, autoPlay:false, volume:0,

requireWithRoot:this.root, estimatedBytes:26000});

 

//start loading

video.load();

 

//add a CLICK listener to a button that causes the video to toggle its paused state.

play_btn.addEventListener(MouseEvent.CLICK, togglePause);

function togglePause(event:MouseEvent):void {

video.videoPaused = !video.videoPaused;

}

Link to comment
Share on other sites

you're not the only one

i have a video loaded in an mc on the stage

when i remove the children in that mc on an menuClick the sound is still playing

 

therefor i think i'll have to close the netstream of the loaded video before removing is form mc

 

the way to target the loaded video and it's netstream is not very clear to me

 

http://forums.greensock.com/viewtopic.php?f=6&t=4545

Link to comment
Share on other sites

could you please be more specific on this one, can't figure out how to make it work.

 

Let's say I have button X and when clicked it should make the video invisible/removes it...

 

Well, making something invisible and removing it are two completely different things. If you want to totally destroy it, use dispose(true). If you want to hide it, then set the "visible" property of the ContentDisplay object to false (and pauseVideo()).

 

var video:VideoLoader = new VideoLoader("video.flv", {container:this, autoPlay:true});
video.load();
myButton.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(event:MouseEvent):void {
   video.dispose(true); 
}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...