Jump to content

Search the Community

Showing results for tags 'loadermax'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • GreenSock Forums
    • GSAP
    • Banner Animation
    • Jobs & Freelance
  • Flash / ActionScript Archive
    • GSAP (Flash)
    • Loading (Flash)
    • TransformManager (Flash)

Product Groups

  • Club GreenSock
  • TransformManager
  • Supercharge


  • Learning Center
  • Blog


  • Products
  • Plugins


  • Examples
  • Showcase


  • FAQ


  • ScrollTrigger Demos


There are no results to display.

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Personal Website



Company Website



  1. Hi guys, I wonder if you can assist, I'm trying to code for the eventuality of a corrupt image getting loaded. I currently have the error event setup to remove the offending item: function errorHandler(event:LoaderEvent):void { trace("error occurred with event target:: " + event.target + "::and event text:: " + event.text); queue.remove(event.target as LoaderCore); } However it only appears to be removing the last child of the set of images, rather than just the event.target. I've ran traces and event.target is pointing at the correct 'corrupt' image which fails to load as expected. The queue.remove is removing an item as a queue.numChildren trace reduces by one. What am I missing? Thanks, NB let me know if you want more info.
  2. var queue:LoaderMax = new LoaderMax({maxConnections:1, onProgress:queueProgressHandler, onComplete:queueCompleteHandler, onChildProgress:childProgressHandler, onChildComplete:childCompleteHandler }); queue.append(new SWFLoader(_urlLoad + "assets.swf", { name: _AssetFileName, visible : false, autoPlay : false, container : ASMain.main_mc, estimatedBytes : 838 } )); queue.append(new SWFLoader(_urlLoad + "Lock.swf", { name: _LockFileName, visible : false, autoPlay : false, container : ASMain.main_mc, estimatedBytes : 1000 } )); //LoaderMax.prioritize(_LockFileName); queue.load(); current frame of main_mc is 2, that seem work fine but when i goto main_mc to frame 3 and then back frame 2 the first child is a movie of main_mc is null. please help me, thank you
  3. HI! So I'm not a fantastic flash coder.. but I'm in the middle of a project that I need a little help on. I have some code, which works very well, with one thing that I cannot figure out how to change. I'd like to be able to put other art on top of the loaded SWF.. but it only loads in the topmost "z" index, and even if I put another layer over the top with art to overlay, it just loads over it.. var queueb1:LoaderMax = new LoaderMax({onProgress:progressHandlerb1, onComplete:completeHandlerb1, onError:errorHandlerb1}); queueb1.append( new SWFLoader("whitley.swf", {name:"whitleySWF", estimatedBytes:3000, container:this, autoPlay:false}) ); queueb1.load(); function progressHandlerb1(event:LoaderEvent):void { trace("progress: " + event.target.progress); } function completeHandlerb1(event:LoaderEvent):void { var image:ContentDisplay = LoaderMax.getContent("whitleySWF"); image.x=0; image.y = -65; trace(event.target + " is complete!"); } function errorHandlerb1(event:LoaderEvent):void { trace("error occured with " + event.target + ": " + event.text); } Can you tell me what I need to do to this code so it loads on a specific layer? I also have a symbol that I've been using as a mask, it'd be perfect if I could load it into it.
  4. 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; } } }
  5. I've been using XMLLoader to write XML files via a php script: private static function sendXML($xml:XML):void { // declaring var xmlcontents String. You should set this first. var xmlcontents:String = $xml.toString(); // declaring var SERVER_PATH String. This is the path for the saving-xml.php. var SERVER_PATH:String = TTConstants.SERVER_PATH + "/php/"; // declaring var foldername String. This is the folder container of the saved XML file var foldername:String = "../xml"; // declaring var dataPass URLVariables var dataPass:URLVariables = new URLVariables(); var previewRequest:URLRequest = new URLRequest(TTConstants.SERVER_PATH + "/php/ttwrite.php"); previewRequest.method = URLRequestMethod.POST; // setting dataPass variables to be passed to PHP dataPass.filename = USER_XML_FILENAME; dataPass.xmlcontents = xmlcontents; dataPass.foldername = foldername; // passing dataPass data PHP previewRequest.data = dataPass; var loader:XMLLoader = new XMLLoader(previewRequest, {onComplete:serverSendComplete,onIOError:onIOError,onSecurityError:onSecError,onError:onError}); // calling the PHP or loading the PHP loader.load(); } I want to call a PHP script to simply delete ("unlink") an xml file on the server. Can I use XMLLoader to do this as well (for ease of complete and error functions -- callbacks instead of adding/removing event listeners)? There's no XML loading involved, so I don't know if it's 'kosher' - var deleteRequest:URLRequest = new URLRequest("http://localhost/tt/php/ttdelete.php"); deleteRequest.method = URLRequestMethod.POST; var loader:XMLLoader = new XMLLoader(deleteRequest, {onComplete:serverDeleteComplete,onIOError:onIOError,onSecurityError:onSecError,onError:onError}); // calling the PHP or loading the PHP loader.load();
  6. I have created an application that passes a url that may be a swf, image or flv. The content will be loaded into the same container. I'm able to load the respective formats, but it creates a new Loader each time. Is there a way to create one Loader for each format and update the container with its respective formats while removing the previously loaded content? For example: I load a jpg into "mc_container" then remove that jpg and load a swf into "mc_container" What I tried doesn't work: public function DisplayVisual() { LoaderMax.activate([ImageLoader, SWFLoader, VideoLoader]); } function loadVisual(visualUrl:String):void { var visualLoader:LoaderCore = LoaderMax.parse(visualUrl, {name:"parsedLoader", container:mc_container}); visualLoader.load(); }
  7. Hello, do someone know how to edit code below to LoaderMax? All help will be very appreciated. Thanks so much in advance. var menubarLoader:Loader = new Loader(); var menubarReq:URLRequest = new URLRequest("../swf/menubar.swf"); var menuMc:MovieClip; menubarLoader.load(menubarReq); menubarLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler); function completeHandler(e:Event):void { menuMc = MovieClip(menubarLoader.content); menuMc.contacts_btn.name_txt.text = "Contacts"; }
  8. I have a function set up to play a loaded MP3 by name string: protected function playSoundByName($name:String):void { // trace("play sound by name ", $name, LoaderMax); _currentSound = LoaderMax.getContent($name); // trace("current sound is ",_currentSound); if (_currentSoundChannel) _currentSoundChannel.stop(); // trace("the sound is ", _currentSound,_currentSound.length,_currentSound.url); _currentSoundChannel = _currentSound.play(0); _currentSound.addEventListener(Event.SOUND_COMPLETE,soundComplete,false,0,true); } Which works fine when I call it directly, but not when I call it from a callback in a TimelineMax (see below -- the first call works fine, the one from inside the TLM does not). I'm sure I'm missing the obvious, but it's a big problem…Thanks… var introSoundsTL:TimelineMax = new TimelineMax({ease:Linear.easeNone}); playSoundByName("jsTexasSurf"); // works! introSoundsTL.addCallback(playSoundByName,0,["jsTexasSurf"]); // the sound from LoaderMax.getContent() in called function is null! (The loaded xml is in this form: <?xml version="1.0"?> <content> <timelimit limit="45" /> <MP3Loader url="music/jetski/321go.mp3" name="js321Go" autoPlay="false" load="true" /> <MP3Loader url="music/jetski/pg3-300beachs.mp3" name="js300beaches" autoPlay="false" load="true" /> <MP3Loader url="music/jetski/pg5-texassurf.mp3" name="jsTexasSurf" autoPlay="false" load="true" /> </content> )
  9. If you have more than one loaded asset with the same name, how does LoaderMax.getContent() resolve that? I have a lot of assets to load -- maybe 70 mp3s, and while I can make sure no names ever duplicate, I'm wondering whether it's not easier to use the instance version of LoaderMax's getContent, rather than the static. What is the best practice? Thanks!
  10. I am trying to upload some graphic assets using XMLLoader and have noticed an unusual behavior concerning the estimatedBytes property. The XML file xml/assets2.xml does contain the estimatedBytes declared for all the xml childs and xml/assets.xml does not. Everything works fine if estimatedBytes is explicit declared, but if I omit it, the preloader bar jumps ahead. Shouldn't work just fine for both cases? Am I doing something wrong? I have uploaded the files so you can take a look. Desktop.zip Edit: I am testing with Flash CS6(simulate download)
  11. Hi, I have found the following code to loop through an array of swf's - which works really smoothly (thanks). I would like to re-use this code to load other arrays of swf's. Could I make a separate class so I could re-use the code in a more streamlined way rather than pasting it over and over (any advice how to do this would be great)? Also how can I center the x and y co-ordinates of the loader? Thanks! import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import flash.display.MovieClip; import flash.events.Event; import flash.events.MouseEvent; private var loaderIndex:Number = -1; private var currentLoader:SWFLoader; private var urls:Array = ["movie0.swf","movie1.swf","movie2.swf",]; private var swfs:LoaderMax = new LoaderMax({onComplete:completeHandler,onChildComplete:childCompleteHandler}); private function startMovieOne(event:MouseEvent):void { homePage_mc.visible = false; // 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:movieTwo_mc, autoPlay:false, width:480, height:480, scaleMode:"proportionalInside"}) ); } swfs.load(); btnListener(); } function childCompleteHandler(e:LoaderEvent):void { trace(e.target + " loaded"); e.target.content.visible = false; } function completeHandler(e:LoaderEvent):void { trace("all swfs loaded"); 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(); } } private function btnListener():void { home_btn.addEventListener(MouseEvent.CLICK,resetScreens); } public function resetScreens(event:MouseEvent):void { //unload content currentLoader.content.visible = false; currentLoader.rawContent.stop(); trace("unloaded"); homePage_mc.visible = true; }
  12. Hi all, How to load a profile image from facebook with url like this: https://graph.facebook.com/100005284152430/picture I try to use LoaderMax.parse("https://graph.facebook.com/100005284152430/picture") but it's thrown an error Thank you.
  13. I'm bulk loading videos and then playing them. That part works. But after a video has been played once it will play back very fast almost every time after that. I have no idea why. Any help appreciated. package { public class VideoClass extends MovieClip { private var vid1_vid:ContentDisplay; private var vid1_ldr:VideoLoader; private var vid2_vid:ContentDisplay; private var vid2_ldr:VideoLoader; private var vid3_vid:ContentDisplay; private var vid3_ldr:VideoLoader; //store video paths private var vid1_BT:String; private var vid2_BT:String; private var vid3_BT:String; private var videoArray:Array = new Array(); public function VideoClass(_videoArray:Array) { videoArray = _videoArray; for (var i:uint = 0; i < 7; i++) { if (i == 0) { vid1_BT = videoArray[i]; } else if (i == 1) { vid2_BT = videoArray[i]; } else { vid3_BT = videoArray[i]; } } //activate the loaders we need LoaderMax.activate([ImageLoader, SWFLoader, VideoLoader]); var urls:Array = [vid1_BT, vid2_BT, vid3_BT]; var queue:LoaderMax = LoaderMax.parse(urls, {maxConnections:1, //onProgress:_progressHandler, onComplete:_queueCompleteHandler //onChildComplete:_childCompleteHandler }, {autoPlay:false}); queue.load(); } private function _queueCompleteHandler(event:LoaderEvent):void { //vid1 video vid1_ldr = LoaderMax.getLoader(vid1_BT); vid1_vid = LoaderMax.getContent(vid1_BT); vid1_vid.x = vid1_vid.y = 0; //vid2 video vid2_ldr = LoaderMax.getLoader(vid2_BT); vid2_vid = LoaderMax.getContent(vid2_BT); vid2_vid.x = vid2_vid.y = 0; //vid3 video vid3_ldr = LoaderMax.getLoader(vid3_BT); vid3_vid = LoaderMax.getContent(vid3_BT); vid3_vid.x = vid3_vid.y = 0; vid1_ldr.addEventListener(VideoLoader.VIDEO_COMPLETE, onVideoComplete, false, 0, true); vid2_ldr.addEventListener(VideoLoader.VIDEO_COMPLETE, onVideoComplete, false, 0, true); vid3_ldr.addEventListener(VideoLoader.VIDEO_COMPLETE, onVideoComplete, false, 0, true); } public function addVideo(_vid:String) { switch (_vid){ case "vid1": addChild(vid1_vid); vid1_ldr.playVideo(); vid1_ldr.gotoVideoTime(0); break; case "vid2": addChild(vid2_vid); vid2_ldr.playVideo(); vid2_ldr.gotoVideoTime(0); break; case "vid3": addChild(vid3_vid); vid3_ldr.playVideo(); vid3_ldr.gotoVideoTime(0); break; } } private function onVideoComplete(e:*) { var vid = e.target.content; removeChild(vid); } } }
  14. I'd like to use LoaderMax to load an xml file that will contain references to other xml files, one of which will contain nodes representing imageloaders. I don't want to add these images to the display list immediately but instead have reference to them, perhaps in an array. What's the best way to grab references to these loaded images from layers down? Put a complete function on each image loaded? Is there a simpler way I imagine the pseudo-xml something like this: _myLoaderMax.load(mainXML, onComplete:getTheImages); function getTheImages():void { _myImageArray = getTheImagesFromLoaderSomehow(_myLoaderMax); } <mainxml> <xmlloader url='imagexml' load='true'/> </mainxml> <imagexml> <imageloader url='myimage1' load='true'/> <imageloader url='myimage2' load='true'/> </imagexml> Would it be using getContent() at the appropriate level -- i.e. pseudocode _myXMLLoader= _myLoaderMax.getLoader('myXML'); _myImageContent:Array = _myXMLLoader.getContent() On another related note — what's the best practice for making sure everything loaded via LoaderMax is garbage collected? That is, I can set the main LoaderMax to have autodispose='true', but will that also dispose of all sub-loaders? I realize that if I put listeners on any loaded assets, etc, that will affect garbage collection, but do the GS loaders hold on to loaded assets in any fashion? Is there anything I need to do to make sure GC works well? I see that there are references to unload() in LoaderCore, but how does one recursively unload everything? Thanks
  15. When I run my application from a cd/dvd, the progress bar doesn't work. Do I need to do something differently when running from a disk? loader = new SWFLoader(url, {name:"main", estimatedBytes:3000, container:this, autoPlay:false, onProgress:imageProgressHandler, onComplete:completeHandler}); loader.load(); function imageProgressHandler(event:LoaderEvent):void { TweenLite.to(mc_progress, .1, {alpha:1}); mc_progress.progressBar_mc.bar_mc.scaleX = event.target.progress; }
  16. Hi, Is there a way to grab the response headers from the LoaderEvent? Thanks, Lewis
  17. Hello, I know it's possible to have mixed xml (with loader's and also other content), but I'm having trouble working out how to access XML in LoaderMax before child loaders have finished. For example, here's a simple version of my xml: <?xml version="1.0" encoding="utf-8"?> <content> <preload> <LoaderMax name="..." prependURLs="assets/" load="true"> <MP3Loader name="..." url="..." autoPlay="false"/> <ImageLoader name="..." url="..."/> </LoaderMax> </preload> <fonts> <LoaderMax name="..." prependURLs="assets/" load="true"> <SWFLoader name="..." url="..."/> <SWFLoader name="..." url="..."/> </LoaderMax> </fonts> <main> <prompts>Some other content</prompts> ... </main> </content> All good so far. I get an onChildComplete event for each item loaded, plus one for each LoaderMax itself. Once everything is loaded, I get an onComplete event. But... I really need an event for the XML file itself. I can access it once everything else has loaded, but I really need to access it before the load has completed (I'm assuming it's the first thing loaded?). Is this possible? I really hope it is!
  18. I have an application that uses LoaderMax to load a swf (swf1) with audio. Basically each swf is a chapter in a multi-chapter presentation. When I advance to a chapter (swf2) then return to the previous chapter (swf1) the audio becomes distorted and begins to pop. Is it possible that the previous swf has not been trashed completely?
  19. Hello, I am working on a prototype in Flex using LoadMax to load an image into a loader FlexContentDisplay. The FlexContentDisplay is embed in a Canvas which is added to the TransformManager. I have to work on width, height, x and y of this image in the canvas. My question is : Is it better to work on the rawContent property of FlexContentDisplay or directly with the FlexContentDisplay ? I wonder this as the FlexContentDisplay extends UIComponent, I cannot really work on width and height but directly with scaleX and scaleY. Many thanks
  20. I have 2 child swfs being loaded into a parent swf. Each child swf loads its own XML file. When I load the child swfs, I get back a null because they have not loaded their XML files yet. I am using LoaderMax. Is there anyway for the parent to know when all the child XMLs have been loaded.
  21. I'm using loadermax to load a combination of flv's and f4vs. The flv's are used because they have an alpha channel. However, the alpha channels of the flv's are not working. Instead of seeing transparency, I get black. Is this because loadermax uses StageVideo? Or is there another reason? And more importantly, is there a workaround for this? I mean I suppose I could embed the flv's in swfs and load those, but I'm hoping for something more elegant. I love using loadermax to load this stuff. I hope there is a way I can make this work. Thanks in advance.
  22. Hi all! First off thanks for everything...! So... I have created a "Player" class which extends MovieClip and contains an array of F4V files being loaded via LoaderMax.parse ... In my Main Document Class (Main) I want to transform properties of the entire Player class (alpha, scale, etc.) however the F4V does not see the transformations....It seems I have to reference the content directly within the Main class. For example, if i simply try to set player.visible=false, after i've already added video content to the stage, It does not stick, but if I reference player.video.content.visible=false, it works... What I'm really trying to do is fade the player object out before I navigate back to a main navigation screen. I can fade each video.content individually but I'd rather just write one tween that effects the whole class. Am I missing something simple or is this larger than I think? ...additionally, these transformations DO work with NetStream driving the f4vs. But looping w netStream is ugly , as we know. Thanks!
  23. Hi, I am having big time losses in creating a project: I have multiple games that use a common AssetsLoader class to load a toolbar manager (agent), that loads a toolbar through another assetsloader. The structure is as follows: a single configurable toolbar, 3 agents (toolbar managers) for 3 kinds of games, 80 games. Now, when I modify the toolbar code I can recompile it, it takes a few seconds, and the same is for the 3 agents, but recompiling 80 games is terrible! Why should I recompile all games? I noticed that if I modify the toolbar or an agent I have to recompile the parent cascaded swfs, otherwise I wouldn't see the agent or toolbar modifications in game as if recompiling the game I included agent and toolbar inside it. If I modify a game I need to recompile it, and it is ok; if I modify an agent I have to recompile it and all the games that load it; if I recompile the toolbar I have to recomile it, all agents, and consequently all games, and this is absolutely no good! I tried to cast the agent to * instead of the corresponding interface, but nothing changed. I tried to mess around with the application domains (trying to use a different sandbox for the agent and the toolbar), but I think I don't know very well how this works. I use LoaderMax for assets, and interfaces to access an agent from games and the toolbar from agents: game -> interface(agent) -> interface(toolbar). Can you help me please?
  24. Ok, I am pretty new to this flash / actionscript so please help me get on track... I am trying to do the following: FirstSwf -- contains a timelinemax that animates a text from left to right SecondSwf -- contains a X number of photos that fade in and fade out with Y animation duration (number of images is dynamically parsed via XML configuration) ThirdSwf -- contains a timeline that animates a text from bottom to top (sort of like credits screen) Main.swf -- This is where I am stuck. I want to load the three SWF's into a master timeline inside main.swf and than sequentially play them one by one. I am able to load these swf's using LoaderMax but I can't seem to figure out two things: 1. How do I play them in sequence? 2. How do I control the sub timelines (within these external swf's) via the master timeline? Any help would be appreciated! Thanks
  25. Hi, I am using loadMax with loaderImage now i coming into a performance problem not on desktop but on tablet i have about 60+ images to load all at once, is there a way you can delay the loader like if it hit 20 items and delay 2 secs and keep load... cheers bill