Jump to content


Package and Event Type for VideoLoader.VIDEO_COMPLETE?

Recommended Posts



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;

function loadVideoAndPause():void
video = new VideoLoader("video/pol.flv",{autoPlay:false,volume:0});

function videoComplete(e:VideoLoader):void
dispatchEvent(new Event("complete"));


Thanks for any help!

Link to comment
Share on other sites

Your code looked fine except for the data type of the event in your handler:


BAD: function videoComplete(e:VideoLoader):void

GOOD: function videoComplete(e:LoaderEvent):void

Link to comment
Share on other sites

Thank you!


I wasn't able to determine that from the documentation...


Much appreciated,


Link to comment
Share on other sites

One more thing -


What imports are required for this? I'm getting an error when I use e:LoaderEvent (can't convert type to LoaderEvent)?

Link to comment
Share on other sites

import com.greensock.events.LoaderEvent;

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

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

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

Scratch that, you were 100% right... (Lack of sleep tends to turn the blinders on)

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.