develop's blog,about web&game&mobile&so on!

LoaderMax – Smart AS3 Loading

<Category: flash> 查看评论

LoaderMax is a new AS3 loading system that does much more than just get swf, mp3, css, video, image, text, binary, and xml files into your Flash application. It eats files for dinner, burps, and then asks for 2nds. And 3rds. Yet it’s surprisingly thin. In fact, it can be half the size of most other loading systems even though it delivers a bunch of unique capabilities, some of which you probably never knew you needed but won’t want to live without. Here are a few of the noteworthy features:

http://www.LoaderMax.com

  • Integration of loaders inside subloaded swfs – with most other systems, if you subload a swf, the loader will only concern itself with the swf file’s bytes but what if that swf must subload other content like XML, images, and/or other swf files before it should be considered fully loaded? LoaderMax can elegantly handle the sub-subloads as deep as they go. You can link any loader and/or LoaderMax with a swf’s root (using the requireWithRoot vars property) so that when you subload it into another Flash application, the parent SWFLoader automatically factors the nested loaders into its overall loading progress! It won’t dispatch its COMPLETE event until they have finished as well.
  • Automatic parsing of LoaderMax-related nodes inside XML – The XMLLoader class automatically looks for LoaderMax-related nodes like <LoaderMax>, <ImageLoader>, <SWFLoader>, <XMLLoader>, <VideoLoader>, <DataLoader>, <CSSLoader>, <MP3Loader>, etc. in XML files that it loads, and if any are found it will create the necessary instances and then begin loading the ones that had a load=”true” attribute, automatically integrating their progress into the XMLLoader’s overall progress and it won’t dispatch a COMPLETE event until the XML-driven loaders have finished as well. See XMLLoader’s ASDocs for details.
  • Tight file size – Many other systems are 16-24k+ even if you’re just loading text, but LoaderMax can be as little as 7k (depending on which loader types you use).
  • Define an alternateURL for any loader – If the original url fails to load, it will automatically switch to the alternateURL and try again.
  • A common set of properties and methods among all loaders – All loader types (XMLLoader, SWFLoader, ImageLoader, MP3Loader, CSSLoader, VideoLoader, LoaderMax, etc.) share common properties like: content, name, status, loadTime, paused, bytesLoaded, bytesTotal, and progress as well as methods like: load(), pause(), resume(), prioritize(), unload(), cancel(), auditSize() and dispose() delivering a touch of polymorphism sweetness.
  • Nest LoaderMax instances inside other LoaderMax instances as deeply as you want. – A LoaderMax instance is basically a queue of loaders which makes it simple to control them as a whole and get the overall progress, bytesLoaded, and/or bytesTotal. You can put a queue into another – group and nest them however you want. This makes complex queues simple. Need to know when the first 3 loaders have finished loading inside a 10-loader queue? Just put those 3 into their own LoaderMax that has an onComplete and nest that LoaderMax inside your main LoaderMax queue.
  • Set a width/height for an ImageLoader, SWFLoader, or VideoLoader and when it loads, the image/swf/video will automatically scale to fit using any of the following scaleModes: “stretch”, “proportionalInside”, “proportionalOutside”, “widthOnly”, or “heightOnly”.
  • Conveniences like auto smoothing of images, centering their registration point, noCache, setting initial x, y, scaleX, scaleY, rotation, alpha, and blendMode properties, optional autoPlay for mp3s, swfs, and videos, and more.
  • Works around common Flash hassles/bugs – LoaderMax implements workarounds for things like garbage collection headaches with subloaded swfs, images, and NetStreams as well as other problems like the recently discovered issues with subloading swfs that use TLF.
  • Find loaders and content by name or url – Every loader has a name property which you can use to uniquely identify it. Feed a name or URL to the static LoaderMax.getLoader() or LoaderMax.getContent() methods to quickly get the associated loader or content.
  • A single loader can belong to multiple LoaderMax instances
  • Accurate progress reporting – For maximum performance, set an estimatedBytes for each loader or allow LoaderMax’s auditSize feature to automatically preload just enough of each child loader’s content to determine its bytesTotal, making progress reporting on large queues very accurate.
  • prioritize() a loader anytime – Kick an object to the top of all LoaderMax queues to which it belongs, immediately supplanting the top spot in each one.
  • A robust event system – events bubble up through LoaderMax hierarchies and carry a consistent target for easy identification
  • Set up multiple event listeners in one line – Add listeners like onComplete, onProgress, onError, etc. via the constructor like new LoaderMax({name:”mainQueue”, onComplete:completeHandler, onProgress:progressHandler, onError:errorHandler});
  • maxConnections – Set the maximum number of simultaneous connections for each LoaderMax instance (default is 2). This can speed up overall loading times.
  • pause()/resume() – no queue loading solution would be complete without the ability to pause()/resume() anytime.
  • Flex friendly – Simply change the LoaderMax.contentDisplayClass to FlexContentDisplay and then ImageLoaders, SWFLoaders, and VideoLoaders will return content wrapped in a UIComponent.

http://www.LoaderMax.com

本文来自: LoaderMax – Smart AS3 Loading

只有 1 条评论 订阅该文评论 RSS

WP Themes

Nice post and this fill someone in on helped me alot in my college assignement. Thanks you on your information.

发表评论