1
votes

Hi im trying to use the FLVPlayback function in a emagazine flippage and i can get the FLV to play if i remove all the code from the flash file then its starts and plays . but i need it to be controlled by the code that i posted under here

When the magazine loads i need the flash movie to stop or pause when the viewer gets to the page where this film is located its sends a signal startAnimation4 and it should start playing the flash movie including the FLVPlayback , if the viewr flips to next page there is a event called onpageLeave that send the signal stopAnimation4 and the flash film and FLVPlayback should pause or stop.

Is there some one that have a idea of how i can do this ?

 //Prevent automatic playback
 stop();
 FLVPlayback.pause();

//Import eMagStudio AS3 API
//import SWFHolderAPI.*;

//Initiate the EMSMediator class
EMSMediator.instance.init(this, eMagListener);

//Set variable that controls playing when the clip is called using playonce
if(playedOnce == undefined){
var playedOnce:Boolean = false;
}

//Callback function for events in the eMag. Responds to the broadcasts startAnimation     and stopAnimation 
    function eMagListener(event:MessageEvent):void{
//Broadcast coming from eMagStudio
var eMagBrdcast:String = String(event.message);
if(eMagBrdcast == "startAnimation4"){
    setTimeout(myFunction, 800);
        function myFunction() { 
            play();
        }

}else if(eMagBrdcast == "startAnimationOnce4"){
    if(!playedOnce){
        playedOnce = true;
        play();
    }
}
if(eMagBrdcast == "stopAnimation4"){
    stop();
}else if(eMagBrdcast == "stopAnimationOnce4"){
    if(!playedOnce){
        playedOnce = true;
        stop();
    }
}   

}

1

1 Answers

0
votes

I think that your best approach here would be to create a custom event class for the page flipping events if possible. That way you can pass the video player object through the custom event class when the pageflip events are triggered so that you can instruct them what to do (i.e. play, stop, etc.) So basically, if you do have control of the dispatching of the page flip events, you would create the event object, assign the movie player component instance to a variable in the event object you instantiated, and then dispatch the event with the event object you just created.

Also, if memory serves me right, isn't FLVPlayback the name of the component used to provide FLV Player Controls? Are you using that same name as the instance name of your video players that you have added to the stage? If so, I would not do that and instead rename them to something else.