Jump to content
Search Community

Package and Event Type for VideoLoader.VIDEO_COMPLETE?

pol test
Moderator Tag

Recommended Posts

Hi,

 

I can't seem to find in the docs how to write the syntax for a VideoLoader.VIDEO_COMPLETE event. The events listed in the docs don't specify this event (only the constant itself) and when I run the following code I get an error that it can't convert LoaderEvent to VideoLoader (when the function videoComplete() is called):

 

import com.greensock.loading.*;
import com.greensock.events.*;
var video:VideoLoader;

stop();
function loadVideoAndPause():void
{
video = new VideoLoader("video/pol.flv",{autoPlay:false,volume:0});
video.addEventListener(VideoLoader.VIDEO_COMPLETE,videoComplete,false,0,true);
video.load();
addChild(video.content);
}

function videoComplete(e:VideoLoader):void
{
video.gotoVideoTime(0,false,true);
dispatchEvent(new Event("complete"));
}

 

Thanks for any help!

Link to comment
Share on other sites

  • 3 months later...

Hey guys,

I'm having a problem with the VideoLoader.VIDEO_COMPLETE as well. I think my code is Ok because it actually fires the function I created for the end of the video, but I still receive an error.

 

TypeError: Error #1034: Type Coercion failed: cannot convert com.greensock.loading::VideoLoader@475b3f11 to flash.display.MovieClip.
at Function/http://adobe.com/AS3/2006/builtin::apply()
at com.greensock.core::TweenCore/complete()
at com.greensock::TweenMax/complete()
at com.greensock::TweenMax/renderTime()
at com.greensock.core::SimpleTimeline/renderTime()
at com.greensock::TweenLite$/updateAll()

 

Here is my code

 

var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler});
var video:VideoLoader = new VideoLoader("blablabla.f4v", {name:"bhVideo", container:vidHolder, width:720, height:406, x:-360, y:-203,  bgColor:0x000000, autoPlay:false, volume:.8, requireWithRoot:this.root, estimatedBytes:1800000});
queue.append( video );
queue.load();

function playVid(){
       video.addEventListener(VideoLoader.VIDEO_COMPLETE, vidComplete,false,0,true);
video.playVideo();
}
function vidComplete(event:LoaderEvent):void{
 doSomething();
}


Link to comment
Share on other sites

That looks like it has nothing to do with LoaderMax - it's a problem with some function that you defined as an onComplete in one of your tweens. It sounds like maybe you're passing an instance of the VideoLoader as one of the parameters but your function signature requires a MovieClip. For example:

TweenLite.to(mc, 1, {x:100, onComplete:myFunction, onCompleteParams:[myVideoLoader]});
function myFunction(param1:MovieClip):void {
   //this will throw an error because you're passing a VideoLoader as the parameter, but the method requires a MovieClip.
}

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...