Archive for the ‘Tutorials’ category

Good-bye QueueLoader. Hello LoaderMax.

February 17th, 2011

A few years ago while I was making the switch from Actionscipt 2 to Actionscript 3 I discovered the power of sequential loading. To illustrate what sequential loading IS NOT I want you to think of a website that you’ve been to and it seems like it takes way to long to view the next image or next bit of content. Or you go to a site and it takes the page forever to load and slowly all the images start to load and there’s a bit or waiting. Well it’s the waiting that drove me nuts. Even to this day if I go to some slick website and it takes seconds for each image to load when I click the next button I get angry.

The solution is sequential loading. Loading one asset (often images) after the other. The idea behind it is that you’re internet connection will consume the first image quickly (with nothing else demanding it’s attention), and then moving on the next, and the next, next…

To do this I’ve been using Hydrotik’s QueueLoader. Which has served me well and has been the base of a lot of projects, but a new kid in the bulk loading crowd surfaced (Greensock’s LoaderMax) a while back and I decided to give it a try. And I tried several times to see if I could utilize it but each time failed. Until recently. The other day I tweeted that I was a looser when it came to LoaderMax, and Jack Doyle (Mr. Greensock himself and the author of all things flashtastic) emailed me seeing how he could help. And help he did.

I sent him a base file using QueueLoader that is similar to all the files I’ve built using QueueLoaer and Jack sent me back a sleek file that replace QueueLoader with LoaderMax.

I know I’m a bit of a dummy and still code on the first frame of my fla’s, but Jack showed me how to get LoaderMax running and working right. Below is the file he sent me using LoaderMax. I thought it might be useful to post the code and sample files here (for anyone searching the topic) and also to say thank you to Jack. I’m really looking forward to tapping into the power of LoaderMax.

Controlling Loaded SWFs from the Base Timeline in AS3

March 3rd, 2008


I stumbled onto a new problem that switching to Actionscript 3 has caused me. The basics of it are trying to control timelines or movieclips of swfs I loaded into another movie. In the past with actionscript 2 the way I’d work things was create a base flash file and from there load the bits and pieces (other swfs) that made up the flash site. There are a few reasons behind this thought: On one hand your base file stayed pretty small in file size and loaded quickly; on another the visitor only downloads the portions of the site need (instead of downloading the whole shebang). Think modular like legos. No need for the whole bucket of parts when 5 to 6 pieces complete the space cruiser.

Anyway, the old method in AS2 was easy you simple targeted the movieclip you loaded the swf file into and then could easily control the timeline or have the objects to do whatever you wanted them to ( In AS3 it’s not the same.

I’ve created a simple file of how I’ve figured out how to do it. The short and easy of it is you have to create an object that’s defined by the loader that you create to load your swf file into. Once you look at the sample files it’ll make more sense.

The ZIP contains 3 flash movies “the_base.swf”, “soundfx.swf”, and “buttons.swf.” The “the_base.swf” basically loads the other two files and contains all the actionscript that controls the other two movies.

FlashVars and Getting Them to Work in AS3

February 18th, 2008

As I’ve been making the transition to Flash Actionscript 3 (AS3) I’ve discovered that there are somethings that used to be so easy in Actionscript (AS2) that have become a major choir to figure out in AS3. So in an effort to help anyone else who might be making the transition from AS2 to AS3 here’s another group of source files that detail how to get FlashVars working in AS3.

A basic understanding of FlashVars is it was a simple way to import values into a flash movie. For example I often would create a flash movie and set up some variables that changed via the FlashVars (like a movie clip color, url, or text). To make a change to the project rather than opening the flash file, editing the file, then re-export the code, I could simply update a short line of flashvars in the html code and the changes were reflected the next time the flash movie was run. Actionscript 3 seems to have done away with FlashVars, but this doesn’t mean you can’t store your variables elsewhere and import them.

My example that I’ve linked to at the bottom of this post is a classic example. The main movie (text_file_variables.fla) contains three buttons each linking to a website. The convenient part is the website urls are defined in the text file (variables.txt). Change the text file and the buttons redirect you to the newly changed url. The flash file is pretty well documented with what’s been done. I hope it saves someone time trying to figure it out.

Download the source files.


Spending a couple days in flash you learn a ton. I figured out a way to create the same file without having to have more than one frame in the timeline. Basically everything that was on frame 2 (anything that was determined by the variables in the text file) is inside the function that gets triggered after the text file is loaded (after addEventListener(Event.COMPLETE, dataOK)). I’ve updated the file below to reflect the one frame code version.

Download the UPDATED source files here.

Actionscript 3: Redux

October 12th, 2007

Getting a handle on Flash with Actionscript 3 has not been an easy task to say the least. To accomplish the simplest of objectives is still pretty difficult, but I have learned quite a bit and am on my way to flash guruness again. So to aide any other poor soul out there who is trying to make the jump to AS3 here are a few helpful thoughts.

I recommend Flash CS3 Professional Advanced by Russell Chun. I bought a previous version of this book a couple years back to learn Flash and felt a little like a Flash newbie walking out of Barnes and Noble with it again, but with Actionscript 3 it’s seriously like starting all over with coding in Flash. This book has been great. I also picked up the Actionscript 3 Cookbook and it’s pretty good too, but to be noted the code in this book has been written from the standpoint that you’re using Flex (not flash) to author swfs (who does that?). It’s still been helpful but I was slightly disappointed it’s targeted more towards Flex users.

Since being introduced to tweening a couple years back it’s been a must have on every project. Unfortunately, the previous method of tweening (in AS2 I used LacoTweens) does not work in Actionscript 3 projects. Flash does have a built in tweener that can get ugly to use, but among my many google searches I stumbled across an Actionscript 3 tween engine. This site has a Tweening engine that does everything the old lacoTweens would do, and the author wrote the engine with the objective of cutting the overall size of the exported swf file. It’s worth checking out.

The biggest concern I have had with moving to Actionscript 3 was being able to use flash to fill the whole browser (often called full browser flash). Since this is the basis of almost all my flash sites figuring this out was essential. You’d think it’d be a piece of cake but not so. It took me several hours and looking for help on the intertubes proved to be very little help. The problem lies in the change that’s happened with the Stage in Actionscript 3. Gone are the good old days of using the Stage and the Stage properties to position movieclips (movie_mc._y=Stage.height-100). After a lot of tweaking and googling I’ve come up with an alternative and have uploaded a sample file that anyone who is interested can download and view the source code. I’ve made some notes in the code to help explain what’s going on. It’s not the prettiest but it’s just an example. Click here to download the source files and click here to see the file in action.


December 5th, 2006

This is a heads-up to all you flashers out there. In the past I’ve worked on a couple projects that involve flash and secure websites. One of the biggest thorns in my side was whenever I viewed the secure flash login/site (https) in internet explorer I’d get this warning saying that the page “contained both secure and nonsecure items”. If I chose to not display the nonsecure items the website looked and behaved completely the same as with those “nonsecure” items. Well today I figured out the answer and the fix. You can read all about the fix on Adobe’s site, but basically you just need to change the EMBED tag that points to “http://download.Macromedia…” to “https://download.Macromedia…”. Now you know and knowing is half the battle.