Archive for the ‘AS3’ Category

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


Sunday, November 30th, 2008




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!

Sunday, November 23rd, 2008




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:

<?php echo '<?xml version="1.0" encoding="iso-8859-1"?>
<test
        css="test.css"
        >
        <!–
        Fonts:
               
        –>
       
        <config>
                <audio src="flashassets/swf/externalsounds.swf" />
        </config>
       
       
        <images>
                <img src="flashassets/images/slideshow/'
. $user . '.jpg" />
                <img src="flashassets/images/slideshow/2.jpg" />
                <img src="flashassets/images/slideshow/3.jpg" />
        </images>
       
</test>'
; ?>

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:

<queueloader prefix="../">
                <item container="this" src="flashassets/swf/externalimages.swf">
                        <info>
                                <title><![CDATA[SWF Images]]></title>
                                <cacheKiller><![CDATA[true]]></cacheKiller>
                                <drawFrames><![CDATA[true]]></drawFrames>
                        </info>
                </item>
                <item container="imageContainer" src="flashassets/images/slideshow/1.jpg">
                        <info>
                                <title><![CDATA[Image 1]]></title>
                                <cacheKiller><![CDATA[true]]></cacheKiller>
                        </info>
                </item>
                <item container="null" src="flashassets/images/slideshow/2.jpg">
                        <info>
                                <title><![CDATA[Image 2]]></title>
                                <cacheKiller><![CDATA[true]]></cacheKiller>
                        </info>
                </item>
                <item container="null" src="flashassets/images/slideshow/3.jpg">
                        <info>
                                <title><![CDATA[Image 3]]></title>
                                <cacheKiller><![CDATA[true]]></cacheKiller>
                        </info>
                </item>
        </queueloader>

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

Wednesday, October 29th, 2008




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.

Monday, August 25th, 2008




HydroTween + HydroSequence rev37

UPDATE: rev39, synced up with the 0.5.0 updates. Matrix tweening and some bug fixes. Fixed callback error from previous updates

Fuse style functionality has been moved from HydroTween to a separate class called HydroSequence! This decision was made to offer an easier and more flexible way to control sequences by having clearer access to SequenceCA super methods. Also makes it easier to enhance the functionality of the sequencing parser. Here is the new syntax:

var seq1:HydroSequence = new HydroSequence(
    {target:fusebox, x:320, duration:1, easing:Quadratic.easeInOut},
    {target:fusebox, Blur_blurX:8, Blur_blurY:8, duration:1, easing:Quadratic.easeInOut},
    {target:fusebox, color:0×0000FF, duration:1, easing:Quadratic.easeInOut},
    {target:fusebox, Blur_blurX:0, Blur_blurY:0, duration:.8, easing:Quadratic.easeInOut},
    {target:fusebox, x:400, duration:.5, easing:Quadratic.easeInOut}
);

seq1.addItem([{target:fusebox, rotation:270, duration:3, easing:Quadratic.easeInOut}, {func:trace, args:["HELLO WORLD"]}]);

seq1.start();

Grouped Array targets are supported and the ability to add sequence objects with the addItem() method as well as using the constructor to create sequences.

In other news, I added a frame property to HydroTween which has been added to the demo swf here:

Also check out the GO Playground

Some extra advanced features from SequenceCA and beyond:

Duration Advance:

var goItem : HydroSequence = new HydroSequence(
        [
                {
                        target:target,
                        x:400,
                        y:40,
                        Blur_blurX:32,
                        Blur_blurY:32,
                        DropShadow_distance:16,
                        DropShadow_alpha:16,
                        rotation:180,
                        start_alpha:.5,
                        alpha:1,
                        scaleX:5,
                        scaleY:5,
                        color:0×0000FF,
                        useRelative:true,
                        duration:1, // Note Duration is 1. When this finsishes, it waits for the other group item.
                        easing:Quintic.easeIn
                },
                {
                        target:target2,
                        x:300,
                        Blur_blurX:0,
                        Blur_blurY:0,
                        scaleX:1,
                        scaleY:1,
                        color:HydroTween.RESET,
                        duration:1, // Note Duration is one, but…
                        repeater:new LinearGoRepeater(2), // Repeater creates a 1 second tween * 2.
                        easing:Quintic.easeInOut
                }
        ]);

// Here we add an advance property and instantiate an OnDurationComplete Object to tell
// the sequence to skip ahead after 1 second instead of waiting for the full duration of
// the sequence Object/item
goItem.addItem({target:[target,target2], advance:new OnDurationComplete(1), alpha:0, duration:6});
goItem.addItem({target:[target,target2], alpha:1, duration:1});
// Another grouped sequence Object/item with a function call
goItem.addItem([{target:[target,target2], x:10, duration:1},{func:trace, args:["Start x tween"]}]);
goItem.addItem({func:trace, args:["Sequence Complete"]});
goItem.start();


HydroTween + HydroSequence Source and Example
HydroTween + HydroSequence Source Only

Saturday, July 19th, 2008




QueueLoader rev33

UPDATE Latest Update and Source!

Made some fixes and updates per the helpful people on Google code as well as Richard Willis and Romuald Quantin. Google code site have been updated as well.

Thanks guys!


Wednesday, July 9th, 2008




Flashbelt 2008 + Animation to Go + HydroTween + Papervision3D

Getting ready to leave for MN and I'm very excited to be a part of Moses' presentation at Flashbelt 2008! I will be providing a brief introduction to HydroTween. HydroTween is a multi-purpose tweening parser that runs on top of the Go framework. If you are familiar with ZigoEngine, Fuse, or Tweener, then using HydroTween should be a seamless transition. In this post, you will find the examples shown during the presentation. I've also put together an online version of what I will be showing. I was hoping to also include a demonstration of the Making Things controller running a tween on a servo, but my laptop isn't being cooperative. I will provide a separate post with an update on that as well as a library I am working on for controlling modules.

Back to the subject at hand, here are the 3 examples that I will be showing. The first is an example of generic tweening with most of the basic properties, filters, and image/hsb tweening. The second is a Fuse type example using navigation with multiple tweening properties running at once. The last is a Papervision3D example that is tweening a number of properties including brightness. Thanks to Andy Zupko's heroic efforts of merging the GreatWhite and Effects branches of Papervision together, we have alpha and the other none-positioning properties at our tweening disposal for 3D objects!

Here is the link to the presentation along with the examples. - Click into the SWF, then use the forward and back arrows to navigate.

I also urge you to check out my previous post that has useful information and source examples, along with changes and important features that have been added. HydroTween will call you renderer for automatic updating of your Papervision scene by registering with HydroTween using the init3D() method. One important new addition is the ability to pass a DisplayObject3D target into this init method for automatic use of the lookAt() method.

Here is the link to the previous post with more information about using HydroTween.

If you'd like to go directly to the examples:
Generic HydroTween
Fuse Style Tweening
Papervision3D - Clicking on an image will bring it up.

Looking forward to seeing everyone there!

And of course, the source! I have included everything in the examples, including the presentation!


Flashbelt2008 HydroTween Source and Examples

Sunday, June 8th, 2008




Go 0.4.8jg1 + HydroTween rev30 + Guide + Source Code

The latest rev is 32. I have added the changes to this document in addition to the other updates.

Update 31d Fixed a bug from the removal of OverlapMonitor. Thanks John!

Update 32 Smoothness issue has been fixed with pulseInterval and example updated for 0.4.9. Start Values have been added for non-color/image matrix properties

Update 33 Made a couple updates and a post for the FlashBelt 2008 conference. A few more examples. I also added a DisplayObject3D target argument in the init3D() method for running a lookAt() during scene renders. Click here for the recent post.

// Color Tweening!
HydroTween.go(mc, {color:0xFF0000}, 2, 0, Elastic.easeOut);

// Fuse style sequencing!
var seq1:SequenceCA = HydroTween.parseSequence(
        {target:fusebox, x:320, seconds:5, easing:Quadratic.easeInOut},
        {target:fusebox, Blur_blurX:8, Blur_blurY:8, seconds:5, easing:Quadratic.easeInOut},
        {target:fusebox, color:0×0000FF, seconds:5, easing:Quadratic.easeInOut},
        {target:fusebox, Blur_blurX:0, Blur_blurY:0, seconds:5, easing:Quadratic.easeInOut},
        {target:fusebox, x:400, seconds:.5, easing:Quadratic.easeInOut},
        {target:fusebox, rotation:270, seconds:.5, easing:Quadratic.easeInOut}
);
seq1.start();

After a short hiatus from the blog, and a wedding, I've been able to knock out some much needed changes and additions to HydroTween. I'm excited about this because now I can move onto the fun stuff and I've started putting together a roadmap of sorts. Go has been picking up steam and examples have been popping up which is great to see. Most people seem to think there are two types of users of Go. The ones that simply want to tween away, have something functioning, and useful right away. The other types are interested in developing their own tweening system and animation utilities either for all around use or for specialized applications. I'm excited about the 3rd group which falls in the middle. These are the people that want the first, but find themselves becoming the latter just because of the Methodology of Go. I used to be in the first group for quite some time until Go came along and then I found myself thrown intro the world of tweening. I've been saying this for some time now, but the beauty of Go is that you might find yourself in the middle with very little effort. Once you it that point, consider yourself an addict. This post should help with a general understanding of HydroTween. I also hope this post will open some eyes to the idea of going it along and giving their own parser a shot. That said I will start with the usage of HydroTween and it's updates, then I will follow with my own trial and tribulations of reaching this recent version. The example below along with the source is located at the end of this post.

Click here for the Go Project Site - Go Project Site

Click here for the Go Playground Project Site - Home of Parsers/User Generated Go projects and examples.



Current Tweenable Properties:

  • alpha
  • Bevel_angle
  • Bevel_blurX
  • Bevel_blurY
  • Bevel_color
  • Bevel_distance
  • Bevel_highlightAlpha
  • Bevel_highlightColor
  • Bevel_quality
  • Bevel_shadowAlpha
  • Bevel_shadowColor
  • Bevel_strength
  • Blur_blurX
  • Blur_blurY
  • Blur_quality
  • brightness
  • color
  • contrast
  • DropShadow_alpha
  • DropShadow_angle
  • DropShadow_blurX
  • DropShadow_blurY
  • DropShadow_color
  • DropShadow_distance
  • DropShadow_quality
  • DropShadow_strength
  • Glow_alpha
  • Glow_blurX
  • Glow_blurY
  • Glow_color
  • Glow_quality
  • Glow_strength
  • height
  • hue
  • pan
  • rotation
  • rotationX (PV3D)
  • rotationY (PV3D)
  • rotationZ (PV3D)
  • saturation
  • scaleX
  • scaleY
  • scaleZ (PV3D)
  • text
  • tint
  • volume
  • width
  • x
  • y
  • z (PV3D)

What's new in this version:

  • Image/Bitmap/ColorMatrix property refactoring such as contrast, brightness, etc. Color tweening has been added as well. Worked out some bugs and streamlined.
  • Fuse style sequencing.
  • An autostart parameter.
  • Updated reverse and cycle structure.
  • Started porting over the previous textfield tweening functionality.
  • Tweening of multiple targets as Arrays
  • Papervision3D tweening functions
  • start_ values for non image/color matrix tweening. (This will be addded soon!)

Autostart:
Autostart has been deprecated from version 30. In version 31, go calls() and sequence() methods start automatically. To setup a sequence that doesn't start, use the parseSequence() method.

LinearGoRepeater:
The static go() method and the constructor have been updated to reflect the changes in version 0.4.8. An object has been added that provides parameters for cycling back and forth. You can either input a LinearGoRepeater instance, or you can use a generic object.

HydroTween.go(mc,  tweenObj[e.target.name], seconds, 0, easing, null, null, null, {cycles:2, reverse:true, easing:easing});

Fuse style Sequence Tweening:

// This sequence will start automatically.
var seq1:SequenceCA = HydroTween.sequence(
        {target:fusebox, x:320, seconds:5, easing:Quadratic.easeInOut},
        {target:fusebox, Blur_blurX:8, Blur_blurY:8, seconds:5, easing:Quadratic.easeInOut},
        {target:fusebox, color:0×0000FF, seconds:5, easing:Quadratic.easeInOut},
        {target:fusebox, Blur_blurX:0, Blur_blurY:0, seconds:5, easing:Quadratic.easeInOut},
        {target:fusebox, x:400, seconds:.5, easing:Quadratic.easeInOut},
        {target:fusebox, rotation:270, seconds:.5, easing:Quadratic.easeInOut}
);
// This sequence will NOT start automatically. Allows you to create sequences and store them
var seq2:SequenceCA = HydroTween.parseSequence(
        {target:fusebox, x:320, seconds:5, easing:Quadratic.easeInOut},
        {target:fusebox, Blur_blurX:8, Blur_blurY:8, seconds:5, easing:Quadratic.easeInOut},
        {target:fusebox, color:0×0000FF, seconds:5, easing:Quadratic.easeInOut},
        {target:fusebox, Blur_blurX:0, Blur_blurY:0, seconds:5, easing:Quadratic.easeInOut},
        {target:fusebox, x:400, seconds:.5, easing:Quadratic.easeInOut},
        {target:fusebox, rotation:270, seconds:.5, easing:Quadratic.easeInOut}
);
seq2.start();

Tweening Examples:


F.Y.I. The flash interface/example above will copy the code to the clipboard.

General:

HydroTween.go(mc, {x:400}, 2, 0, Elastic.easeOut);

Filter:

HydroTween.go(mc, {Glow_color:0×0000FF, Glow_blurX:8, Glow_blurY:8, Glow_strength:3}, 2, 0, Elastic.easeOut);

Image/Bitmap/ColorMatrix:

// Brightness
HydroTween.go(mc, {brightness:2}, 2, 0, Elastic.easeOut);
// Contrast
HydroTween.go(mc, {contrast:2}, 2, 0, Elastic.easeOut);
// Hue
HydroTween.go(mc, {hue:45}, 2, 0, Elastic.easeOut);
// Saturation
HydroTween.go(mc, {saturation:-1}, 2, 0, Elastic.easeOut);
// Tint
HydroTween.go(mc, {tint:0×00FF00}, 2, 0, Elastic.easeOut);
// Color
HydroTween.go(mc, {color:0xFF0000}, 2, 0, Elastic.easeOut);
// Color Reset (This will tween back to it's original value
HydroTween.go(mc, {color:-1}, 2, 0, Elastic.easeOut);

Matrix tweening (for array values such as sepia, etc) should make a return in the next update as well as a tint percentage value.

Sound:

// Volume
HydroTween.go(soundchannel, {volume:.1}, 2, 0, Elastic.easeOut);
// Contrast
HydroTween.go(soundchannel, {pan:-1}, 2, 0, Elastic.easeOut);

Sound tweening takes the SoundChannel instance as a target.

Text:

HydroTween.go(textfield, {text:100}, 2, 0, Elastic.easeOut);

This simply tweens the number from 0 to whatever param is specified and outputs to a textfield. I hope to expand on the functionality of this soon.

Using Callbacks and Updaters:

// Complete Callback
HydroTween.go(textfield, {text:100}, 2, 0, Elastic.easeOut, onCompleteHandler);
// Update Callback
HydroTween.go(textfield, {text:100}, 2, 0, Elastic.easeOut, null, onUpdateHandler);

Papervision3D Tweening:

I have added a convenient function for setting up your renderer for HydroTween. This is called once before you call any tweens and runs the renderer during any tween.

// Call once to setup a 3D tweens renderer
HydroTween.init3D(renderer, scene, camera, viewport);
// Simple Papervision3D Tween
HydroTween.go(plane, {rotationX:100, z:500}, 2, 0, Elastic.easeOut);

Also be sure to check out John Grden's kickass Go3D parser.


Roadmap and upcoming updates:

  • Text tweening to support prefix and suffix String values
  • Even more modular format for adding tweenable properties
  • Drawning and spline/bezier tweening/Catmull Rom/etc
  • Continuing with speed enhancements

The Making of HydroTween


For those of you interested in setting up your own tweening parser, hopefully this section will offer some insight. Getting these updates was a bit of a challenge and I learned quite a bit. Because of this, I think my ultimate vision for HydroTween has changed a bit. With the flexibility Go offers, the task of how to manage tweens and properties falls in the hands of the Go practitioner. The efficiency of a tweening engine really boils down to the simplicity of it's core and the reading and routing of updating property values. How this is achieved can explain the large number of different tweening systems out there. My hope is to eventually set up HydroTween to extend the open foundation of the Go system to it's tweenable properties making them more modular and easy to tweek. Let's forget about how the Go core engine works for a minute and look at the bare bones processes invloved in tweening.

  • First we need some way to parse a syntax of our choosing.
  • We need to keep track of where/what the end result of our tween will be.
  • We need to figure out the starting value of the tween.
  • We need to figure out the difference of the starting and ending value.
  • We need to update the values of that difference over a period of time.
  • We need to route the updated values to the tweens target based on the type of property that's being tweened.

This is a very general idea of what's going on here. Now some of the above has been taken out of the equation and/or made easier to accomplish. The parsing is being left up to us, along with how we store and route the updating property values. We have a place to figure out the starting point as well as where to update the data. The trick is how to do it.

I've found that most tweenable properties fall into a few categories:

Some are direct properties of an object, such as the x value of a Sprite.

// Normal syntax:
sprite.x = 1;
// "Tweenable" syntax:
sprite["x"] = 1;

Some are done through object's filters, such as BlurFilter and DropShadow.

// Normal syntax:
var gf:GlowFilter = new GlowFilter();
gf.color = 0xFF0000;
box.filters = [gf];
// "Tweenable" syntax:
box.filters = [new GlowFilter()];
var f:Array = box.filters;
f[0]["color"] = 0×0000FF;
box.filters = f;

Some are done through a transform property, or a combination of transform properties, such as volume or some color changing.

// Normal syntax:
var tf:* = targ.soundTransform;
tf.volume = val;
targ.soundTransform = tf;
// "Tweenable" syntax:
var tf:* = targ["soundTransform"];
tf["volume"] = val;
targ["soundTransform"] = tf;

The above examples are straight forward, but they point out the process of parsing. We are using a String reference to the Objects property which allows us to match it up in our property list. This is where we define our syntax and essentially becomes our "key". Every key in our parser must be unique so we can match up a respective property. In the case of blurX, we have to specify that it is either the BlurFilter, GlowFilter, etc. So Blur_blurX is added to a key/property list which matches that property with the functions needed to update the BlurFilter and target in the Objects filter Array.

Some use a combination of Filter and Matrix math such as contrast, color, hue. Some use value pairs, such as drawing. The rest I have found use either a single or double value, along with some constants such as spline animation, text, etc. You can refer to the source for the more complicated examples as they require a couple extra steps. Just to give you the general idea. With ColorMatrix we are tweening an entire array of values. What HydroTween does is depending on the property settings, an "adjustment" function is called. This changes the end values for the array, and the write function updates the entire array from point A to B. Since an Object can have multiple ColorMatrix adjustments made to it, we need to call these first before running the tween. Thanks again to Grant Skinner for letting me import and tweek his ColorMatrix class.

All of these items are easy to tween in their own right, but when you combine them all together, that's when things get tricky. I've organized my functions in a read, write, and for some an adjust and path category. "Read" simply gets the objects existing state, "write" updates the objects property value, "adjust" modifies a property prior to writing it (such as ColorMatrix transformations of a ColorMatrix Array before tweening it), and "path" is a param that accesses an objects property.

My goal now is to continue to make this more efficient and modular in a way that the average user can create a read function, a write function, and register it to the property list along with any additional params it might need. It's sorta there, but there is much work to be done:)

I'm still no tweening Jedi and this is an ongoing work in progress. Any suggestions, complaints, and contributions are welcome.

Also I will be at Flashbelt. Hit me up if you are interested in meeting up. Looking forward to Moses' presentation!


HydroTween rev32 Source and Example

Tuesday, May 13th, 2008




QueueLoaderLite

Updated the code

I've stripped down some of the heavier features for an alternate "lite" version for those wishing a bare bones QueueLoader with low file size. QueueLoader will continue to thrive and there are some enhancements to the regular version that will be made shortly.

The lite version is focused exclusively on image and swf asset loading. Application Domain/Loader Context is still there so you can load other items within a swf and have access to its class references in the library. I will add another guide page on the Google page shortly. I'm including all the listening function in the example below just so you can see it in action, but any/all of them can be removed. More examples and documentation on this version to come, but in the meantime… Basic usage:

import com.hydrotik.utils.QueueLoaderLite;
import com.hydrotik.utils.QueueLoaderLiteEvent;

var qlLoader:QueueLoaderLite = new QueueLoaderLite();

var imageContainer:Sprite = new Sprite();
addChild(imageContainer);
imageContainer.name = "image";

qlLoader.addItem("../flashassets/images/slideshow/1.jpg", imageContainer, {title:"image"});

qlLoader.addEventListener(QueueLoaderLiteEvent.QUEUE_START, onQueueStart, false, 0, true);
qlLoader.addEventListener(QueueLoaderLiteEvent.ITEM_START, onItemStart, false, 0, true);
qlLoader.addEventListener(QueueLoaderLiteEvent.ITEM_PROGRESS, onItemProgress, false, 0, true);
qlLoader.addEventListener(QueueLoaderLiteEvent.ITEM_COMPLETE, onItemComplete, false, 0, true);
qlLoader.addEventListener(QueueLoaderLiteEvent.ITEM_ERROR, onItemError, false, 0, true);
qlLoader.addEventListener(QueueLoaderLiteEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
qlLoader.addEventListener(QueueLoaderLiteEvent.QUEUE_COMPLETE, onQueueComplete, false, 0, true);

qlLoader.execute();

function onQueueStart(event : QueueLoaderLiteEvent):void {
        trace("** "+event.type);
}

function onItemStart(event : QueueLoaderLiteEvent):void {
        trace(">> "+event.type, "item title: "+event.title);
}

function onItemProgress(event : QueueLoaderLiteEvent):void {
        trace("\t>> "+event.type+": "+[" percentage: "+event.percentage]);
}

function onItemComplete(event : QueueLoaderLiteEvent):void {
        trace(">> name: "+event.title + " event:" + event.type+" - "+["target: "+event.targ, "w: "+event.width, "h: "+event.height]+"\n");

}

function onItemError(event : QueueLoaderLiteEvent):void {
        trace(">> name: "+event.title + " event:" + event);
}

function onQueueProgress(event : QueueLoaderLiteEvent):void {
        trace("\t>> "+event.type+": "+[" queuepercentage: "+event.queuepercentage]);
}

function onQueueComplete(event : QueueLoaderLiteEvent):void {
        trace("** " + event.type);
}

And for instantiating library assets in an external swf library:

import com.hydrotik.utils.QueueLoaderLite;
import com.hydrotik.utils.QueueLoaderEventLite;

var addedDefinitions:LoaderContext = new LoaderContext();
addedDefinitions.applicationDomain = ApplicationDomain.currentDomain;

var qlLoader:QueueLoaderLite = new QueueLoaderLite(false, addedDefinitions);

var soundSWF = new MovieClip();
soundSWF.name = "externalSounds";
addChild(soundSWF);

var soundChannel:SoundChannel = new SoundChannel();

qlLoader.addItem(prefix("") + "flashassets/swf/externalsounds.swf", soundSWF});
qlLoader.addEventListener(QueueLoaderLiteEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
qlLoader.execute();

function onQueueComplete(event:QueueLoaderLiteEvent):void {
        trace("** "+event.type);
        var Loop1Reference:Class = getDefinitionByName("Loop1″) as Class;
        var loop1:Sound = new Loop1Reference();
        soundChannel = loop1.play();
}


QueueLoaderLite Source

Tuesday, March 11th, 2008




Go 0.4.4 + HydroTween + Guide + Source Code

The example above is included in the source at the bottom of the post.

Continuing with the adventure that is Go, I have added tinting, brightness, contrast, hue, saturation, and a lineTo feature. Grant Skinner was kind enough to let me peel some code from his ColorMatrix class. Just to reiterate, I am not a tweening guru. I have an increased respect for people such as Moses, Ryan Taylor, Jack Doyle, Zeh Fernando, and anyone else crazy enough to enter the world of tweening. Tweening engines become incredibly complicated when you start dealing with how properties are organized and how to get the most speed out of the system. That being said I think it is a testament to the Go architecture that I was able to get such a universal tweening class running on Go in such a short time. I should also state that HydroTween is not a tweening engine. HydroTween sits on top of Go and simply allows you to create your own syntax and system for parsing the properties you wish to tween.

I know there is a mad race with who has the fastest tweening system and even more so since the release of TweenBencher. I'm sure the #1 spot will continue to change. This is great as it will push the most out of every system. Because of the way Go is set up, anyone can enter. I've set up HydroTween so it uses syntax similar to Zigo/Fuse with a couple tweaks. HydroTween doesn't have sequencing capabilities yet, but that will come soon along with start properties and property overlap. I put together an example above and the list below of how to use HydroTween with its current properties.

If you've played with HydroTween before, I've taken the liberty of slightly changing the property key structure by doing away with leading underscores in keeping with AS3's format. I've also grouped contrast, matrix, brightness, hue, and saturation into it's own object. Here's a simple code example of how HydroTween currently works:

HydroTween.go(mc,
                {
                        x:400,
                        y:150,
                        scaleX:.6,
                        scaleY:.6,
                        image{contrast:2, saturation:50},
                        DropShadow_strength:1,
                        DropShadow_distance:16,
                        rotation:270
                       
                }, 2, 0, Elastic.easeOut, null, null, null, 2, Elastic.easeOut);

The guide above shows most of the features in HydroTween. When you tween an example, the code is pasted into system memory in case you want to

HydroTween.go(copy_tf,  {alpha:1}, 2, 2, Quartic.easeInOut);

HydroTween.go(
        target, // Target DisplayObject
        propsToObject, // {x:10, y:10} Contains the tweening properties and values
        seconds, // tweening duration in seconds
        delay, // tweening start delay in seconds
        easingFunction, // Easing function i.e. Quadratic.easeOut
        onCompleteHandler, // Function called when tween completes
        onUpdateHandler, // Function called on each update i.e. a screen rendering function
        extraEasingParams, // Additional arameters for the easing function
        loopCycles, // Number of times the Tween plays back and forth
        cycleEasing // Easing function for the additional cycles
);

/*
Filter Properties:
Bevel_angle
Bevel_blurX
Bevel_blurY
Bevel_color
Bevel_distance
Bevel_highlightAlpha
Bevel_highlightColor
Bevel_quality
Bevel_shadowAlpha
Bevel_shadowColor
Bevel_strength
Blur_blurX
Blur_blurY
Blur_quality
DropShadow_alpha
DropShadow_angle
DropShadow_blurX
DropShadow_blurY
DropShadow_color
DropShadow_distance
DropShadow_quality
DropShadow_strength
Glow_alpha
Glow_blurX
Glow_blurY
Glow_color
Glow_quality
Glow_strength
*/

HydroTween.go(copy_tf,  {
        Glow_color:0×00FF00,
        Glow_blurX:8,
        Glow_blurY:8,
        Glow_alpha:1,
        Glow_strength:3
}, 2, 2, Quartic.easeInOut);

/*
Transform Properties:
{prop:value …}
volume
pan
*/

HydroTween.go(sound{
        volume:0
}, 2, 2, Quartic.easeOut);

/*
Tint Properties:
{tint:{prop:value …}}
color
percent
*/

HydroTween.go(mc,  {
        tint:{color:0xFF0000, percent:.9}
}, 2, 2, Quartic.easeOut);

/*
Image Processing Properties:
{image{prop:value …}}
matrix
brightness
contrast
saturation
hue
*/

HydroTween.go(mc,  {
        image:{brightness:1, contrast:.9}
}, 2, 2, Quartic.easeOut);

/*
Text Properties:
{text{prop:value …}}
text
text_prepend
text_append
*/

HydroTween.go(textfield{
        text_prepend:"VOTES: ", // String that comes before tweening number
        text:1000 // A number that is tweened within the string
}, 2, 2, Quartic.easeOut);

/*
Line Properties:
{lineTo{prop:value …}}
x
y
thickness
color
*/

HydroTween.go(textfield{
        lineTo:{
                x:580,
                thickness:2,
                color:0xFF0000
        }
}, 2, 2, Quartic.easeOut);


HydroTween 0.4.4 Source and Example

Wednesday, February 27th, 2008










July 2009
M T W T F S S
« Jan    
 12345
6789101112
13141516171819
20212223242526
2728293031  
  • Archives

  • Other

  • Syndication