alex_s Posted June 29, 2010 Share Posted June 29, 2010 Hi Mr Greensock\any other helpfull forum user, Like the work you've done with LoaderMax, I'm having a problem with the complete handler on a loaded FLV. I've searched the forum, the solution at: viewtopic.php?f=6&t=3019&p=11437&hilit=video#p11437 doesnt help. I'm loading a settings.xml file that coudl change location, and this loads all the assets for the project. So I cant use the VideoLoader like so var vl:VideoLoader = new VideoLoader("video.flv", {name:"video", container:this, autoPlay:true}); vl.addEventListener(VideoLoader.VIDEO_COMPLETE, test); function test(event:Event):void { trace("DONE"); } ...as its brought in like so: var videoIntro:ContentDisplay = LoaderMax.getContent("video_intro"); how do I handle the video above? access the raw content? many thanks in advance. Alex Link to comment Share on other sites More sharing options...
GreenSock Posted June 29, 2010 Share Posted June 29, 2010 Are you just saying that your VideoLoader is defined inside the XML? If so, that's no problem. Once the XML is parsed (INIT event gets dispatched), you can get that VideoLoader instance by name or url, like: var vl:VideoLoader = LoaderMax.getLoader("video_intro") as VideoLoader; vl.addEventListener(VideoLoader.VIDEO_COMPLETE, test); Just don't forget to activate() the VideoLoader before you load the XML, otherwise XMLLoader won't recognize that tag in the XML. LoaderMax.activate([VideoLoader]); Does that answer your question? Link to comment Share on other sites More sharing options...
alex_s Posted June 29, 2010 Author Share Posted June 29, 2010 Thanks for the reply, you've given me a lead, hopefully the breakthrough will help. I'll post my success/failure here. Link to comment Share on other sites More sharing options...
alex_s Posted June 30, 2010 Author Share Posted June 30, 2010 Not having much luck. My project preloader swf looks like so: (shortened onComplete) public function Preloader() { // set visibility //movMain.movBook.visible = false; //we know the XML contains ImageLoader, SWFLoader, DataLoader, and MP3Loader data, so we need to activate those classes once in the swf so that the XMLLoader can recognize them. LoaderMax.activate([imageLoader, SWFLoader, DataLoader, MP3Loader, VideoLoader]); //create an XMLLoader loader = new XMLLoader("settings.xml", {name:"xmlDoc", requireWithRoot:this.root, estimatedBytes:1400}); //Or you could put the XMLLoader into a LoaderMax. Create one first... queue = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler, onInit:initHandler}); //append the XMLLoader and several other loaders queue.append(loader); //begin loading queue.load(); var format:TextFormat = new TextFormat(); format.letterSpacing = 31; function progressHandler(event:LoaderEvent):void { //trace("progress: " + event.target.progress*100); if(event.target.progress*100 < 99){ movCubes.txtProgress.text = String(Math.round(event.target.progress*100)); movCubes.txtProgress.setTextFormat(format); }else if(event.target.progress*100 > 99){ movCubes.txtProgress.text = "99"; movCubes.txtProgress.setTextFormat(format); } } // I shortened this, but it goes through and loads assets into the main swf. function completeHandler(event:LoaderEvent):void { var imageEnter:ContentDisplay = LoaderMax.getContent("img_enter"); var imageTopPanel:ContentDisplay = LoaderMax.getContent("img_top_panel"); var videoIntro:ContentDisplay = LoaderMax.getContent("video_intro"); etc etc } And my settings.xml file like so (again shortened) <?xml version="1.0" encoding="iso-8859-1"?> etc etc at the moment, if I use: addChild(videoIntro); the video plays, but I want more control, like pause at the start, an oncomplete handler etc. I couldn't get the init listener to work as you mentioned. Can you help? thanks, Alex Link to comment Share on other sites More sharing options...
GreenSock Posted June 30, 2010 Share Posted June 30, 2010 the video plays, but I want more control, like pause at the start, an oncomplete handler etc. I couldn't get the init listener to work as you mentioned. Can you please explain exactly what isn't working and what you're trying and what (if any) error messages occur? I didn't see where you tried to handle the init listener. In fact, it would be SUPER helpful if you'd whip together the simplest example FLA possible and post it here so that I can see the issue immediately. It's very tough to troubleshoot blind. It looks like you may be using nested functions which is usually a big "no-no" because they're always deleted when the parent function finishes running. Maybe that's the problem. Does it ever call the completeHandler()? Try adding a trace() to find out. Link to comment Share on other sites More sharing options...
alex_s Posted July 1, 2010 Author Share Posted July 1, 2010 Hi Jack, thanks for the reply. I removed the nesting (a side effect of copying your example), and found the solution! ..I had to upgrade to the latest version due to a flciker at teh start. And these magic words helped me. To be fair it was in the API, but your guidance helped me! ..hope it helps anyone else! THIS ISNT THE ORDER THE METHODS WERE USED, just a dump for anyone looking to copy/paste some commands! ldrVideo = LoaderMax.getLoader("video_intro") as VideoLoader; ldrVideo.content.alpha = 0; ldrVideo.addEventListener(VideoLoader.VIDEO_COMPLETE, ldrVideoComplete); addChildAt(vl.content,1); ldrVideo.pauseVideo(); vl.content.alpha = 1; vl.gotoVideoTime(0, true); 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