Share Posted February 27, 2011 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 More sharing options...
Share Posted March 1, 2011 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 More sharing options...
Author Share Posted March 1, 2011 Thank you! I wasn't able to determine that from the documentation... Much appreciated, Pol Link to comment Share on other sites More sharing options...
Author Share Posted March 1, 2011 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 More sharing options...
Share Posted March 1, 2011 import com.greensock.events.LoaderEvent; Link to comment Share on other sites More sharing options...
Share Posted June 28, 2011 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 More sharing options...
Share Posted June 28, 2011 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 More sharing options...
Share Posted June 28, 2011 Scratch that, you were 100% right... (Lack of sleep tends to turn the blinders on) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now