Category: AS3

24

iPhone and iPad + Flash 10 and CS5 – Solutions?


UPDATE: Reader Hector found a couple of interesting videos showing some benchmark testing. One of which I found quite interesting.

And also check out the Adobe section of optimizing for mobile content. Useful information for any type of development.

UPDATE 2: Apple may change iPhone SDK to avoid legal ramifications.


Original Thoughts:

There's been a lot of buzz surrounding Apple's stance on the exclusion of Flash on the iPhone and now the iPad. For many of us designers and developers, the evolution of Apple and Adobe have been a match made in heaven. But times have changed….

Breaking Down Apple's Logic
When the average person thinks of Flash, banners and advertisements are the first things that come to mind, followed by Youtube and other video streaming applications. So it's safe to say that the public perception of Flash first starts off with a limited viewpoint before it gradually works its way to thinking it as a well designed and award winning creative technique.
Which leads me to believe that Apple's reason for excluding Flash on it's mobile platform, is to a certain extent (dare I say it) a logical choice. *gasps*

Adobefication
To fully understand the logic behind Apple's decision, we need to look at Flash and its performance issues. This has been the foundation for a number of arguments supporting the exclusion of Flash. The three major strikes against Flash include:
1. Its proprietary standard.
2. Its process intensiveness (especially on Macs)
3. Its lack of maturity (as a fully functioning non-lite platform) within the Mobile device market.

To be fair, we need to also look at the performance of the developer. Adobe's Flash engineers certainly aren't blameless, but the developer is really the first step in the chain of making something work and work well. Flash has been around for a while now and with age, comes maturity. Over the course Flash's progression, Macromedia and Adobe have steered it in the right direction. However Flash still has a long way to go and is ready for a prototype shift. Given Steve Jobs' recent comments, I think it's time for Adobe to put the cards on the table and call Apple's bluff.

Making a Mends
My solutions for Abobe (I hope you're out there listening) is to first create a robust and well designed interface system for debugging applications that is easily accessible and dependable to all levels of developer. Listening for the fan firing up is no way to determine that you've got run away processes and less then ideal code. Adobe also needs to enable adequate staging environments so that debugging and testing can be done within an applications ultimate environment. There are a number of tools and utilities to debug and test, but nothing that fully checks the performance of an application and gives the developer clear data on where bottlenecks are and what can be done to avoid them. In addition to that, Adobe should consider making the SWF format an open standard. Adobe's purchase of Macromedia was largely in part to take over the ubiquity of Flash on the web, so relinquishing that control would be a very progressive business move but in the long run pay off well for them.

HTML5 standing by
Ahhhh HTML 5… Why did you get dragged into this mess? Well the quick answer is that a certain someone has poised HTML5 to be the "Flash Killer". It's suicide to say "never" in the web development world, so I'll simply say incredibly unlikely that HTML5 would ever fully replace Flash. In fact, when this phase is over, I believe Flash and HTML5 will be good friends. HTML5 is in NO position at this point to be compared to Flash.

Here's why I'm confident in my argument:

  • HTML5 hasn't been fully established yet and most importantly it hasn't come even close to the level of development maturity of Flash.
  • HTML5 is a framework and a structured format (which has been pointed out in other discussions). It's method of development and implementation is totally different the Flash. Compilation of an application versus runtime execution of code.
  • The development tools for creating applications with Flash have had a long time to evolve. Project management and code management, OOP based utilities and frameworks, etc.
  • From a business perspective, why would a client want to pay for a developer to build an application from the ground up that rivals the best of the best with Flash?
  • IF, you were able to take the time and build a fully functional experience with all the MVC, physics, and layered video goodness of a top level Flash site with HTML5, if it's developed poorly, you are going to experience the same issues that a Flash site would. And who knows, maybe it would be even worse?
  • Code protection and copyright enforcement of development. (Something Flash could do better as well)

With that being said, I look at this as Oranges and Cherry Trees. Flash Developers should in now way take the defense by bashing HTML5. It's great and certainly has it's place in the developers toolbox. I just believe that it has become a scape goat in what is largely a school yard fight.

Back to Apple…
One side of my family has grown up with Apple, while the other has gown up with Microsoft and IBM compatible computers. The Apple side consists of an Architectural Scale Model Maker and Architect, a Wardrobe Stylist, an Audio Engineer, an industrial designer, and myself a Flash Developer/Web Designer. On the other side, I have a Computer Programer, and a Certified Public Accountant. Why am I sharing this? Maybe for full disclosure, but also to emphasize that I have always enjoyed their products and approach to using creative technology. Yet, I'm quick to point out when Apple isn't being pragmatic and would never consider myself a fanboy.

I was passionate about Apple products until having owned an iPhone for 2 years. Now seeing the release of the iPad, I've grown even more disenchanted with Apple. And no, it's not just because they don't have Flash on them. The exclusion of Flash on the iPhone is part of a bigger issue. It's the exclusion of Applications in general. I realize that control over Apps and the exclusion of third party layers helps Apples quality control, but at the same time the end user also suffers. Apple also criticizes mobile performance that use Flash and there is some truth to that, but that could be easily addressed with some help from Adobe.

I'm starting to feel like Apple has taken on a totalitarian dictatorship on what can be put in the device and what can't. I don't believe Apple should dictate what I do with my phone. How would the world react if they did this with our computers? It seems as though Apple has lost site of its loyal customers that have been around since the earlier days. Ask anyone that uses Macs in their day to day endeavors and see if they feel like Apple is developing and marketing new products that are geared to them. In my opinion they aren't. The 3Gs has features the first release of the iPhone should have had. And the iPad is sort of silly in my opinion. The iPhone and the iPad are for non Apple users, or is at least focused on attracting non Apple users. As far as business goes, this makes perfect sense. You can't grow a business by just catering to the people that already own the products, but at the same time you can't ignore the ones that do either. It would be nice if some of the focus was shared with products that are geared towards the people that helped them get to where they are. Don't forget about us tech savvy people that do enjoy your products and push them to the limit. It's gotten to the point where the jail-broken phone has become the developer edition. Apple has built a box outside of the box. Because of this, I'm saying good bye to my iPhone. I've downloaded the Android SDK and I'm impatiently waiting for the Sony Ericsson Xperia X10 to be released in the U.S. As a Flash developer, the Android environment makes sense with respect to the languages and the grass roots approach to development.

The silver lining in this whole situation is that both Apple and Abobe stand to better themselves. Apple has put some real issues and concerns on the table for Adobe yet I also believe that Jobs is being a bit stubborn and egotistical. Apple is flouting themselves as being the holy grail of how to funnel Applications to the end user, yet their hardware is two iterations behind what it should be.

And I'm a curious person. I don't see myself developing Flash apps forever, or at least exclusively. And to use Jobs' words, I have no problems leaving the past behind. I'm looking forward to learning more about how to develop for Android and the freedom of an Open Source environment.

I think of the Flash issue as the final straw, but I'm happy to have a device that will run Flash 10.1. If it works or not remains to be seen, but I don't need anyone telling me it doesn't work without experiencing for myself.

01

HydroTween is now OpenTween and on Github!


GitHub

I've decided to take a step back in the hopes of taking two steps forward. HydroTween is now deprecated for the most part as I've stripped it down and done some rebuilding in the form of OpenTween. The hope is by having the project on gitgub, the project will attract some extra help and involvement. Some other reasons for rebuilding are the modularity of the properties and the goal of having easy to add/configurable properties and property groups. Performance inprovements are another important reason. Also the fact that the code is using an MIT license means that it can be added to whatever project you want as long as the license boiler plate is intact. It's even set up so you can create your own "private label" tweening engine for your development projects. I.E. I have MyOwnTween which extends OpenTween and allows you to reorder your params, settings, etc.

I have yet to implement the image process tweening properties or give this a thorough testing so it's still in the infant stages, but I'm excited about where this is going and giving the project a fresh restart. Check out Git if you haven't already and give me a shout if you want to get involved!

OpenTween on Github

2

QueueLoader is now on Github!


Github is the social networking version of a version control system. The learning curve with Git can be a little tricky at first, but after installing and learning the basic commands you will be up and running. The beauty of Git lies in the way it collects and organizes changes and data. Merging from multiples sources is reliable and makes for more contributions. This will hopefully encourage more people to get involved with Open Source projects including QueueLoader! I will still be providing a standalone link either here on the site or on the deprecated Google Page, but for wiki usage and change info definitely go to Github.

QueueLoader on Github

2

QueueLoader 3.1.8


Having some problems with the vcs on Google, but the featured link is current. I'm in the process of moving QueueLoader over to github to ultimately make life easier. 3.1.8 addressed an issue with throwing an error when running the queue with no items in it as well as the QUEUE_COMPLETE event firing if you run a queue with all items generating errors and the queue's ignoreErrors argument set to true.


Download QueueLoader rev 3.1.8 Source Only

3

Fluorescent Ballast and Neon Flicker + Across The Hall Movie


Across The Hall Movie
Just completed a rush project for the film Across The Hall. Being that this is a noir styled film, I came up with a simple class that emulates the effect of sign letters turning on. Could work for Fluorescent lights as well as other stuff. Easiest way to use it is to link the MovieClip in your library you intend to export and point the base class path to FluorescentBallastFlicker.

Then in your code, instantiate and attach the MovieClip to your DisplayObject and the MovieClip will automatically set its alpha to 0 and will be ready to turn on.

The turnOn() method takes the arguments; seconds of turn on time, seconds of delay, and an optional callback function when the effect has finished.

_hSign.turnOn(1, 0);
_oSign.turnOn(2, .5);
_tSign.turnOn(2, 1);
_eSign.turnOn(2, 1.5);
_lSign.turnOn(2, 2);
_riverview.turnOn(2, 2.5, startSite);

Once the item is on, you can use the badBallast() method to emulate a loose connection. The lower the number the more frequent the flickering.

_hSign.badBallast(100);

Download Fluorescent Ballast and Neon Flicker Class Source Code!

0

QueueLoader 3.1.7


Announcing a long overdue update of QueueLoader last week. Fixes include finally addressing the error handling of a missing item that is first loaded. Also some optimization of the utility with interfaces.
Click here to download

The google group has been growing and hopefully it has been helpful. I set up an approval process for membership to reduce the amount of spam. I typically approve members within 12 hours.
Click here to join

Any additional suggestions or issues are welcome. Also feel free to click on our sponsors!

01

YouWillKnowTheTruth.Com – The Final Cylon


Who is the Final Cylon? You Will Know The Truth Revealed the Fifth Cylon

I'm excited about the launch of www.youwillknowthetruth.com. Keep checking the site as clues will be released frequently leading up to the moment of truth!

Final 5th Cylon Clue


9

11 Must Have Flash Resources and 11 Must Have Utilities For 2009


Here's my list of 11 shweet resources and utilities for Flash Developers for the upcoming year. Some of these will look familiar to you from 2008 and possibly even earlier, but their significance and continued development will see them into 2009 and beyond. With the release of CS4, expect to see upgrades and revitalization of a number of projects as new features of the latest version of Flash are incorporated.

Resources:

1. Papervision 3D + VectorVision
Now that Papervision has taken hold of the Flash community, what next? I decided to add it to this list, as I believe 2009 to be the year of PV3D optimization and streamlining. With the new features of CS4, along with GPU processing being utilized for rendering outside of full-screen mode, the upcoming year will see those chugging experiments running smoother with significant FPS gains. In Flash 10, the Graphics.drawTriangles method gives us the ability to draw triangles using UV and UVW coordinates natively which will strip a lot of code out of the engine. This will help enable the team to squeeze every ounce of efficiency out of Papervision which is the key to Papervision evolving and making it a lasting tool. All that being said, expect to see more pushing of the envelope and more amazing experiments. Along with Papervision, I'm excited to see the evolution of Vectorvision, the vector based add-on to the Papervision library. Creating font class files that can then be used to create 3D display objects, gives us another color in the artists palette. I'm hoping to see more drawing capabilities added very soon.

UPDATE: Vectorvision's Mark Barcinski is now a member of the Papervision team. Vectorvision code will get folded into the library making things a bit more convenient with updates. Also Tim Knip has released a triangulation lib which makes it easy to convert a Vectorvision object to DisplayObject3D. This provides shading, texturing, and quadrant engine functionality. This will also lead the way for extrusion!

2. Ribbit
One of the coolest things to come out of 2008 is Ribbit. So cool, that I have also added it to my 2009 list. The creative possibilities with Ribbit are endless. Imagine plugging your Flash application into a phone jack. Keep an eye out for Ribbit's Killer App Contest which will generate a great deal of ideas. I see a significant increase in viral development using Ribbit in 2009, as well as incorporated into social networking, digital artistic pieces, and more.

3. Go + HydroTween
This is 1 of 2 of my shameless plugs, but try and think of this in terms of the big picture. Forgetting Hydrotween, Go is more then a foundation for a Tweening engine. It's the pulse for anything that has a beginning, an end, or any level of frequency. Go made a modest dent in the development community in 2008, but I feel the best is yet to come. I'm hopeful that physics, more creative Tweening utilities, and even more 3D control and deforming modifiers will find their way to goplayground in 2009.

4. Unity3D
It's very easy to get set in your ways when dealing with a ubiquitous platform such as Flash. With an over 90% penetration rate, one silently cringes when thinking of integrating another web platform on top of the Flash environment. That all gets thrown out the window after experiencing the pure awesomeness of the Unity3D plug-in. Well, O.K. The concerns are still there, but this is definitely something to keep an eye out for. As communication between Unity and Flash flourishes, this wil become standard for more robust 3D games and applications. I wouldn't be surprised if we see some sort of relationship between Adobe and Unity.

5. F.D.T.
It's easy to become an evangelist for FDT. The Powerflasher team is doing a great job of listening to the Flash community effectively which is great because I am one of those people that is quick to point out its occasional hiccups. 3.1 Standalone was a and the foundation for further updates. Soon we will see MXML support in early 2009 as well as the Obfuscator which the team is working on with Nicolas Cannasse (HaXe). FDT is looking to bridge the gap between the design process and the development process as well as enhance the management. With the work that is being done to provide MXML support, the FDT engine is no longer tied to a specific coding language. What this means is that special projects such as as UML functionality, or an FDT configuration specifically for designers, can be undertaken without modifying the core.

6. Adobe Flash CS4
Hard to go down the list without mentioning the recent release of Flash CS4. The addition of the new Vector class will help to speed iteration processes by providing strict/strong typing of an array. In many cases, casting an object's type in a parameter will speed complex calculations. Following that concept, by defining an array's type at the onset, the iteration focuses on accessing its contents instead of what it contains. You can find a good example of this at Alex Bustin's Blog. Also in recent news from Adobe, Alchemy (which allows you to compile C and C++ code into AS using llvm-gcc) will open the doors for many Actionscript developers. For ultimate cool factor, look out for the NES emulator running ROMS ported to AS3! (FlaCC – at the bottom) Also Catalyst (formerly known as Thermo), should hopefully make the relationship between designer and developer easier when it comes to wire-framing out concepts.

7. Red5
When it comes to a server solution for Flash deployment, there are pretty much two options. One is the Flash Media Server which starts at around $5000 and the other is the free and open source Red5. It features streaming of FLV and MP3, recording of client FLV streams, remoting, and shared objects just to name a few. An admin tool has been added in 0.6.3 as well as stream listeners. For 2009, the Red5 team is introducing Server-Side AS3. This will allow you to write code on the server without knowing Java extending the flexibility and accessibility of Red5 for developers. Whole applications can be developed on the server for things such as Social Networking, media manipulation, and so much more. Red5 is poised to hit the 1.0 version mark pretty soon which will help in making it even more competitive with Flash Media Server as stable platform.

8. AMFPHP
This overlaps with Red5 a tad, but I added it because it is something that I find quick and easy to use on a per project basis. Fairly straightforward as it provides communication between a PHP server and Flash applications. Another standard addition to this is Danny Patterson's AS3 Lightweight Remoting Framework.

9. Spring Actionscript/Prana
Prana is an Inversion of Control container for AS3. This topic very easily requires its own post, but in simplest terms, Prana lets you configure your Application's components using an external XML file and initializing them at runtime. For large scale projects this is important as it lets you define your framework and allow for changes and management of dependent classes. The best place to get an overview of how this works is here. You can also find an example of an AS3 only version. Because Prana uses a Spring complient XML structure, it's being made into a Spring Extension and being renamed "Spring Actionscript". Adding it to a family of other IoC frameworks on other platforms.

10. PopForge
Pop Forge has already gained a great deal of notoriety this year with Andre and Joa's exploit of the ByteArray hack. With the ability to write Byte level code directly to the Sound object in Flash 10, expect to see this library trimed down even further with more effects and added forms of sound manipulation. I'm looking forward to seeing signs of formant filtering as well as additive and spectral synthesis. How about routing L.F.O. control to other things like the Graphics class? Or better yet, routing graphical output to the envelope of a sound? Maybe some cross pollination of PixelBender with PopForge? Which of course brings me to my next item in the list…

11. Pixel Bender
Pixel Bender is Adobe's new kernal language used to manipulate pixels in new and creative ways. Pixel Bender runs on multiple Adobe products which opens up the ability to write uber-cool filters for static and motion graphics. Pixel Bender focuses heavily on the GPU to perform its tasks, making it much more efficient and capable of complex operations. Photoshop, Flash, and After Effects will all benefit from the experimental work being done with this tool and a number of innovative examples have already surfaced. Escher's Droste Effect is one such effect that "spiralizes" a circular pattern and even works with a video source. Another is the ability to do Ray Tracing and shading. I expect to see more of this trickle into Papervision and Bitmap processing libraries in the not so distant future.

Utilities and Helpful Approaches:

1. SWFObject 2.0
The standard for embedding anything with a swf at the end of the file path. 2.2 development has been started with plans to address OnHold/ FixedIn2.2AlphaX. Expect a number of Flash 10 enhancements to come shortly for things such as express installer, wmode, etc.

2. Unity Object
Awesome and useful example of how to communicate between a Unity3D app and Flash.

3. QueueLoader 3.1
My last shameless plug. I chose to add this because of the significant re-write of the utility and ease in which people can add their own extras. With the new structure in place, be on the lookout for more loadable items and useful preloading processes similar to the drawFrames (lets you draw the frames of an external SWF to an array of bitmaps) feature.

4. TextArea Paging
A great trick for detecting the overflow of a TextArea for spilling into another TextArea. Perfect for creating "news" style layouts and working around images.

5. FileReference Verification of File Type
Cool utility for detecting file types of uploaded assets using the FileReference class.

6. Libary Code Version Checking
Cool technique for checking the version of your code when initializing. Helps to keep track of what version of a library you are using in a project to avoid conflicts.

7. Object Pooling Class
Object Pooling is a technique for centralizing the management of instantiated objects. Having an object instantiated and ready for use can reduce bottlenecks and offers the ability to limit unique creation. This is perfect for particle engines as it's used above. If you've seen one of Seb Lee-Delisle's particle talks at a conference, then you've seen this in action with how he's recycling the particles.

8. SelectiveBitmapDraw
One other thing that gets Moses Gunesch really excited besides the mechanics of motion, is finding easy ways of compositing or capturing elements of a display hierarchy and manipulating them in fun ways. His SelectiveBitmapDraw Class lets you take a group of nested DisplayObjects and flag them for compositing into another Bitmap object. What makes this even cooler is that you can omit different items in the hierarchy. On top of that, you can use this with Papervision and apply it to DisplayObject3D items in your scene!

9. FLARToolKit
This is one of those things you need to see with a video. The FLARToolKit is used for creating "Augmented Reality" experiences. The way it works is by locking onto visual targets as reference points for creating motion and mapping points. Also check out the post of Mikkoh Haapoja's. A great video example can be found at today and tomorrow.

10. HiReS! SWF Stats
Mr. Doob has a well done dashboard for continuously outputting a running swf's performance. We've all used the frames-per-second bar, memory output meter, ms time in troubleshooting our applications. What his utility also gives you, is a visual graph of the data in real-time in a nice complete package.

11. Orchid
If you've heard of Saffron (Samuel Agesilas' Actionscript based UML utility for creating stub code in a graphical user interface), then you've heard of Orchid. Orchid is an open source UI framework that works using the concept of Signals and Slots. Saffron has long been shrouded in mystery and this is most likely the case due to the fact it was picked up by a well known software development company. Rumors that it was purchased by Microsoft popped up, then there have been ramblings of Adobe buying the code. Regardless of what the case is, having seen the interface work that Sam has done on Saffron, it's easy to get a sense of the capabilities and flexibility of the Orchid architecture.

In addition to the items above, there are a number of other interesting things worth mentioning. Animoto is a cool application that takes user submitted media, and creates a music video based on your settings and creative genius. Aviary is a group of software tools that let you edit images, generate color palettes, and visual effects. X-Ray is a fairly well known and already established debugging utility that makes tracking trace statements, errors, and resources much easier. John Grden was able to make some changes for the Flex crowd recently and I'm looking forward to seeing how this progresses even further.

So that's the list! Because there is so much exciting stuff coming in the new year, I'm considering adding a user submitted list. What do you think? Contact me and let's get another list going!

51

QueueLoader Version 3.1 – Major Update + Usage


UPDATE: 3.1.3: Fixed width and height prop in Image and SWF items. Added autoPlay to FLV. event.content returns the NetStream object and using event.content.seek(0) and event.content.togglePlay() will start the stream if the item is NOT set to autoPlay (false is the default).

UPDATE: 3.1.2: Changed path prop to URLRequest.

UPDATE: 3.1.1: Fixed an error thrown in Flex 4 SDK in FLVItem.as – Also Added version numbers to all Files. Update is on the SVN.

I'm excited to announce that QueueLoader has undergone a major revision. I finally had a chance to rewrite the class and make it more "Open Source" friendly and scalable. All loadable items have been broken out into separate classes implementing an ILoadable interface as well as extending an abstract loadable item. This will also make it easier for adding special features to loadable items, as well as promote the evolution of the package. The package path has been changed, but most of the API and general ease of use has remained the same. The most significant change is how to access loading items via the event callbacks. They have been broken out to container, targ, and content. They are explained further below in the "Useful Tips" section. I'm going to do my best to include as many frequently requested examples, but first let's go over the current features of this revision:

QueueLoader Logo

Source Downloads:
QueueLoader 3.1.3 Example Files + Assets + Source + Documentation :: 28.44 MB
QueueLoader 3.1.3 Source + Documentation :: 1.16 MB

Note: Both of the downloads above include the dependent libraries Popforge (.wav) and Nochump (.zip). I am not including these libraries on the SVN. Be sure to check for updates above to changes in the core QueueLoader source. If you wish to run QueueLoader without the additional libraries; In ItemList.as comment out line 45 and 46 where the zip and wav classes are being added to the loadable item list. Also comment out lines 82 and 84 in QueueLoader where the zip and wav filetype constant id numbers are defined. Finally be sure to remove ZIPItem.as and PCMSoundItem.as from the "items" package. If you wish to add your own custom item, you would simply follow the instructions in reverse but adding a unique number to the file type constant id.

Also Note: Just to clear up an possible confusion, this is a version change and not another revision. The URL to this page might be confusing as it looks like rev31 when it's 3.1.

Mailing List:
QueueLoader Google Group

General Features:

Supported File Types:

QLManager – Global QueueLoader Management:

Useful Tips and Other Info:

  • If you are loading a ton of images, you might consider putting them all on separate frames of a SWF and using the draw frames feature. If the image collection gets updated, putting them in a Zipped folder might be easier. This will alleviate the opening and closing of HTTP connections.
  • event.container – access to the container you specify in the addItem() method.
  • event.targ – access to the Loader of an Item in the case of an Image or SWF. This is what is added to the container DisplayObject if it has been added to the addItem() arguments.
  • event.content – access to the loaded item's data or content. In the case of an Image, it would be the Bitmap. In the case of a SWF, it would be the SWF's timeline. In the case of CSS, it would be the StyleSheet. In the case of audio, it would be the Sound. Etc…
  • Keep in mind QueueLoader is a utility, and not a component. Many of the more complex usage scenarios can very easily be built on top of QueueLoader. Using QueueLoader does require some basic knowledge of Actionscript 3.0, listeners, events, as well as scope. It's also much easier to extend the functionality if you are looking to modify the features of an existing loadable item. Simply replace a file type constant and add the Item to the ItemList with a regex for the filetype. Just make sure the file suffix doesn't conflict with another suffix.
  • QueueLoaderLite has been included in the package and will undergo a rewrite soon as well making the distinction between the two clearer.

View the Class Documentation Files


Examples


Overall Monitoring/Basic Example

// Most Basic Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
var _oLoader:QueueLoader = new QueueLoader();
 
var img:Sprite = new Sprite();
img.name = "image_1";
img.x = 20;
img.y = 20;
img.scaleX = img.scaleY = .075;
addChild(img);
 
_oLoader.addItem("../flashassets/images/slideshow/1.jpg", img);
 
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
function onQueueProgress(event:QueueLoaderEvent):void {
	trace("\t>>onQueueProgress: "+event.queuepercentage);
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
}

Back To Top


Multiple Items and Event Monitoring Example

// Multiple Items and Event Monitoring Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
var imageContainer:Sprite = new Sprite();
addChild(imageContainer);
imageContainer.x = imageContainer.y = 25;
 
var _oLoader:QueueLoader = new QueueLoader();
 
var startX:int = 0;
var startY:int = 0;
 
for (var i:int = 0; i < 3; i++) {
	var img:Sprite = new Sprite();
	img.name = "image_"+i;
	img.x = startX;
	img.y = startY;
	img.scaleX = img.scaleY = .075;
	imageContainer.addChild(img);
	_oLoader.addItem("../flashassets/images/slideshow/"+(i+1).toString()+".jpg", img, {title:"Image "+i});
	if (startX > 250) {
		startX = startX + 50;
		startY = startY + 100;
	} else {
		startX = startX + 150;
	}
}
 
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_START, onQueueStart, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.ITEM_START, onItemStart, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.ITEM_PROGRESS, onItemProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.ITEM_ERROR, onItemError,false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
//Listener functions
function onQueueStart(event:QueueLoaderEvent):void {
	trace("** "+event.type);
}
 
function onItemStart(event:QueueLoaderEvent):void {
	trace("\t>> "+event.type, "item title: "+event.title);
}
 
function onItemProgress(event:QueueLoaderEvent):void {
	trace("\t\t\t>>onItemProgress: "+event.queuepercentage);
}
 
function onQueueProgress(event:QueueLoaderEvent):void {
	trace("\t>>onQueueProgress: "+event.queuepercentage);
}
 
function onItemComplete(event:QueueLoaderEvent):void {
	trace("\t>> "+event.type, "item title: "+event.title);
}
 
function onItemError(event:QueueLoaderEvent):void {
	trace("\n>>"+event.message+"\n");
}
 
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
}

Back To Top


Bitmap Smoothing and Cache Killing Example

// Bitmap Smoothing and Cache Killing Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
var _oLoader:QueueLoader = new QueueLoader();
 
var img:Sprite = new Sprite();
img.name = "image_1";
img.x = 20;
img.y = 20;
img.scaleX = img.scaleY = 1.25;
addChild(img);
 
_oLoader.addItem("../flashassets/images/slideshow/1.jpg", img, {title:"Image 1", cacheKiller:true, smoothing:true});
 
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
function onQueueProgress(event:QueueLoaderEvent):void {
	trace("\t>>onQueueProgress: "+event.queuepercentage);
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
}

Back To Top


Calling a SWF's Library Class References – Application Domain Example

// Calling a SWF's Library Class References - Application Domain Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
 
var addedDefinitions:LoaderContext = new LoaderContext();
addedDefinitions.applicationDomain = ApplicationDomain.currentDomain;
 
var _oLoader:QueueLoader = new QueueLoader(false, addedDefinitions, true, "testQueue");
 
_oLoader.addItem("../flashassets/swf/externalsounds.swf", this, {title:"SWF"});
 
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_START, onQueueStart, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
//Listener functions
function onQueueStart(event:QueueLoaderEvent):void {
	trace("** "+event.type);
}
 
function onQueueProgress(event:QueueLoaderEvent):void {
	trace("\t>>onQueueProgress: "+event.queuepercentage);
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
	var loop:Sound = new (getDefinitionByName("Loop1"))();
	var soundChannel:SoundChannel = loop.play(0,999);
}

Back To Top


Queue Disposing

// Queue Disposing
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
var _oLoader:QueueLoader = new QueueLoader();
 
var img:Sprite = new Sprite();
img.name = "image_1";
img.x = 20;
img.y = 20;
img.scaleX = img.scaleY = .1;
addChild(img);
 
_oLoader.addItem("../flashassets/images/slideshow/1.jpg", img, {title:"Image 1"});
 
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
function onQueueProgress(event:QueueLoaderEvent):void {
	trace("\t>>onQueueProgress: "+event.queuepercentage);
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
	setTimeout(callDipose, 3000);
}
 
function callDipose():void{
	_oLoader.dispose();
}

Back To Top


Manually Setting File Type/URL Variable Example

This will let you pass URL variables to a file that is to be loaded. Keep in mind that the example data.php file has no php code in it so that it will run locally. However on a php server you would have the code shown below in the data.php file. This will pass the url variable $user a value of yourname, which you should see as yourname.jpg in the XML output.

PHP:


css="test.css"
>






'; ?>

Back To Top

Actionscript:

// Manually Setting File Type/URL Variable Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
var _oLoader:QueueLoader = new QueueLoader();
 
var img:Sprite = new Sprite();
img.name = "image_1";
img.x = 20;
img.y = 20;
img.scaleX = img.scaleY = .1;
addChild(img);
 
_oLoader.addItem("../includes/admin/data.php?id=1&user=yourname", null,
		{title:"XML PHP", mimeType:QueueLoader.FILE_XML}
);
 
_oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
function onItemComplete(event:QueueLoaderEvent):void {
	trace("\t>> "+event.type, "item title: "+event.title);
	if (event.title == "XML PHP") {
		var output:String = XML(event.targ).child("images").child("img")[0].@src;
		trace("\n\t\tXML Node: "+output+"\n\n");
	}
}
 
function onQueueProgress(event:QueueLoaderEvent):void {
	trace("\t>>onQueueProgress: "+event.queuepercentage);
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
}

Back To Top


Drawing a SWF's Frames to BitmapData Array Example

// Drawing a SWF's Frames to BitmapData Array Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
var _oLoader:QueueLoader = new QueueLoader();
 
_oLoader.addItem("../flashassets/swf/externalimages.swf", null, {title:"SWF Images", drawFrames:true});
 
_oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
function onItemComplete(event:QueueLoaderEvent):void {
	trace("\t>> "+event.type, "item title: "+event.title);
	if (event.title == "SWF Images") {
		var startX:int = 0; var startY:int = 65;
 
		for (var i:int = 0; i<event.bmArray.length; i++) {
			var bm:Bitmap = new Bitmap(event.bmArray[i], "auto", true);
			bm.x = startX;
			bm.y = startY;
			bm.scaleX = bm.scaleY = .75;
			addChild(bm);
			startX = startX + 85;
		}
	}
}
 
function onQueueProgress(event:QueueLoaderEvent):void {
	trace("\t>>onQueueProgress: "+event.queuepercentage);
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
}

Back To Top


Ignoring of Errors/Error Handling Example

// Ignoring of Errors/Error Handling Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
var _oLoader:QueueLoader = new QueueLoader(true); //<- true arg sets ignore errors
 
var img:Sprite = new Sprite();
img.x = 20;
img.y = 20;
img.scaleX = img.scaleY = .075;
addChild(img);
 
var img2:Sprite = new Sprite();
img2.x = 120;
img2.y = 20;
img2.scaleX = img2.scaleY = .075;
addChild(img2);
 
var img3:Sprite = new Sprite();
img3.x = 220;
img3.y = 20;
img3.scaleX = img3.scaleY = .075;
addChild(img3);
 
_oLoader.addItem("../flashassets/images/slideshow/1.jpg", img);
_oLoader.addItem("../flashassets/images/slideshow/12.jpg", img2);
_oLoader.addItem("../flashassets/images/slideshow/3.jpg", img3);
 
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.ITEM_ERROR, onItemError,false, 0, true);
 
_oLoader.execute();
 
function onQueueProgress(event:QueueLoaderEvent):void {
	trace("\t>>onQueueProgress: "+event.queuepercentage);
}
 
function onItemError(event:QueueLoaderEvent):void {
	trace("\n>>"+event.message+"\n");
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
}

Back To Top


Stop and Resume Example

// Stop and Resume Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
var _oLoader:QueueLoader = new QueueLoader(true); //<- true arg sets ignore errors
 
var img:Sprite = new Sprite();
img.x = 20;
img.y = 20;
img.scaleX = img.scaleY = .075;
addChild(img);
 
var img2:Sprite = new Sprite();
img2.x = 170;
img2.y = 20;
img2.scaleX = img2.scaleY = .075;
addChild(img2);
 
_oLoader.addItem("../flashassets/images/slideshow/1.jpg", img, {title:"Image 1"});
_oLoader.addItem("../flashassets/images/slideshow/2.jpg", img2, {title:"Image 2"});
 
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
function onQueueProgress(event:QueueLoaderEvent):void {
	trace("\t>>onQueueProgress: "+event.queuepercentage);
}
 
function onItemComplete(event:QueueLoaderEvent):void {
	trace("\t>> "+event.type, "item title: "+event.title);
	if (event.title == "Image 1") {
		_oLoader.stop();
		// Set a 4 second to pause and resume the load
		setTimeout(resumeLoad, 4000);
	}
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
}
 
function resumeLoad():void{
	_oLoader.resume();
}

Back To Top


Bandwidth Detection Example

// Bandwidth Detection Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
var imageContainer:Sprite = new Sprite();
addChild(imageContainer);
imageContainer.x = imageContainer.y = 25;
 
var addedDefinitions:LoaderContext = new LoaderContext();
addedDefinitions.applicationDomain = ApplicationDomain.currentDomain;
var _oLoader:QueueLoader = new QueueLoader(false, addedDefinitions, true);
 
var startX:int = 0;
var startY:int = 0;
 
for (var i:int = 0; i < 3; i++) {
	var img:Sprite = new Sprite();
	img.name = "image_"+i;
	img.x = startX;
	img.y = startY;
	img.scaleX = img.scaleY = .075;
	imageContainer.addChild(img);
	_oLoader.addItem("../flashassets/images/slideshow/"+(i+1).toString()+".jpg", img, {title:"Image "+i});
	if (startX > 250) {
		startX = startX + 50;
		startY = startY + 100;
	} else {
		startX = startX + 150;
	}
}
 
_oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
_oLoader.execute();
 
function onQueueProgress(event:QueueLoaderEvent):void {
	trace("\t>>onQueueProgress: "+event.bandwidth+"KB/s");
}
 
function onItemComplete(event:QueueLoaderEvent):void {
	trace("\t>> "+event.type, "item title: "+event.title);
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
}

Back To Top


CSS Example

// CSS Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
var _oLoader:QueueLoader = new QueueLoader();
 
_oLoader.addItem("../includes/admin/test.css", null, {title:"CSS"});
 
_oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
function onQueueProgress(event:QueueLoaderEvent):void {
	trace("\t>>onQueueProgress: "+event.queuepercentage);
}
 
function onItemComplete(event:QueueLoaderEvent):void {
	trace("\t>> "+event.type, "item title: "+event.title);
	if (event.fileType == QueueLoader.FILE_CSS) {
		trace("\t\tCSS: "+event.content.styleNames);
	}
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
}

Back To Top

XML Loading/Get Item By Title Example

// XML Loading/Get Item By Title Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
var _oLoader:QueueLoader = new QueueLoader();
 
_oLoader.addItem("../includes/admin/test.xml", null, {title:"XML"});
 
_oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
function onQueueProgress(event:QueueLoaderEvent):void {
	trace("\t>>onQueueProgress: "+event.queuepercentage);
}
 
function onItemComplete(event:QueueLoaderEvent):void {
	trace("\t>> "+event.type, "item title: "+event.title);
	if (event.fileType == QueueLoader.FILE_XML) {
		trace("\t\tXML: "+event.content);
	}
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
	trace("\n\nXML Node:\n"+XMLList(_oLoader.getItemByTitle("XML").content).queueloader.item[0]);
}

Back To Top

Sorting Example

// Sorting Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
var _oLoader:QueueLoader = new QueueLoader();
 
_oLoader.addItem("../flashassets/mp3/GetDown.mp3", null, {title:"MP3"});
_oLoader.addItem("../flashassets/swf/externalsounds.swf", this, {title:"SWF"});
_oLoader.addItem("../includes/admin/test.xml", null, {title:"XML"});
_oLoader.addItem("../includes/admin/data.php?id=1&user=yourname", null,
     {title:"XML PHP", mimeType:QueueLoader.FILE_XML}
);
_oLoader.addItem("../flashassets/swf/externalimages.swf", null, {title:"SWF Images", drawFrames:true});
_oLoader.addItem("../includes/admin/test.css", null, {title:"CSS"});
 
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_START, onQueueStart, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
function onQueueStart(event:QueueLoaderEvent):void {
	trace("** "+event.type);
	trace(_oLoader.getQueuedItems());
}
 
function onItemComplete(event:QueueLoaderEvent):void {
	trace("\t>> "+event.type, "item title: "+event.title);
	if (event.title == "MP3") {
                // This takes an array of two items (second arg)
                // from 4th position (1st arg) and inserts them
                // into the 2nd position (3rd arg)
		_oLoader.shuffle(4, 2, 2);
	}
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
	trace(_oLoader.getLoadedItems());
}

Back To Top

Adding Items On-The-Fly Example

// Adding Items On-The-Fly Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
var _oLoader:QueueLoader = new QueueLoader();
 
_oLoader.addItem("../flashassets/mp3/GetDown.mp3", null, {title:"MP3"});
_oLoader.addItem("../flashassets/swf/externalsounds.swf", this, {title:"SWF"});
 
 
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_START, onQueueStart, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
function onQueueStart(event:QueueLoaderEvent):void {
	trace("** "+event.type);
	trace(_oLoader.getQueuedItems());
}
 
function onItemComplete(event:QueueLoaderEvent):void {
	trace("\t>> "+event.type, "item title: "+event.title);
	if (event.title == "SWF") {
		_oLoader.addItem("../includes/admin/test.xml", null, {title:"XML"});
		_oLoader.addItem("../flashassets/swf/externalimages.swf", null, {title:"SWF Images"});
		_oLoader.addItem("../includes/admin/test.css", null, {title:"CSS"});
	}
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
	trace(_oLoader.getLoadedItems());
}

Back To Top

QLManager Example

// QLManager Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
import com.hydrotik.queueloader.QLManager;
 
var _oLoader:QueueLoader = new QueueLoader(false, null, true, "loader1");
 
_oLoader.addItem("../flashassets/mp3/GetDown.mp3", null, {title:"MP3"});
_oLoader.addItem("../flashassets/swf/externalsounds.swf", this, {title:"SWF"});
 
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
 
 
var _oLoader2:QueueLoader = new QueueLoader(false, null, true, "loader2");
 
_oLoader2.addItem("../includes/admin/test.xml", null, {title:"XML"});
_oLoader2.addItem("../flashassets/swf/externalimages.swf", null, {title:"SWF Images"});
_oLoader2.addItem("../includes/admin/test.css", null, {title:"CSS"});
 
_oLoader2.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueue2Complete,false, 0, true);
 
_oLoader2.execute();
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
	trace(_oLoader.getLoadedItems());
}
 
function onQueue2Complete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
	trace(_oLoader2.getLoadedItems());
	setTimeout(callDipose, 3000);
}
 
function callDipose():void{
	trace("QLManager Accessing Items:");
	trace("\t"+QLManager.getQueue("loader1").getItemAt(0).title);
	trace("\t"+QLManager.getQueue("loader2").getItemAt(0).title);
	QLManager.disposeAll();
	trace("QLManager Disposing:");
	trace("\t"+QLManager.getQueue("loader1"));
	trace("\t"+QLManager.getQueue("loader2"));
}

Back To Top

Zip Loading Example
Make sure you have the nochump package in your source folder.

// Zip Loading Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
var _oLoader:QueueLoader = new QueueLoader();
 
_oLoader.addItem("../flashassets/zip/assets.zip", null);
 
_oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
function onQueueProgress(event:QueueLoaderEvent):void {
	trace("\t>>onQueueProgress: "+event.queuepercentage);
}
 
function onItemComplete(event:QueueLoaderEvent):void {
	trace("\t>> "+event.type, "item title: "+event.title);
	if (event.fileType == QueueLoader.FILE_ZIP) {
		trace("\t\tZIP Array: "+event.content);
	}
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
}

Back To Top

PCM Wav Loading Example
Make sure the Popforge library is included in your source along with the modified SoundFactory class that bypasses the swf.bin file. This modified class writes the bytes to a ByteArray instead.

//PCM Wav Loading Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
var soundChannel:SoundChannel = new SoundChannel();
 
var _oLoader:QueueLoader = new QueueLoader();
 
_oLoader.addItem("../flashassets/pcm/loop1.wav", null, {title:"Loop1"});
 
_oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
function onQueueProgress(event:QueueLoaderEvent):void {
	trace("\t>>onQueueProgress: "+event.queuepercentage);
}
 
function onItemComplete(event:QueueLoaderEvent):void {
	trace("\t>> "+event.type, "item title: "+event.title);
	if (event.fileType == QueueLoader.FILE_WAV) {
		soundChannel = event.content.play(0,999);
	}
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
}

Back To Top

MP3 Loading Example
Audio Sample
Audio taken from Islands of Chill. This album is great!

//MP3 Loading Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
var soundChannel:SoundChannel = new SoundChannel();
 
var _oLoader:QueueLoader = new QueueLoader();
 
_oLoader.addItem("../flashassets/mp3/GetDown.mp3", null, {title:"MP3"});
 
_oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
function onQueueProgress(event:QueueLoaderEvent):void {
	trace("\t>>onQueueProgress: "+event.queuepercentage);
}
 
function onItemComplete(event:QueueLoaderEvent):void {
	trace("\t>> "+event.type, "item title: "+event.title);
	if (event.fileType == QueueLoader.FILE_MP3) {
		soundChannel = event.content.play(0);
	}
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
}

Back To Top

Direct QL Formatted XML Loading Example
This snippet of XML can reside anywhere in your XML document. It allows for automatic passing of QueueLoader data. The prefix attribute simply adds the prefix when the movie is in external/standalone mode when publishing locally. If your paths jump directories or require absolute paths, then you can leave it as prefix="".

XML:



















Back To Top

The loadXML() method also accepts a scope variable which relates to the container attribute. I.E. scope[container]. If it's null, then the container has no parent reference and is the same as adding null to an addItem() method.

Actionscript:

//Direct QL Formatted XML Loading Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
var _oLoader:QueueLoader = new QueueLoader();
 
_oLoader.addItem("../includes/admin/test.xml", null, {title:"XML"});
 
_oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
function onQueueProgress(event:QueueLoaderEvent):void {
	trace("\t>>onQueueProgress: "+event.queuepercentage);
}
 
function onItemComplete(event:QueueLoaderEvent):void {
	trace("\t>> "+event.type, "item title: "+event.title);
	if (event.title == "XML") {
		_oLoader.loadXML(event.content);
	}
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
}

Back To Top

SWF Timeline Example

//SWF Timeline Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
var _oLoader:QueueLoader = new QueueLoader();
 
_oLoader.addItem("../flashassets/swf/timeline.swf", this);
 
_oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
function onQueueProgress(event:QueueLoaderEvent):void {
	queueprog.width = 150 * event.queuepercentage;
	queue_txt.text = "QUEUE: "+Math.round((event.queuepercentage*100)).toString() + "% COMPLETE";
}
 
function onItemComplete(event:QueueLoaderEvent):void {
	trace("\t>> "+event.type, "item title: "+event.title);
	if (event.fileType == QueueLoader.FILE_SWF) {
		event.content.fireFunction();
		event.content.gotoAndPlay(2);
	}
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
}

Back To Top

Generic Data Loading Example

//Generic Data Loading Example
 
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
 
var _oLoader:QueueLoader = new QueueLoader();
 
_oLoader.addItem("../queueloader.html", null, {title:"HTML"});
 
_oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
 
_oLoader.execute();
 
function onQueueProgress(event:QueueLoaderEvent):void {
	trace("\t>>onQueueProgress: "+event.queuepercentage);
}
 
function onItemComplete(event:QueueLoaderEvent):void {
	trace("\t>> "+event.type, "item title: "+event.title);
	if (event.title == "HTML") {
		trace(event.content);
	}
}
 
function onQueueComplete(event:QueueLoaderEvent):void {
	trace("** "+event.type);
}

Back To Top


Source Downloads:
QueueLoader 3.1.2 Example Files + Assets + Source + Documentation :: 28.44 MB
QueueLoader 3.1.2 Source + Documentation :: 1.16 MB

3

If a tree falls in the woods…


If a tree falls in the woods and nothing is there to hear it, does it make a sound?

I'd have to say yes and no. No to the fact that sound is based solely on perception, and if nothing is there to perceive a sound, then it can't be a sound. Yes to the fact that sound is made up of tiny fluctuations in atmospheric pressure. Just because someone isn't there to perceive a sound, doesn't mean there aren't variations in pressure. This became clearer to me when I came across a Flash conundrum when creating a pulse Sprite using the ENTER_FRAME event…

If a DisplayObject isn't attached to a display list, does it have a framerate?

Of course this is true, otherwise how would the event fire. However, how do we access the framerate of the Sprite if it isn't attached to a display list or has any references to the stage? Using sprite.stage won't work, so of course we can't use sprite.stage.framerate. If the Sprite is instantiated, and an ENTER_FRAME is attached to the DisplayObject, then how does it know how fast to run?

I've created a Bitmap transition class/framework that uses a Sprite to generate a pulse for transitioning from one visual state to another using two sources. I don't want to create any references to the stage or the display list associated with the source and target Bitmaps. Some might say, well why not? I considered doing this, but my answer was A: I want to make it cleaner, encapsulated, and self contained (Hence my reason for not using HydroTween). B: Garbage Collection. The less references to anything else, the less chance of a memory leak.

It's possible the answer to this question is simple and I'm being deep, philosophical, and difficult for no reason. If you know the answer, then send it on over!

Until then, I've decided to file a bug/feature request with Adobe.

Given the current architecture of Flash, you can only have one Stage per compiled clip. So wouldn't it make sense to me to have static access to the Stage properties? I'm assuming that the Sprite in the forest (pardon the pun) is finding some way to know how fast it needs to cycle from frame to frame. If it can, then I want to be able to as well:)

So if you agree with me, click on the above link and vote for this issue to be addressed. Otherwise it's safe to say the only sound you'll hear is the chipmunk the tree is falling on.

Previous Page

actos ordering viagra on line breast cancer support taking zoloft cialis soft tabs pregnancy prevention methods buy cheap viagra online viagra diflucan generic for toprol discount cialis online pills for acne lipitor pills viagra online usa fertility in women discount dog meds i need viagra today generic for nexium blood clots buy rx-viagra purchase levitra online levitra online no prescription breast cancer help flovent asthma buy cabergoline dosage cipro cialis on line zyban online from canada order cialis online without prescription cures for hair loss viagra buy overdose zolpidem order imitrex online snoring in children order prilosec how effective is plan b viagra online at cialis buy on line cialis cheap no prescription allegra order natural eye drops cat skin infections buy tadalafil online ambien rx cheep daily cialis vigira and cialis bupropion 150 mg depression relief zyrtec online cialis cheapest online prices do male enhancement pills work cialis cheapest online prices antifungal scalp vitamin cheap hoodia relief from constipation bupropion 150mg benicar generic cialis 20 xanax cealis lavetra natural muscle and joint health aciphex latest treatment for heart attack cialis 5mg tablets how to lower high blood pressure xenical mexico prescriptions hair loss products for men viagra online without prescription usa buy 5 htp abnormal blood clots body building programs viagra dotted condoms new weight loss drug cialis buy online lisinopril dosing tramadol florida alternative cholesterol treatment levitra usa lipitor drug metoprolol dosage blood clot treatments all natural antibiotics dogs antidepressants healthy immune system cialis prescription active ingredient cialis help for infertility quitting zyban allegra effects side cialis without rx dog products online coumadin cialis cost low diet pill rx viagra sex domination calcium channel blocker hypertension cialis cost low hair loss disease buy levothroid ankylosing spondylitis buy viagra hair care hair loss mg buy phentermine order viagra online elevated blood sugar prednisone allergy acne cheap cialis generic diabetes order help for sleeping problems dog medication dexamethasone therapy viagra from usa buy norvasc how to buy viagra online remedies for bone loss alzheimers meds cheapest cialis accutane buy combivent cefuroxime order imitrex online over weight dog clonazepam overdose viagra online purchase reduce cholesterol naturally buy cheap tadalafil uk how to prevent strokes vigra perscritpions viagra and buy online alcoholism treatment buy hyzaar avapro 150mg allegra order zocor celebrex celebrex dog ear problem buy cialis generic buy levitra hair loss hair loss drug metoclopramide buy cialis online without a prescription acne product which antibiotics treat chlamydia viagra on line drug allergies buy buy discount cialis buy cialis without a perscription