Search the Community
Showing results for tags 'loading'.
-
How to insert/combine window load(loading until all page loaded) to function "setup reveal" in gsap. So, the page load all resource before star animation. Like this: window.addEventListener("load", () => { const tl = gsap.timeline(); tl.to(".loader", { delay: 2, opacity: 0, duration: 1, ease: Power3.easeOut }); function setupReveal(container) { container.ctx = gsap.context(() => { //gsap code... }); } Like this but combine windowload with function setup reveal, ctx context : https://codepen.io/byhndo/pen/oNmjaWb
-
The first parameter of the various loaders (ImageLoader, XMLLoader, SWFLoader, MP3Loader, etc.) accepts either a simple String URL or a URLRequest. So if you want to pass data to the server, simply construct a URLRequest accordingly, like: var request:URLRequest = new URLRequest("http://www.yourDomain.com/whatever.php"); var data:URLVariables = new URLVariables(); data.exampleSessionId = new Date().getTime(); data.exampleUserLabel = "label1"; request.data = data; request.method = URLRequestMethod.POST; var loader:ImageLoader = new ImageLoader(request, {name:"image1"});
-
Hi everyone, I'm very new to GSAP and have little JS experience, but I'm rebuilding my portfolio and would like to implement something that seems very easy but I can't find anything on how to implement this properly. Basically what I want to do is trigger an animation when someone leaves the page (clicks a link), show a loading screen while the new page loads and when the page is loaded show an inverted animation. It's an overlay of the viewport that I want to animate. First of, is TweenMax suited to be used this way? And can this be achieved without using AJAX, so that it just fires on page leave, shows the loader en inverts the animation when the page is loaded? Animsition offers almost what I need with their overlay transition, but I need multiple layers of the overlay so was looking into TweenMax to achieve this. Hope someone can help me! Thanks!
-
I have a timeline consisting of tweens that change an SVG text element. The text element begins with a value of 400. The first tween will change the text content to 300, the second tween to 200, and the third and final tween to 100. When the page is finished loading, instead of showing the initial value the text element is set to (in this case 400), it shows the value the element will be set to by the FIRST tween (300). Not the final tween, (100) nor the middle tween (200), but the first one. How do I ensure that when the page is loaded, the target elements to be tweened are set to it's initial values BEFORE playing the timeline, and not any of it's future values to be set later?
- 1 reply
-
- wrong values
- timelinemax
-
(and 2 more)
Tagged with:
-
Hi all... Based on one of your Great Codes I developed this one : It is all about 4 SWF files that will be load one after another then it stores last swf you ran when you close it ( when you exit each one it will be load next time exactly the same SWF you've exited). for example if you close swf number 3 , next time you start the main swf you will start from SWF number 3... But there is a big problem here ... Each of my SFWs are about 10 to 16 Mb (I didn't create them with flash) and unfortunately your code seem to load all of them at once ... then play them in sequence ... I have to load more than 100 SWF files and it will definitely cause RAM issue ... Each one cost me 10-16MB... I'm not a programmer but I'm thinking why showing multiple SWF files and remembering where you left is that hard in 2018 ??? ... Please Help me find a way to load swfs one after another and save last status of it ... You're My Last Hope Carl ... Thanks import flash.events.FullScreenEvent; import flash.display.StageScaleMode; stage.scaleMode = StageScaleMode.SHOW_ALL; stage.displayState = StageDisplayState.FULL_SCREEN; import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import flash.display.MovieClip; import flash.events.Event; import flash.events.MouseEvent; import flash.net.SharedObject; import flash.events.MouseEvent; var mySO:SharedObject = SharedObject.getLocal("edfiujy6grwfh"); var reza:Number = -1; var loaderIndex:Number = -1; loaderIndex = mySO.data.my_vis; if (!mySO.data.my_vis) { loaderIndex = -1; } if (mySO.data.my_vis == 1) { loaderIndex = 0; } if (mySO.data.my_vis == 2) { loaderIndex = 1; } if (mySO.data.my_vis == 3) { loaderIndex = 2; } if (mySO.data.my_vis == 4) { loaderIndex = 3; } progress_mc.scaleX = 0; var currentLoader:SWFLoader; var swfs:LoaderMax = new LoaderMax({onComplete:completeHandler,onProgress:progressHandler,onChildComplete:childCompleteHandler}); swfs.append(new SWFLoader("part1.swf", {container:this.stage, autoPlay:false})); swfs.append(new SWFLoader("part2.swf", {container:this.stage, autoPlay:false})); swfs.append(new SWFLoader("part3.swf", {container:this.stage, autoPlay:false})); swfs.append(new SWFLoader("part4.swf", {container:this.stage, autoPlay:false})); function progressHandler(e:LoaderEvent):void { progress_mc.scaleX = e.target.progress; } function childCompleteHandler(e:LoaderEvent):void { trace(e.target + " loaded"); e.target.content.visible = false; } function completeHandler(e:LoaderEvent):void { trace("all swfs loaded"); progress_mc.visible = false; initCurrentLoader(); addEventListener(Event.ENTER_FRAME, trackSWFPlayback); } function initCurrentLoader() { loaderIndex++; trace(loaderIndex); reza = loaderIndex trace(reza); mySO.data.my_vis = loaderIndex; mySO.flush (); if (loaderIndex == swfs.numChildren) { //reset back to 0 if the last swf has already played //loaderIndex = 0; //can't show stuff that was unloaded so lets stop mySO.clear(); loaderIndex = -1 swfs.load(); trace("all done everyone gone"); removeEventListener(Event.ENTER_FRAME, trackSWFPlayback); } else { //dynamically reference current loader based on value of loaderIndex currentLoader = swfs.getChildAt(loaderIndex); //make the content of the current loader visible currentLoader.content.visible = true; //fade it in TweenLite.from(currentLoader.content, 0.1, {alpha:1}); //tell the current loader's swf to to play currentLoader.rawContent.gotoAndPlay(1); } } function trackSWFPlayback(e:Event):void { //trace(currentLoader.rawContent.currentFrame); //detect if the loaded swf is on the last frame if (currentLoader.rawContent.currentFrame == currentLoader.rawContent.totalFrames) { trace("swf done"); //hide and stop current swf currentLoader.content.visible = false; currentLoader.rawContent.stop(); //unload the swf that just played currentLoader.unload(); //set up and play the next swf initCurrentLoader(); } } this.addEventListener(Event.ENTER_FRAME, loadSWFs) function loadSWFs(e:Event):void{ load_btn.visible = false; swfs.load(); this.removeEventListener(Event.ENTER_FRAME, loadSWFs) } /* Click to Hide an Object Clicking on the specified symbol instance hides it. Instructions: 1. Use this code for objects that are currently visible. */
-
I have a website in which I'm trying to load the TweenMax tag; https://cdnjs.cloudflare.com/ajax/libs/gsap/1.20.2/TweenMax.min.js Everytime I try to do it, I get this: TweenMax.min.js:16 Uncaught TypeError: Cannot read property 'greensock' of undefined at Function.<anonymous> (TweenMax.min.js:16) at check (jquery.themepunch.tools.min.js?rev=4.6.0&ver=4.8.2:59) at new c (jquery.themepunch.tools.min.js?rev=4.6.0&ver=4.8.2:59) at t._gsDefine (jquery.themepunch.tools.min.js?rev=4.6.0&ver=4.8.2:59) at TweenMax.min.js:16 at TweenMax.min.js:16 But, when I load the TweenLite tag (https://cdnjs.cloudflare.com/ajax/libs/gsap/1.20.2/TweenLite.min.js) before hand, the TweenMax tag loads just fine. The website I'm trying to add this to is: http://www.pergunteaumamulher.com/ (it's in Brazilian portuguese). You can try to add the tag in the console to see the behavior I'm pointing out. Have you ever seen something like this? I believe it might be the same problem we have seen in here: Has it ever being addressed?
-
I am using Wordpress and am loading TweenMax via the functions.php file like this: add_action('wp_enqueue_scripts', 'child_scripts'); function child_scripts() { wp_enqueue_script('gsap', 'https://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/TweenMax.min.js'); wp_enqueue_script('main-js', get_stylesheet_directory_uri() . 'main.js', array('gsap'), false, true); } Both <script> tags are showing up fine and in the correct order in the page source code after load and there are no loading errors for either resource. I am trying to use TweenMax with the typical TweenMax.to() statement in the above referenced main.js file, but I am getting the "TweenMax is not defined" error that usually indicates that I forgot to include the library. It happens even after all plugins are deactivated and when using the 2016 theme. I have used TweenMax many times before and have never run into this issue.
-
Hi, I've just created a preloader with a handful of options(ease and other config options) to play. Just wanted to share this here. Play with it!! Thank you Cheers, Sven.
-
Hello Greensock Team, I've a conflict with a customer script and the greensock lib. This conflict has something to do with the "Back" function. If I rename this function to "Back2" I don't get an error. I made a codepen to demonstrate it. http://codepen.io/kostjanix/pen/rVmpzK/ Regards, Sami
-
I have been trying to load images using loadermax. I have been using the ImageLoader and XMLloaders. I have read all the as documentation and have follow the examples, when I run the application I get the error: (XMLLoader Error 2032: stream error. I have check the file path and the AS setting to see if there were any issues, after reviewing they all seem to be correct. Why would I be getting this error. XML_Image_load.txt
-
Hi - I'm wondering if anyone has loaded an ATF Texture with LoaderMax, and if so how. I assume we should be using DataLoader, but when I tried this the content would not cast as a ByteArray. Any advice would be appreciated.
-
Hi Carl Another problem made me come back to you. My External loader is ready now and working quiet well (Thanks ). Here I am Loading an external SWF file using the SWFLoader Class. Here is the way i do: currentLoader = new SWFLoader(url,{container:videoContainer_mc,width:720,height:406,centerRegistration:true,autoPlay:false,onProgress:progressHandler,onComplete:completeHandler}); currentLoader.load(); Im trying to make the whole content FullScreen. On the other hand, i tend to design another button for making the external loaded Content FullScreen. How Can i do this separately for the main Stage and external Loaded content? Regards
-
- swfloader
- fullscreen
-
(and 2 more)
Tagged with:
-
Hi - I have an app working in flash but when I deploy to a device only the first swf loads then unloads and nothing else happens. I'm not sure how to debug what is happening on the device. I am loading several swfs using loadermax - some of the code is below and I will note where it stops working: Grateful for any advice, am currently thinking of starting again without using GS code to see if I'm doing something wrong in there. Thanks. private var swfs:LoaderMax = new LoaderMax({onComplete:completeHandler,onProgress:progressHandler,onChildComplete:childCompleteHandler}); private function buttonListeners():void { homePage_mc.start_btn.addEventListener(MouseEvent.CLICK, loadswfs); } //LOAD MOVIES; private function loadswfs(event:MouseEvent):void { swfs.append(new SWFLoader("Movie1.swf",{container:this,autoPlay:false,width:480,height:480,x:300,scaleMode:"proportionalInside"})); swfs.append(new SWFLoader("Movie2.swf",{container:this,autoPlay:false,width:480,height:480,x:300,scaleMode:"proportionalInside"})); // there are 8 more swfs loaded this way swfs.load(true); loadMovie1(); homePage_mc.start_btn.removeEventListener(MouseEvent.CLICK, loadswfs); } private function loadMovie1():void { swfName = "1"; trace("Movie1"); currentSWFLoader = LoaderMax.getLoader("Movie1.swf"); } private function loadMovie2():void { swfName = "2"; currentSWFLoader = LoaderMax.getLoader("Movie2.swf"); trace(currentSWFLoader.content); initCurrentSWFLoader(); // this swf doesn't start playing on device - it does in Flash } //SWF LOADER EVENTS; function progressHandler(event:LoaderEvent):void { progress_mc.scaleX = event.target.progress; trace("progress: " + event.target.progress); } function childCompleteHandler(e:LoaderEvent):void { trace(e.target + " loaded"); e.target.content.visible = false } function completeHandler(e:LoaderEvent):void { trace("all loaded"); progress_mc.visible = false; initCurrentSWFLoader(); } function initCurrentSWFLoader() { currentSWFLoader.content.visible = true; currentSWFLoader.rawContent.gotoAndPlay(1); trace(currentSWFLoader.rawContent.name + "playing"); addEventListener(Event.ENTER_FRAME, trackSWFPlayback); } function trackSWFPlayback(e:Event):void { if (currentSWFLoader.rawContent.currentFrame == currentSWFLoader.rawContent.totalFrames) { removeEventListener(Event.ENTER_FRAME, trackSWFPlayback); switch (swfName) { case "1" : currentSWFLoader.content.visible = false; currentSWFLoader.rawContent.stop(); loadMovie2(); break; case "2" : currentSWFLoader.content.visible = false; currentSWFLoader.rawContent.stop(); loadMovie3(); break; } } }
- 2 replies
-
- debugging devices
- loading
-
(and 2 more)
Tagged with:
-
Hi, I'm having trouble with the initial loading of my swf file. - it is visible and audible before it's fully loaded so it shows on stage as though it's paused but the sound is playing. The progress bar is visible on top of the loading swf. How do I make it visible and audible only once it's fully loaded? If I put the following code: event.target.content.visible = false; SoundMixer.soundTransform = new SoundTransform(0); in the progressHandler event the sound and image is hidden but I'm not sure where to restart it once progress equals 1. If I restart it in completeHandler it does exactly what I've mentioned above. Here is my code: Thanks. public class main extends MovieClip { private var currentSWFLoader:SWFLoader; private var swf1:SWFLoader = new SWFLoader("movie1.swf",{container:this,autoPlay:false, width:480,height:480,x:300,scaleMode:"proportionalInside", onComplete:completeHandler,onProgress:progressHandler, onChildComplete:childCompleteHandler}); public function CyberWalkColourSound() { progress_mc.scaleX = 0; } //LOAD MOVIE ONE; private function loadmovie1(event:MouseEvent):void { currentSWFLoader = swf1; currentSWFLoader.load(true); } function progressHandler(event:LoaderEvent):void { progress_mc.scaleX = event.target.progress; trace("progress: " + event.target.progress); progress_mc.visible = true; setChildIndex(progress_mc, numChildren - 1); } function childCompleteHandler(e:LoaderEvent):void { trace(e.target + " loaded"); } function completeHandler(e:LoaderEvent):void { progress_mc.visible = false; currentSWFLoader.rawContent.play(); trace(currentSWFLoader.rawContent + "playing"); }
- 2 replies
-
- progress bar
- swf
-
(and 2 more)
Tagged with:
-
http://dev.option5.net/CNCT/CNCT13004/video.html I've built a custom video player built on the use of VideoLoader. However, the loader progress isn't working. It appears to be working; the loader bar grows in width based on a LoaderEvent.PROGRESS dispatch. But when I test the actual network usage in Chrome (dev tools), it shows the video is loading long after the loader bar goes to 100%. Any ideas?
- 3 replies
-
- video
- videoloader
-
(and 2 more)
Tagged with:
-
Hi - I'm new to using greensock (and actionscript) and am trying to play around with some code I found. It originally loaded several swf files and looped through them continuously - I'm trying to randomize it. I have created an array and added code to shuffle through the array, but I'm stuck trying to integrate it into the looping files. I'm pretty sure I have to do something with the loaderIndex, but I'm not sure what. Any help would be great - thanks. Code: progress_mc.scaleX = 0; var loaderIndex:Number = -1; var currentLoader:SWFLoader; var urls:Array = ["SWF0.swf","SWF1.swf","SWF2.swf"]; var swfs:LoaderMax = new LoaderMax({onComplete:completeHandler,onProgress:progressHandler,onChildComplete:childCompleteHandler}); // Loop through urls and create a queue of swf loaders for (var i:Number = 0; i < urls.length; i++) { swfs.append( new SWFLoader(urls, {container:container_mc, autoPlay:false}) ); } urls.sort(randomSort); function randomSort(a:*, b:*):Number { if (Math.random() < 0.5) { return -1; } else { return 1; } } function progressHandler(e:LoaderEvent):void { progress_mc.scaleX = e.target.progress; } function childCompleteHandler(e:LoaderEvent):void { trace(e.target + " loaded"); e.target.content.visible = false; } function completeHandler(e:LoaderEvent):void { trace("all swfs loaded"); progress_mc.visible = false; initCurrentLoader(); addEventListener(Event.ENTER_FRAME, trackSWFPlayback); } function initCurrentLoader() { loaderIndex++; if (loaderIndex == swfs.numChildren) { //reset back to 0 if the last swf has already played loaderIndex = 0; } //dynamically reference current loader based on value of loaderIndex currentLoader = swfs.getChildAt(loaderIndex); //make the content of the current loader visible currentLoader.content.visible = true; //tell the current loader's swf to to play currentLoader.rawContent.gotoAndPlay(1); } function trackSWFPlayback(e:Event):void { //trace(currentLoader.rawContent.currentFrame); //detect if the loaded swf is on the last frame if (currentLoader.rawContent.currentFrame == currentLoader.rawContent.totalFrames) { trace("swf done"); //hide and stop current swf currentLoader.content.visible = false; currentLoader.rawContent.stop(); //set up and play the next swf; initCurrentLoader(); } } load_btn.addEventListener(MouseEvent.CLICK, loadSWFs); function loadSWFs(e:MouseEvent):void { load_btn.visible = false; swfs.load(); }
-
Hi, Is there a way to grab the response headers from the LoaderEvent? Thanks, Lewis
-
Greetings! I am using the following code to load an external SWF into my main movie with LoaderMax: import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import com.greensock.loading.display.ContentDisplay; progressBar.scaleX = 0; var powerpointmovie:SWFLoader = new SWFLoader("powerpoint.swf", {container:this, alpha:0, onprogress:progressHandler, onComplete:completeHandler});function progressHandler(event:LoaderEvent):void { progressBar.scaleX = powerpointmovie.progress; } function completeHandler(event:LoaderEvent):void { trace(event.target.content); var powerpointmovie:ContentDisplay = event.target.content; TweenLite.to(powerpointmovie, 0, {alpha:1}); TweenLite.to(progressBar, 0, {alpha:0}); TweenLite.to(incubateblinker, 0, {alpha:0}); TweenLite.to(progressbartitle, 0, {alpha:0}); TweenLite.to(progessbarcasing, 0, {alpha:0}); TweenLite.to(spawnprogresstitle, 0, {alpha:0}); } powerpointmovie.load(); The loader bar functions as it should, and the SWF comes up in the main movie as expected with all of its functionality intact. However, the loaded SWF does not play from frame 1. Instead, it appears that upon completion, the loaded movie "skips" to the last frame. To this end, the loaded SWF appears rather "abruptly" without any of the tweens and other animations contained in all of the prior frames. Hopefully, I have described my problem clearly. It is probably a very small issue, but one that is quite confounding (at least to me anyways!). Thanks in advance for any assistance you might afford me in this matter.
-
I copied code from the example page but when i compile the code i got this message: Type was not found or was not a compile-time constant: LoaderEvent. LoaderEvent etc. is all recognized in code. Anyone has a suggestion what might cause this error? Thanks.
-
Hello, I have strange problem loading swf file, in the preloading event most of the time the preloading progress value isvery small and then after 2/3 of loading progres speed up. On the server when I multiply the number with 100 and rount the walue I got 0% all the time and then it jumps to the 100%. private function onLoadingProgress(event:LoaderEvent) { percent_num = Math.round((event.target.bytesLoaded/event.target.bytesTotal) * 100); parent_class.mainPreload.progressData(percent_num); }
-
So, I'm creating an Image Gallery. Clicking on buttons calls the "change_section" function, passing it the hires image id. I want to fade out the current image, load the new image, than fade it on the screen. But, for some reason when it losing track of the "this.hires" array that contains the image url, width, height and id. I think it's calling an undefined "Gallery" javascript object. Any insight would be appreciated. Gallery.prototype.change_section = function(_id) { this.new_section = _id; //// Started with TweenMax.to(this, .5, {hires_alpha:0, overwrite:2, onUpdate:reDrawMain, onComplete:this.check_hires}); ///I've tried this var obj = this; TweenMax.to(obj, .5, {hires_alpha:0, overwrite:2, onUpdate:reDrawMain, onComplete:obj.check_hires}); /// Calling just this works, and still sees the "this.hires" array in the Gallery object. So, I don't think it's my logic, but rather I'm not referencing the right javascript object with the onComplete call. this.check_hires(); }; Gallery.prototype.check_hires = function() { var i; for (i=0;i<this.hires.length;i++) { if(this.hires[i].id == this.new_section) { if(!this.hires[i].loaded && !this.hires[i].loading) { this.load_hires(); } else { this.active_section = this.new_section; this.open_hires(); } } } }; The code below is for reference. Maybe I have conflicting calls to TweenMax or something. Gallery.prototype.open_hires = function() { TweenLite.to(this, .5, {delay:.5, hires_alpha:1, overwrite:2, onUpdate:reDrawMain}); }; Gallery.prototype.load_hires = function() { trace("Gallery load_img") var obj = this; var i; var s; for (i=0;i<this.hires.length;i++) { if(this.hires[i].id == this.new_section) { var hires_img = new Image(); this.hires[i].obj = hires_img; hires_img.id = this.hires[i].id; hires_img.onload = function () { obj.hires_loaded(this.id); } this.hires[i].loading = true; hires_img.src = this.hires[i].img; } } }; Gallery.prototype.hires_loaded = function(_id) { var i; for (i=0;i<this.hires.length;i++) { if(this.hires[i].id == _id) { this.hires[i].loaded = true; this.active_section = _id; this.open_hires(); } } };
- 3 replies
-
- onComplete
- javascript
-
(and 3 more)
Tagged with:
-
I'm having an issue loading loaders that have been loaded, then disposed of. Let me explain that (it gives me a headache trying to parse it). I have an array of loaders, some VideoLoaders, some ImageLoaders. I'm trying to make something where you can swipe through multiple objects, but rolled my own garbage collection so only three objects (previous, current, and next) are currently loaded into memory, as these files can get fairly large. I append a loader to my LoaderMax instance, then call the load() method. As I move forward through my array, I append the prev, current, and next loader based on my currentSlideIndex. I move forward two objects, then call loaderArray[currentSlideIndex-2].dispose(true) to unload the content of that particular loader. If I move backwards through the array, eventually, the first loader I appended will get appended to my LoaderMax instance a second time. LoaderMax doesn't seem to throw an error (although I don't believe I'm listening for one) and completes it's loading. When I try to access the content property, it is null. Any ideas how to load this content a second time or to change up my garbage collection? Here is some code to help explain it: var currentSlide:Sprite = new Sprite(); var previousSlide:Sprite = new Sprite(); var nextSlide:Sprite = new Sprite(); var currentSlideIndex:int = 0; var loaderArray:Array = new Array(); var presentationLoader:LoaderMax = new LoaderMax({onComplete:doneWithCurrentLoad}); loaderArray.push(new ImageLoader(url1, {name:"slide1", width:1920, height:1080})); loaderArray.push(new VideoLoader(url2, {name:"slide2", width:1920, height:1080, autoPlay:false})); loaderArray.push(new VideoLoader(url3, {name:"slide3", width:1920, height:1080, autoPlay:false})); loaderArray.push(new VideoLoader(url4, {name:"slide4", width:1920, height:1080, autoPlay:false})); loaderArray.push(new VideoLoader(url5, {name:"slide5", width:1920, height:1080, autoPlay:false})); loaderArray.push(new VideoLoader(url6, {name:"slide6", width:1920, height:1080, autoPlay:false})); presentationLoader.append(loaderArray[0]); presentationLoader.append(loaderArray[1]); presentationLoader.load(); function goForward():void { if(currentSlideIndex<loaderArray.length - 1) { currentSlideIndex++; //This is where problems happen the second time revisiting the content. thisSlide = loaderArray[currentSlideIndex].content; nextSlide.addChild(thisSlide); //Imagine transition code here rearangeSlides(1); } } function goBackward():void { if(currentSlideIndex>0) { currentSlideIndex--; thisSlide = loaderArray[currentSlideIndex].content; previousSlide.addChild(thisSlide); //Imagine transition code here rearangeSlides(-1); } } function rearangeSlides(param1:Number):void { var tempContent:ContentDisplay; if (param1 > 0) { //Going forward tempContent = ContentDisplay(nextSlide.getChildAt(0)); //Remove content two back, we want the immediately previous loader to keep content ready if (loaderArray[currentSlideIndex - 2] is VideoLoader) VideoLoader(loaderArray[currentSlideIndex - 2]).dispose(true); trace(loaderArray); if (currentSlide.numChildren > 0) currentSlide.removeChildAt(0); currentSlide.addChild(tempContent); currentSlide.x = 0; nextSlide.x = 1920; } else if (param1 < 0) { //Going backwards tempContent = ContentDisplay(previousSlide.getChildAt(0)); //Remove content two forward, we want the immediately next loader to keep content ready if (loaderArray[currentSlideIndex + 2] is VideoLoader) VideoLoader(loaderArray[currentSlideIndex + 2]).dispose(true); currentSlide.removeChildAt(0); currentSlide.addChild(previousSlide.getChildAt(0)); currentSlide.x = 0; previousSlide.x = -1920; } }
- 1 reply
-
- loading
- garbage collection
-
(and 2 more)
Tagged with:
-
I've come across and issue which I have found a work around. I am loading and playing external FLVs from a different server from where my SWF is located. When published locally and pulling in the FLVs, everything worked fine. When placing the SWF online, it wouldn't load the FLVs. After a day of troubleshooting and using crossdomain policies, I've narrowed it down to the loading procedure used. My findings are below. Please feel free to comment or let me know if I missed something that would have prevented me from wasting a day. I have done the following: 1. added crossdomain.xml to the site where the FLVs reside 2. added import flash.system.Security; Security.loadPolicyFile("http://www.mywebsite.com/crossdomain.xml"); <br><br> to my FLA The above files/code didn't have an impact on anything after my testing. I was loading the videos through the following code: var numVids = this.model.xml.q.opt.length(); for (var k:Number = 1; k <= numVids; k++) { var videoSrc:String = vidPath + this.model.xml.q.opt[(k - 1)].source; urls.push(videoSrc); var videoSrcFB:String = vidPath + this.model.xml.q.opt[(k - 1)].fb.source; urls.push(videoSrcFB); } //trace ("urls = " + urls); var queue:LoaderMax = LoaderMax.parse(urls, { onProgress:_progressHandler, onComplete:_queueComplete, onChildComplete:_childComplete }, { width:873.6, height:479, autoPlay:false } ); queue.load(); The above code worked fine when publishing the SWF and testing locally but wouldn't load the FLVs once I placed it online. My workaround: var numVids = this.model.xml.q.opt.length(); for (var k:Number = 1; k <= numVids; k++) { var videoSrc:String = vidPath + this.model.xml.q.opt[(k - 1)].source; urls.push(videoSrc); var videoSrcFB:String = vidPath + this.model.xml.q.opt[(k - 1)].fb.source; urls.push(videoSrcFB); } //trace ("urls = " + urls); var queue:LoaderMax = LoaderMax.parse(urls, { onProgress:_progressHandler, onComplete:_queueComplete, onChildComplete:_childComplete }, { width:873.6, height:479, autoPlay:false } ); for (var m:Number = 1; m <= urls.length; m++) { //append several loaders var load = urls[(m - 1)]; var video:VideoLoader = new VideoLoader(load, { onComplete:_queueComplete, width:873.6, height:479, autoPlay:false } ); //<--THIS IS THE CODE THAT WORKED video.load(); } I would much rather keep the LoaderMax.parse function to keep the code nice and clean but doesn't seem to do the trick when trying to play FLVs from diff server. Has anyone run into similar issues?
-
Hello and thank you so much for the most useful AS3 Library I've ever used! I'm currently using a VideoLoader to playback external MP4 on a client website. I've set bufferMode=true and all goes well on short videos. However, on larger videos (about 100MB) when I try to seek the video immediately after the first bufferFull event: - bufferEmpty is displached properly - I display a 0% buffer progress info and wait for buffer progress - It stays at 0% for about 20 seconds! -> My problem - It then starts to show progress and quickly gets to 100% - bufferFull is dispached, all is good. I can't quite explain to my client why does this happen on our website and it doesn't happen on youtube. On youtube it starts re-buffering immediately after seeking to a further frame I'll post the essential parts of my code and I hope you can give me some insight on this subject, thank you very much in advance. Here is how initialize the loader: // Estimated Bytes are provided on each video video = new VideoLoader(url, {container:this, x:bkg.x, y:bkg.y, width:bkg.width, height:bkg.height, scaleMode:"proportionalInside", bgColor:0x000000, autoPlay:false, volume:1, auditSize:false, estimatedBytes:this.estimatedBytes, bufferMode:true, onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler}); video.load(); video.gotoVideoTime(0); video.addEventListener(VideoLoader.PLAY_PROGRESS, updatePlayProgress); video.addEventListener(VideoLoader.VIDEO_COMPLETE, videoComplete); video.addEventListener(VideoLoader.VIDEO_BUFFER_EMPTY, bufferEmptyHandler); video.addEventListener(VideoLoader.VIDEO_BUFFER_FULL, bufferFullHandler); video.content.addEventListener(MouseEvent.DOUBLE_CLICK, toogleFullScreenMode); Here are the listener functions: public function progressHandler(event:LoaderEvent):void { trace("progressHandler",(Math.round(event.target.progress*100))+"%"); // custom code to display progress text } public function completeHandler(event:LoaderEvent):void { // custom code to hide buffer progress text } public function errorHandler(event:LoaderEvent):void { trace("error occured with " + event.target + ": " + event.text); } public function bufferEmptyHandler(evt:LoaderEvent):void { // custom code to show buffer progress text, starting with "0%" addEventListener(Event.ENTER_FRAME, reportBufferProgress); } public function bufferFullHandler(evt:LoaderEvent):void { trace("bufferFullHandler"); removeEventListener(Event.ENTER_FRAME, reportBufferProgress); completeHandler(null); } public function reportBufferProgress(evt:Event):void { // ISSUE: it stays at 0% for about 20 seconds on large movies and then evolves super fast to 100% trace("buffer progress:",video.bufferProgress); } public function updatePlayProgress(evt:LoaderEvent=null) { // custom code to show play progress bar } public function videoComplete(evt:LoaderEvent=null) { // custom code for when the video is done playing }
- 2 replies
-
- VideoLoader
- BufferMode
-
(and 3 more)
Tagged with: