This blog has moved to a new location!

Tuesday, October 19, 2010

Understanding the AS3 Event System #3 - Easy Event Bubbling

This post can be found on the new blog at Understanding the AS3 Event System #3 - Easy Event Bubbling
This thread is part 3 in a "Understanding the AS3 Event System" series. It continues on the "office" illustration used in parts #1 and #2. If you have not read part 1, it is recommended that you do so:

This part describes how "Event Bubbling" works. Note that this is a strong simplification of the actual system (which is a bit more complex, but in the next part I will elaborate on that system), but for 99% of all Event uses, this is the only thing you really need to know about Event Bubbling.

At the office I work, a large part of our work system is set up as a hierarchy of responsibility and work delegation.

The Corporate Ladder
At the very top of the tree is Mr. Stan Stage. He's a great guy. Very friendly, a nice father figure, and a really good boss. He is the boss of all bosses, and in the end, everyone reports to him.

Since there is so much information passed around the office each day, he delegates a lot of the tasks to a handful of people who work right under him. These people are all "second in command". One of these second in command is my boss. Unlike Mr. Stage, my boss is very annoying and difficult, and to avoid his wrath, I will exclude his name, and instead just call him "My Boss".

My Boss has about 20 people working under him, including me. It's not a great position to be in, but it's still a very rewarding job. Some of us "third in command" workers have people working directly under us.

I am one of the lucky ones, and have five interns working directly for me. Since I am their boss, they obey my every whim, such as getting coffee for me each morning, or taking out my dry-cleaning. Even though they are only interns, they are still considered to be "fourth in command".

Since a great deal of what we do at the Office is reported via Events, my interns are expected to use the event system to report any changes just like the rest of us.

For efficiency's sake, my five interns have their desks very close to my cubicle, so whenever they dispatch an event (by standing up and shouting for example "I was hovered!") I hear it immediately.

Now, there are two types of Events. Events that Bubble, and Events that do not Bubble.

Non-Bubbling Events
Some Events are only important to the person which it actually happened to. For instance, one day one of my interns, Chris, stands up and yells "Hey everyone, I got a new car!"
dispatchEvent(new Event("new_car"));

A few of my other interns reacted. However, I honestly did not care. My Boss sure as hell doesn't care. And as nice of guy Steve Stage is, he really doesn't care either.

I'm not saying that Chris's Event wasn't important, in fact, it was quite important since it allows him to do his job better and will definitely affect his work. However, there is no need to tell as many people about it as possible. The only people who need to know about the event are people who specifically asked Chris to let them know whenever he got a new car.
chris.addEventListener("new_car", talkToChrisAboutTheCar);

Those Events do not Bubble up the corporate ladder.

Events that Bubble
Now, clicks are VERY important in my line of work (in fact, that's how we get paid).

We want to let as many people as possible who want to know about the clicks to know about the clicks, but if every single person just stood up and yelled "Someone was clicked!" whenever they found out about it, it would be one disorganized mess and you would hear about the same gossip from 8 different people. Instead, we have an organized system for letting everyone  in charge know about it.

Bubbling Events up the Ladder
One day Chris stands up and yells out to everyone "I was clicked!" (dispatching the event to everyone that may be listening to him. Not many people are usually listening to Chris (in fact, most people at the office don't even know any of my interns). So, Chris tells everyone listening to him about the click event.

Then Chris walks over to me and says "Andreas. I was clicked. All the information on the click is available in this file folder."

Now it's my turn. I stand up and yell "I was clicked!" (I could tell them "someone in my department was clicked", but since my interns work for me so closely, their work is considered to be part of my work) A few people are listening to me for the "clicked" event, (including Nico and Bob) and walk up to me asking for more information. I give them both the file so they have all the information on the event that they need.

Then, I barge into the office of my Boss, telling him all about the event, and handing him a copy of the information. He in turn switches on his fancy intercom system (since he is second in command, he gets certain perks, and is paid too much to have to yell across the hallway) and announces to everyone in the office "Attention anyone who is listening to me. I was just clicked." A few people are listening to him, and respond.

Finally, my Boss knocks on the door of Steve Stage and tells him all about the click event. Now, at last, Mr. Stage announces the click event for the last time, telling everyone who is listening to him about the click.

After that it is done. Everyone who needs to know about the event knows about it.

Now why is Bubbling so important?
Let's take the example of Betty, who works in accounting. In order to do her job property, she needs to know about every single time a client "clicked" an employee.

She could listen to every single employee for the "click" event, but this is a VERY inefficient system. And every time there is a new employee she would need to start listening to them, and when an employee leaves, she needs to remember to stop listening to them.

Instead, because of our nifty little bubbling system, Betty ONLY needs to listen Stage for the "click" event. Since those events bubble up to Steve, she will be notified of every single click event directly from Steve Stage.

EXTRA NOTE: Events only bubble upwards
Let's say one day I'm working at my desk, when a client clicks me directly instead of clicking one of my interns. I stand up and yell to everyone who is listening to me that "I was clicked", but I do not need to directly tell any of my interns about the click. Unless my interns are specifically listening to me, they will not know about the click and will keep carrying on their work undisturbed. The interns will NOT dispatch any "click" event either.

The only one who needs to know is My Boss. The events only bubble "up" the corporate ladder, not down.

So who was clicked first?
In order to file the proper paperwork (and hand out promotions or raises where needed) Betty needs to know exactly which person it was who was "clicked" first. Luckily, all this information is perfectly filled out in the Event object (the folder containing all the information).

There are two names in the Event object, "target" and "currentTarget". Flash assigns these two names automatically when the Event is dispatched.

These two properties tend to cause a lot of confusion among beginners. Sometimes they refer to the same person, sometimes they do not. To explain the difference, let's take another example.

Nico is listening to me for the "clicked" event.
andreas.addEventListener("clicked", onClick);

Chris, my intern, is clicked, and stands up and tells everyone about it. Nico doesn't even know Chris and therefore doesn't even know about the event. Chris tells me about the event and hands me all the information.

Now, I stand up and tell everyone "I was clicked". Nico is listening for the event, and walks over to me to gather all the information.

Then the event continues to bubble upwards to My Boss and finally Stan Stage.

target refers to the person who first dispatched the event. In this case, Chris would be the target.
currentTarget refers to the person you were listening to who told you about the event.

Think about "currentTarget" for a second. For Nico, currentTarget would refer to me, Andreas. However, since Betty is listening to Stan Stage for the Event, the currentTarget property in her event file would refer to Mr. Stage.

Using currentTarget to your advantage
Why does the "currentTarget" property even exist? I mean if you added the event listener to an object, of course you know what that object is, and therefore the property is pretty much worthless.

However, if used properly, it can save you a lot of code! For instance, perhaps you have several buttons on the stage "homeButton", "aboutButton", "contactButton", "newsButton", etc. You want the button to scale up when it is clicked. You could add the event listeners like this:

homeButton.addEventListener(MouseEvent.CLICK, homeButtonClicked);
aboutButton.addEventListener(MouseEvent.CLICK, aboutButtonClicked);
contactButton.addEventListener(MouseEvent.CLICK, contactButtonClicked);
newsButton.addEventListener(MouseEvent.CLICK, newsButtonClicked);

function homeButtonClicked(mev:MouseEvent):void
   homeButton.scaleX = 1.2;
   homeButton.scaleY = 1.2;

That means, creating a different handler function for each button, which works, but creates a lot of extra code. Then if you want to change details of what happens when a button is clicked, you would need to update every single function.

Instead, you can create one single function which handles the clicks of all buttons. You can calculate which button needs to be pressed by using the "currentTarget" property.

homeButton.addEventListener(MouseEvent.CLICK, navigationButtonClicked);
aboutButton.addEventListener(MouseEvent.CLICK, navigationButtonClicked);
contactButton.addEventListener(MouseEvent.CLICK, navigationButtonClicked);
newsButton.addEventListener(MouseEvent.CLICK, navigationButtonClicked);

function navigationButtonClicked(mev:MouseEvent):void
   var pressedButton:DisplayObject = mev.currentTarget as DisplayObject;
   pressedButton.scaleX = 1.2;
   pressedButton.scaleY = 1.2;

Which uses only a single function! Now, if you need to change the scaling to 1.3, you only have to update it in one single place!

If you want to attach additional properties to the buttons, (such as setting some custom scale value for each button) you can use the Dictionary object. Look in the FAQ under the appropriate category for links to explanations and example code:

This is how Flash bubbles it's events. Next step, how to make your own events bubble.

Tuesday, October 12, 2010

Understanding the AS3 Event System #2 - Custom Events

This post can be found on the new blog at Understanding the AS3 Event System #2 - Custom Events
This thread is part 2 in a "Understanding the AS3 Event System" series. It continues on the "office" illustration used in part 1. If you have not read part 1, it is recommended that you do so:

I originally wrote this thread as a response to a Kirupa forum thread:

This is my first draft, so any opinions or thoughts are deeply appreciated, especially if there is anything you still don't fully understand or would like me to clarify further.

Listen, don't tell my boss, but those days when work gets slow, I fire up some StarCraft! StarCraft is no fun alone, so Nico, Bob, Larry, and I all play against eachother. The problem is that we all need to be logged on at the same time in order to play together. I'm the one who plays the most, so I am the "Game Master" - the one who starts up the server, chooses a map, and waits for everyone else to join in.

We need some way to alert eachother when I start up a StarCraft game, AND keep it a secret from my boss (he reads all our emails, so I can't tell them via email). So, we use the Event system!

Custom Event Strings
We have planned that whenever I am about to start up a new game, I stand up and yell out to everyone "I am about to call Yamato!" (who our boss assumes is one of my Japanese clients)

Everyone knows that the custom event string (or event type) for when everyone listening should play starcraft is "Yamato". So, ahead of time, Nico, Bob, and Larry listen for my "Yamato" event:

homeButton.addEventListener("Yamato", startPlayingStarScraft);
Now, we may start playing dozens of different games, and I have chosen a different "code name" as the event string for each type of game:
homeButton.addEventListener("MarcoPolo", startPlayingAOE);
homeButton.addEventListener("Gelinor", startPlayingRuneScape);
homeButton.addEventListener("Germany", startPlayingCOD);
homeButton.addEventListener("Orcish", startPlayingWOW);

Custom Events
Now, I could create a different type of Event Folder for each type of game, such as StarCraftEvent, RuneScapeEvent, AOEEvent etc.

Each type of event file would have information inside of it, for instance, the "StarCraftEvent Folder" may have the following properties:
> the target - Me, since I'm the one "dispatching" the event
> the type - the custom event string, in this case "Yamato"
> map - the StarCraft map we will be playing in
> players - a list of all players
> settings - the game settings

And our class would look something like this (note that "target" and "type" are automatically inherited by the Event since you "extend" it)
public class StarCraftEvent extends Event
    public function StarCraftEvent(the_type:String, the_map:SCMap, the_players:Array, the_settings:GameSettings)
        //Since you extend the Event, let the super class know a few more additional details
        map = the_map;
        players = the_players;
        settings = the_settings;
    public var map:SCMap;
    public var players:Array;
    public var settings:GameSettings
This would be my totally custom made event class! Perfectly customized for whenever we want to start a StarCraft game, allowing everyone to get the information they need!

Dispatching the Custom Event
This is exactly as simple as it was dispatching the "clicked" event:
//Create the event
var players:Array = [Andreas, Nico, Bob, Larry];
var scEvent:StarCraftEvent = new StarCraftEvent("Yamato", lostTemple, players, defaultSettings);

//Dispatch the event (and it's folder containing all the info)
That dispatches an event which alerts everyone who is listening that I am about to start up a StarCraft game.

So, Nico, Bob, and Larry run up to my cubicle and I hand them all the StarCraftEvent Folder containing ALL the information they need to join in the game.

Do you really need to create Custom Events?
Now I can create a new Custom Event for each and every game we play and that would alright.

But I noticed, no one really reads the information in the Event Folder! I spent good money putting together and printing out all the information for those folders, and no one reads them! They get the file from me, then they run back to their own cubicles, fire up the game, and throw the Event Folder directly into the trash.

When you think about it, do they really NEED all that extra information such as maps or players? They will find all that information out anyway when they start up StarCraft. There really is no use going into all the hassle of creating custom events!

Instead, what if I print out a plain old Event Folder? All it says is the "target" and the "type", but if they want more information (which one one does) they can ask me for it directly.

FORGET about the hassle with the StarCraftEvent class, and just do this:
var eventFolder:Event = new Event("Yamato");
99% of the time. That is all you will ever need. You save a lot of unnecessary work.

You don't always need to create custom Events, usually it is enough just using custom Event Strings.

That is Custom Events 101

Monday, October 11, 2010

Understanding the AS3 Event System #1 - The Basics

This post can be found on the new blog at Understanding the AS3 Event System #1 - the Basics
I originally wrote this thread as a response to a Kirupa forum thread:

This is my first draft, so any opinions or thoughts are deeply appreciated, especially if there is anything you still don't fully understand or would like me to clarify further.

Imagine your code as one big office room. That office has about 100 or so cubicles, with each cubicle representing a different object. For instance, if you have 5 Buttons on the stage, it's not one "Button" cubicle, but instead 5 different cubicles, one for each button instance.

The Event String/Event Type
Now, I'm sitting in the "homeButton" cubicle. One day, I get an email from my boss who tells me I have been "clicked". So immediately I stand up, and yell out into the hallway so loudly that everyone can hear "I HAVE BEEN CLICKED!"

Now, the boss may have A LOT more information, such as where I was clicked, how many times, if any of my children were clicked, and a lot more information. However, I won't stand up and yell out to everyone in the building all that information. That is quite wasteful, and if I got several of those emails a day, I would soon get tired of spouting out all that information.

Instead, to save energy, I only tell everyone "I have been clicked". That is me telling everybody the event type, also known as the event string.

Listening for Events
Back up a few hours (before the event string). I have a friend named Nico sitting in the art department (his cubicle is labeled "currentImage" though that's not really that relevant). His boss told him "Whenever Andreas in the homeButton cubicle is clicked I want you to draw an image of a house and send it right to me."

Now, Nico could get up out of his seat every five minutes, walk over to me, and ask "Hey, Andreas. Were you clicked yet?" I say no, so he walks back to his cubicle and sits down. This would happen again and again, and neither of us would get any work done. This is VERY inefficient. Nico could reduce this and only check with me once per hour, but he wants to know immediately when I am clicked. So that is NOT an option either.

Instead, Nico sits in his cubicle continuing his regular work, and in the meantime, listens out in the hallway for my voice. Now, at around noon I yell out "I was keypressed!" He hears my voice, but he really doesn't care about the keypresses. So, he ignores what I say, and continues working. Then another guy in the cubicle (Larry, a really annoying guy) yells out "I was clicked!" Since Larry is not as good looking as Andreas, and The Boss didn't tell Nico to listen to Larry, Nico ignores him completely.

Because, Nico is only listening to Andreas (in the homeButton cubicle) for the "clicked" event. When he hears the event, he needs to start drawing the house (which looks something like this in AS3):

homeButton.addEventListener("clicked", drawHouse);
The Event is dispatched
Now, fast forward back to where we were. Me (Andreas) gets the call from my boss telling me I was clicked. So I stand up and yell out to everyone. "I was clicked!"

Two people were listening for my "clicked", Nico and Bob (the guy from 'contentManagement', a very talkative fellow) Nico rushes up to me excited "Hey Andreas. I heard about the click. That is awesome! Congratulations! But tell me more about the event! Why were you clicked? Where were you clicked? Who clicked you? Why did they click you?"

I could spend the next 5 minutes explaining all the juicy details to Nico, but then I would have to repeat all this information to Bob (which is very inefficient, and Bob is a busy man and doesn't want to wait). So instead, I print out all the information on the "clicked event" and put it into a Folder which I give to Nico. I give the folder to both Nico and Bob so they can use the information in it and look at it as they please. This folder is the Event object (more details on that later)

Immediatly Nico rushes to his art studio in his cubicle and gets to work at "drawHouse()", however, now he has the Folder (the Event) he can use that information while drawing the house, and therefore passes it into the function as a parameter:
function drawHouse(event:Event)
{ /*Draw stuff in here...*/ }
The Event
To make sure that everyone gets the information they need, there are VERY strict protocols to what the Event Folder needs to contain.

The following pages with information are required for standard Event Folders
>the target - the person dispatching the event, which in this case is me, Andreas (or actually the homeButton cubicle).
>event type - the type of event (aka event string), in this case "clicked".
(there are a few more pages in the file, but that's mostly the small legal mumbo-jumbo fine print that no one reads anyway. You will be fine ignoring them for now.)

This is a standard Event file. But hold on, there was A LOT more information which is missing here! If I hand Nico a file with only those two pages of information in it, he will still wonder "Where were you clicked?" among MANY other important questions. Luckily, the company already has a neat system figured out!

The MouseEvent
Now, the company I work for has a second type of file, a "MouseEvent File". This file extends the standard Event File. That means that the MouseEvent file has all the information contained in the plus a lot more information, perfect for when a "clicked" event happened.

It has the standard two fields (target and type) PLUS these additional pages with information:
And a whole lot more!

Note that this MouseEvent file ONLY is allowed to be used when dealing with events that had to do with the mouse, such as "clicked", "hovered" etc. The file should NOT be used for events that had to do with the keyboard, "keypressed" or "keyreleased". Those events should instead use a specialized KeyboardEvent File with it's own special properties.

So I print out all the relevant information and hand both Nico and Bob a "MouseEvent" folder. Using that information, they draw the houses, or display text, or whatever they want to do with the information.

(Extra note: Maybe Bob didn't even need to see the file. Maybe he just needed to know that I was clicked, so when I hand him the file, he may not even open it or look at the details of the click using the information inside. That's fine by me, but I still need to create the file in case there is someone out there who actually needs the information.)

Creating the MouseEvent
Bob and Nico don't want to wait for me to print out and collect all the papers needed in the MouseEvent file. They want the information to be ready the second they step up to my cubicle. So, BEFORE I stand up and tell everyone I was clicked, I create the folder ahead of time for quick and easy access. THEN, I dispatch it to all who are listening.

This is how it looks in ActionScript:
//create the folder with all the information in it
var eventFolder:MouseEvent = new MouseEvent("clicked", bla, bla, localX, localY, bla, bla, bla, bla, more bla);

//Now stand up and tell everyone I was clicked
//The "eventFolder" already says the event type is "clicked",
// so I don't need to repeat myself when dispatching it.
//All I need to do is dispatch the folder and Flash will do all the dirty work
Now Nico and Bob (and whoever else is listening) can react to it and get to see the folder I sent when dispatching:
function drawHouse( andreasEventFolder:MouseEvent )
{ /*Draw stuff in here...*/ }
That is Events 101.

Monday, June 7, 2010

[K2Fave] Joomla K2Fave - Frequently Asked Questions

This article relates to the Joomla K2 modification "K2Fave"

To my surprise and amazement, a lot of responses already and so very quickly. Here are a few questions that have arisen so far. I will keep adding to this list over time, so check back if you run into any issues.

How can I view all my favorites?

There are three ways. Sadly, you are going to need access to the raw PHP code in all instances. If anyone is better with the Joomla framework, perhaps they can help bridge this in a way so you can put in a "favorites" table in any page from inside the "page editor".

Just plain import
You can just plain and simple import a basic page which already has all the imports and everything you need.

I noticed one small flaw on that page you might have to fix unless you downloaded the release fixed a few minutes ago. Inside of "viewfaves.html.php"
//Replace the following line

//With this

Access the "K2Fave" class directly
Wherever you want the table of favorites to appear, place the following code:
//Get current user - you can do this any way you please
$user =& JFactory::getUser();
Access raw data from the database
This might take some PHP experience to get done, but if you want the actual array filled with all favorites, try this code:
$user =& JFactory::getUser();
$favoritesArray = K2FaveDatabase::getFaves($user->);
The returned array is a list of objects, all with integers named "user_id" and "item_id". See the "K2Fave::listUserFavorites()" function (located in k2fave.php) for an example of how to parse the array into a usable table.

The K2Fave class has a few more functions which may assist in creating a good table; such as makeRemoveURL() and makeK2ItemLink(). See the class definition for more details.

How can I format the favorites table?

The table is formatted as a plain, old <table>, so wrap whatever code you are using to make the table show up in CSS span or div tags, and set whatever formatting you need either in side of those, or in a separate CSS file.

For free tutorials on CSS and how to use it properly, I would recommend W3Schools, along with a good old fashioned Google search.

Otherwise, the table should take on the default formatting for tables set in your global style sheet.

The favorites are able to be added more than once, causing duplicates

This means that the rows were not both set to "PRIMARY_KEY". This can be a bit tricky, and not really common in most cases, but the following guide should help with both creating the table, or modifying the table in case it was already created.

IN PROGRESS: I'm working on a post which describes how to set up the database properly. Should be done tomorrow morning.

I'm getting an error message!

Great! Tell me about it! See the answer to the question below for contact details.

It would be easier if you copy and paste the EXACT error message, which makes it a lot easier for me to track down the bugs.

If a completely blank page is showing up rather than an error, try turning on global error reporting in the Joomla! settings.

But that's not enough! I want my favorites manager to also do this and that, and then do si and so...

Great! I would be happy to implement any ideas you may have into future versions of K2Fave.

If you want very specific modifications made to K2Fave for any part of Joomla or K2, (such as playing a Fanfare when they add an item to favorites, and Taps when they remove the item from favorites - anything really) send me a message using the contact details below.

All this PHP and MySQL is quite confusing. I just want the favorites thing to work; I don't want to worry about it.

I would be more than happy to implement those changes for you, as well as any other reasonable modifications you may want to the existing system for a flat rate of $30 USD. This includes not only installation, but also any text, customization, styling, and custom implementation.

If you have low income or a low traffic site, we might be able to work out special arrangements, so don't give up even if you may be 15 and trying to make it on a $10 per week allowance. ;)

This is fantastic! Your modifications saved me hundreds of dollars! Thank you!

First of all, I would love to hear about your experiences, as well as any live examples of the modification in use. Please leave a comment. :)

Second, I am releasing these modifications for for free, and although it's not required, if you do make money from the project, or have saved money thanks to this project, I would really appreciate a donation so I can keep my programming work alive and keep these modifications and extensions coming for free.
I might even name my firstborn after you out of joy and appreciation.

How can I get ahold of you?

In the README.txt file there is an email address. I would prefer you not release it publicly for fear that it gets picked up by spambots. I hate having to switch to a new email address due to too much spam.

That email address is also used as my MSN Messenger account, in case you prefer instant replies to questions. I'm usually logged in most of the time.

I also have a contact form which will always forward all your messages to the newest email address

[K2Fave] Joomla! K2 favorites plugin translated and finished

I spent the weekend translating and fixing up the K2Fave modification, so now it should be completely understandable, as well as adjustable to anyone's needs.

For more details, see the original blog post

Easily changeable text and user messages

Any major text or language changes can be done in "messages.php", which contains several lines similar to this:
define('T_ADD_TO_FAVES', "Add item to favorites");

Any form of HTML tags, including images, are allowed in that field, so rather than modifying the source directly, all you need to do is modify the text in the messages file. This is also convenient if you want multilingual support for a site, and can easily be achieved with a few slight modifications.

Database changes

If anyone has already implemented the previous release, the database needs to be renamed to "jos_k2_favorites" with the following fields:
user_id int(11) PRIMARY_KEY
item_id int(11) PRIMARY_KEY
NOTE: This is in addition to updating the PHP files!


The most relevant information can be found in the README.txt file inside the ZIP, or on the original blog post.

Most everything is self explanatory, but if anyone needs any better documentation or clarification for anything, leave a comment or send an email to the address listed in the readme file.


The installation steps are the same as before, and the ZIP file can be found in the same location as before.


Sunday, June 6, 2010

[K2Fave] Joomla! K2 Favorite item manager

NOTE! This modification has been updated to release version 1.0, if you still have the old version (without proper translations), please update. More information is available in this post

Greetings Joomlaers!

As there was a need for a "favorites" option in the Joomla! plugin k2, I have released these modifications. Note that this is not an installable extension. Instead, these are files added to the server, and slight modifications to already existing k2 pages.

I am releasing these modifications for for free, and although it's not required, if you do make money from the project, I would appreciate a donation so I can keep my programming work alive and keep these modifications and extensions coming for free.
These files are released as-is with no guarantee to be free from flaws or completely secure. If you are worried about the code containing security holes, look over the code yourself and make the necessary changes. If you find any vulnerabilities let me know and I will be sure to fix them in the next release.

This is the first release of the project, so any suggestions or tips are VERY welcome.

If you would rather not do all the work of adding the plugin yourself, for $30 USD I will upload and make all changes directly to the server, so you don't have to worry about anything, including any wanted customization such as speical text, CSS formatting, etc. If you have any other "wants" for the project, I can implement those as well.

For further details, leave a comment in the section below, or on my in progress website, or send me an email via the address provided in the README.txt file.

Instuctions for use/installation

Download the ZIP file and extract it temporary location

Save the "items.php" file as:
Note that if you are using an updated version of K2 with a different "item.php" page, copy lines 27-33 into the new "item.php" page, and place them right before the line containing "<!-- K2 Plugins: K2BeforeDisplay -->"

Save the entire folder "k2fave" inside of the folder

Finally, create a new table named "jos_k2_favorites", using whatever prefix your Joomla installation currently uses. Your table should be formatted like this:
user_id int(11) PRIMARY_KEY
item_id int(11) PRIMARY_KEY

The easiest way it to open up PHPMyAdmin and add this table manually, however, it is possible to do so via SQL statements instead.

If you have any questions or would like me to do any other Joomla modifications, send me a message.


Thursday, June 3, 2010

What is the point of this Blog?

I recently had to write a summary of the blog, and thought it might be a good opportunity to repost this information here and make it clear to all my thoughts and purposes of this Blog.

This blog is a collection of information focused mainly on ActionScript and Flash, with emphasis on game development, plus a little bit extra thrown in. It is aimed to be readable by beginners and not only experienced developers.

Articles are typically in one of the following categories:

The posts also strive to be unique. "If you can find it from 100 different sources on Google, there is no use in reposting what is already out there." Though, I may link to good articles, but I try to avoid writing repetitious information, clogging up the already very filled internet.

If there is any part of ActionScript you want more information on, or have an idea for a good blog post, leave a comment in the section below. A blog isn't much use if the information is irrelevant to it's readers.

Andreas J. Renberg

And now on to SWF Protection! :)

Monday, May 24, 2010

Calvin and Jobs

It seems like these comics have been around for a while, but considering the circumstances, I believe it to be appropriate to "rebump" them.

These were not made by the original Calvin and Hobbes writer Bill Watterson, but instead by MAD Magazine.

I do not hold any sort of copyright for these images at all. I wasn't satisfied with the original qualities, so I made a few quick touch ups in Gimp. Enjoy...

Calvin and Jobs - 64 Million

Calvin and Jobs - Ads

Calvin and Jobs - Bullies

Calvin and Jobs - New Clothes

Calvin and Jobs - Virtues

Calvin and Jobs - Court Practice

Calvin and Jobs - Trash

Calvin and Jobs - Pixar

June is SWF Protection and Encryption month!

Time for a themed blog month!

This June (only one week left-gasp) I will be gathering and sharing information on all things regarding SWF Protection and Encryption.

As we all know, SWFs are able to be decompiled (quite easily as well), and if you spent two months fine tuning and working on this FWA worthy site, or a really neat, new template, or perhaps a great new game, you don't want your work ripped right out from under you and replicated without your permission, control, or royalty.

If anyone has any experience with, links on, or articles written about protecting your treasured Flash work, leave a comment or send me a private message directly on this form. I'd be glad to either link to (or host if you don't have a site of your own) any information on this topic. Even information on SWF Decompiling is welcome!

Steve Jobs responds regarding Flash

"We also know first hand that Flash is the number one reason Macs crash." [...] "Perhaps Adobe should focus more on creating great HTML5 tools for the future, and less on criticizing Apple for leaving the past behind." — Steve Jobs

Finally, someone from Apple responded to war on Flash in an official statement — Mr. Steve Jobs himself! That letter can be found at

In the letter, Steve Jobs points out six main points why Flash is the enemy that has infested the Internet, and must be weeded out and slaughtered before it kills us all. Here I list the "abbreviated" version of his letter without any personal opinions or replies; I'm saving those for later.

First, there’s “Open” Adobe's products are 100% closed and proprietary. Adobe updates when THEY want to, and sets whatever prices they like. Although Apple has closed products, standards like HTML5, CSS, and JavaScript are entirely open and available to all, and therefore all work with Apple's products.

Second, there’s the “full web”. Almost all popular video on the Internet can be viewed in a newer, more modern format, H.264. Even though users cannot play flash games, there are over 50,000 applications in the App Store, and many of them are free.

Third, there’s reliability, security and performance. Symantec recently highlighted Flash for having one of the worst security records in 2009. We also know first hand that Flash is the number one reason Macs crash. We don’t want to reduce the reliability and security of our iPhones, iPods and iPads by adding Flash. In addition, Flash has not performed well on mobile devices.

Fourth, there’s battery life. Most Flash video is saved in formats which need to be decoded first; this takes up valuable battery life. On an iPhone, H.264 video can play for 10 hours until the battery dies, while most other formats only last the battery 5 hours.

Fifth, there’s Touch. Flash was designed for PCs using mice, not for touch screens using fingers. Apple’s multi-touch interface doesn’t use a mouse, and there is no concept of a rollover. Most Flash websites will need to be rewritten to support touch-based devices.

Sixth, the most important reason. Apple doesn't want any third party standing in between the developer and Apple. If Apple releases new updates, the users have to wait until the third party has updated their software to match, and are at the mercy of the third party. Although Flash is intended to be "cross-platform", Apple is very much against this thinking. Apple wants all their apps MADE FOR the iPhone or iPad, optimized with all the features available to "iProduct" developers, not available to iProducts as a "side feature".

Some of Steve Jobs arguments are a little shaky, and a lot of the time, he is pointing out a flaw in Adobe, while four fingers are pointing right back at Apple. But I'll post counter arguments and opinions on the matter another time.

This article is part 2 of 3 in the series "The Apple vs. Flash Wars"
  1. "Go screw yourself Apple" — Lee Brimelow
  2. Steve Jobs responds regarding Flash
  3. Thoughts on the Steve Jobs reply [in progress]

Sunday, May 16, 2010

The Humble Indie Bundle closed [Plus free Portal!]

See also

Sadly, the Humble Indie Bundle didn't last forever, and eventually (or rather abruptly) came to a close. I wish I had found out about it sooner, and I would have been able to tell more people about it.

Tuesday, May 11, 2010

[CLOSED] Pay what you want for five [edit: six] awesome games!

The Humble Indie Bundle is now closed.
For further information, see the Wolfire Games Website, or the follow up post

The Humble Indie Bundle

When World of Goo was released on the Wii (via WiiWare) I bought it nearly immediately, and it is definitely one of my favorite games of all time (still doesn't beat Portal, sorry, but it comes close)

I found this out a bit late, but luckily, not too late.

For a limited time, you can buy the following games:

Normally it would cost $80 if you bought them directly, but now you can choose what price you want to pay for these games, weather it be one penny or the full $80. All money received will be split between the developers, and in addition, two charity organizations, Electronic Frontier Foundation and Child's Play Charity.

All games are available for all three major platforms, Windows, MAC, and Linux (yeay!)

Not only that, but since the total number of donations exceeded $1,000,000 (that's one million US Dollars) Aquaria, Gish, Lugaru, and Penumbra will be releasing the sources of their games with the GNU Public license!

But hurry, if I understand correctly, the entire deal ends in 3 days and 19 hours from the time of this writing (there's a timer on their site if you don't feel like doing the math)

For more information, see their site, or this "rap informational video"

So go out and spread the word!

A Game a Week #1 - Temperature

Sammo over on the Kirupa Forums has started a new "game" (I'm really not sure what to call it) on creating games.

I'll just quote him...
Welcome to the first A Game a Week, this is an experiment inspired by 2D Boy's Experimental Gameplay Project. The idea is simple, you have one week to make a Flash game, from concept to production. You are not required to enter, it is not a contest, it is just for fun and for practice. Most importantly though; it is not a contest.

The rules are very few and very simple. The rules are:
  • You must include the FLA (or AS or even FXG if you're feeling fly) file.

  • That is all.

    This week's theme is Temperature, and the deadline is May 18, 2010.

    For more details, visit the official Kirupa thread:

    If I have enough time among all my work, I will try to get a submission in, but I tend to procrastinate, so any work will likely be done on the 17th. ;)

    Sunday, April 25, 2010

    Getting started with Flash Player 10.1

    Flash Player 10.1 added several neat multi-touch, gesture, and accelerometer input features. There are several more neat features of the new Flash Player, but the new input controls are what I find the most captivating (that, and global error handling, FINALLY!). The rest can be found on Adobe's website:
    AdobeLabs - Flash Player 10.1 Features and Enhancements

    Adobe really put a lot of effort into getting the newest version of Flash Player to work on numerous devices, naming this project the "OpenScreen Project". Quoting Adobe - "With support for a broad range of mobile devices, including smartphones, netbooks, smartbooks and other Internet-connected devices, Flash Player 10.1 allows your content to reach your customers wherever they are." [side note - sadly, iPhone support was shot down]

    Flash Player 10.1 is still in the "prerelease stage", meaning it is not released as an "official" or currently updated version just yet. I'm not sure if bugs are being ironed out, or if Adobe mainly wants to wait until Flash CS5 is out. However, the new player is still available for developers who want to test out the new features.

    So far, FP 10.1 seems to be working just fine for my every day uses, and haven't run into any major bugs yet. In fact, (since I'm in Linux still) the old Linux Flash Player (version had several bugs which were never ironed out, and according to several Google results were quite common. However, with the new version, those bugs seem to be gone (at least so far):
    [Solution] Flash sound stops working in FireFox on Linux Ubuntu 9.10
    [Solution] Adobe TV crashes FireFox on Linux Ubuntu 9.10

    Since 99.8% of your site/application/game users won't have version 10.1 installed, I really don't recommend using it for your sites just yet. However, if you have a phone or computer with multi-touch capabilities it might be fun messing around with the new features. In addition, if you read up on the classes and functions enough now, by the time it is fully released, you can be first in line when clients are looking for the newest features for their product.

    So, where do I get started?

    FIRST, you need to download the actual Flash Player 10.1. As with Flash 10, the browser and standalone versions are two different things, so if you update the browser player to 10.1, the standalone player will still be the old version and vice versa, so unless you plan on keeping the old player for any specific reasons, remember to update them both.

    There is also a difference between the debug version and the regular version. Basically, the debug version is good if you do a lot of testing, since the error messages show up as dialogs, along with several other features not available in the "regular" release of the Flash Player. Otherwise, errors are silently ignored, which is good for regular users, but really annoying if you can't get your code working right, and you are having a hard time figuring out what's going wrong and where.

    All versions of the player can be downloaded here:

    THEN, all you need to do is download the new SWC library with all the new classes. I'm pretty sure they are just the "shells" for the classes which expose all functions and properties rather than contain actual code, just as the ActionScript files for MovieClips don't contain the actual code for them, but just expose functions to allow code hinting etc for developers. [a VERY good read on the matter]

    I was worried I would need an updated compiler, but to my joyous surprise, you can still keep using Flash Professional, Flex Builder, the Flex SDK, or whatever compiler you use without any modifications. There should be dozens of tutorials on importing SWC libraries into your current editor, but if you can't find anything relevant, ask in the comments section, and I will lead you in the right direction. Don't forget to post what type of IDE you are using (Such as Flash Professional CS4 or FlashDevelop etc).

    The SWC can be downloaded on the same page as the Flash Player (how convenient)

    Downloaded and ready! Teach me how to use it!

    Sadly, I don't have any tutorials for it (I don't have a touchscreen or even a mobile device newer than 10 years old) but several others out there have already put up tutorials for FP 10.1 development.

    gotoAndLearn - Multi Touch Gesture Applications
    Multi Touch in AS3 / Flash Player 10.1 - Part 1. Setting Up
    Multi Touch in AS3 / Flash Player 10.1 - Part 2. TouchEvent & MouseEvent Sequences

    I'm in need of a lot more tutorials and examples, so if you know of any other good sources, or have written any good tutorials yourself, just leave a link in the comments section! :)

    Some further reading

    As always, I am never the first to write about things, so here are some helpful links which hopefully helps someone out there.

    Adobe Labs - Adobe Flash Player 10.1
    Introducing Adobe Flash Player 10.1 public prerelease
    Flash Player 10.1 prerelease software demos and interviews
    Adobe TV - Multi-touch capabilities of Flash Player 10.1
    Kirupa Forums - Disappointing FP 10.1 First Impressions
    TourDeFlex - according to Adobe, some examples should include some FP 10.1 features as well. Still very neat if you haven't used it before!

    Good resources for FP 10.1 development

    Keep these links in your toolbox. They usually come to use quite a bit:
    ActionScript 3.0 Language Reference (with updates for Flash Player 10.1)
    ActionScript 3.0 Developer's Guide (also with FP 10.1 updates)
    Adobe Forums - Flash Player 10.1
    Adobe Bug tracking and management - On case you do find anything wrong with the new version. When submitting, remember to check for existing bugs, as chances are you aren't the first person ever in the world to run across that bug. ;)

    If anyone has any demos of what they have accomplished with the new features in FP 10.1, leave a comment and share your work with others (source code is appreciated, but not required). I will provide the SWF hosting if you require it.

    Tuesday, April 13, 2010

    "Go screw yourself Apple" — Lee Brimelow

    "Go screw yourself Apple" — Lee Brimelow

    Instead of just adding to the oodles of posts out there on Apple's recent move with just another long hateful rant, I will just add my two cents in little paragraph, as well as a few good reads on the matter.

    What are you talking about?

    Okay, let's start from the beginning.

    In the past, to develop iPhone apps, users had to download the "free" (note the quotes) SDK from Apple, which ONLY runs on MAC. In addition, developers had to pay $99 per year to Apple and join the "iPhone Developer Program" in order to publish their apps to the store. The only way to put iPhone apps onto your iPhone is via the apps store (unless you jailbreak the phone, but that may void your warranty)

    This was the only way to develop games and applications on the iPhone, and some companies would offer to port the games for a fee.

    On October of 2009, at the Adobe MAX conference, Adobe announced that Flash Player CS5 will have the ability to export Flash games and applications to a format that can run natively on the iPhone. Natively means no slow interpreters or emulators, but direct compiling to the iPhone's bytecode. [Ryan Ragona's comprehensive blog post, Lee Brimelow's video, and Adobe's official iPhone apps site]

    The compiler upgrade in CS5 was VERY exciting for developers, as not all developers have the time or money to port all their games to the iPhone format or go through each line of code and translate it to Objective-C.

    Wohoo! Now even I can make iPhone games!

    Not so fast, I haven't come to the bad news yet.

    Early April 2009 Apple announced that it is illegal (or whatever legal term they used) to compile your iPhone applications using any other tools then their SDK.

    Sunday, April 11, 2010

    [Solution] Flash sound stops working in FireFox on Linux Ubuntu 9.10

    If you leave the browser open for too long, pretty soon all Flash content on all sites will no longer give off any sounds. Luckily, the fix was easy, just restart FireFox and you will be good as new. However, it still gets REALLY annoying, especially when you have 25+ tabs open (maybe that's what was causing the sound problems after too long?).

    This would happen on a completely clean LiveCD system as well as the full installation with the following specs:
    Ubuntu Linux 9.10
    FireFox 3.5.8 with no extra add-ons installed
    Flash Player

    Instead of debugging and finding the source of the error, I took the easy way out and installed Flash Player 10.1 (currently in Beta I believe?)

    I have been running FP 10.1 for almost two weeks now, and still haven't had any sound problems. :)

    I could file a bug report for these old problems, but considering how much Adobe ignores Linux users, I doubt they would go back and update Flash Player 10.0 for these fixes. Instead, I'll file bug reports only if I receive problems in the new version.

    See also blog entry Adobe TV crashes FireFox on Ubuntu 9.10

    Wednesday, April 7, 2010

    [Solution] Adobe TV crashes FireFox on Linux Ubuntu 9.10

    I have no idea why, but whenever I would access AdobeTV, as soon as the video started loading, FireFox would freeze up and need a restart. Every single time.

    This would happen on a completely clean LiveCD system as well as the full installation with the following specs:
    Ubuntu Linux 9.10
    FireFox 3.5.8 with no extra add-ons installed
    Flash Player

    Instead of debugging and finding the source of the error, I took the easy way out and installed Flash Player 10.1 (currently in Beta I believe?)

    Perhaps the new Flash Player version will also fix some other issues I have had:
    • Playing sound stops working completely, and needs a browser restart in order to work again  [Yep. Fixed!]
    • SWF projects using computeSpectrum will not work (the sound plays, but it doesn't do anything on the stage)  [Hm... Still seems to not work...]
    • In the standalone Debug version of the player, even if you hit "Dismiss All", some errors will show up again, and no matter how fast you dismiss the errors, the dialog will keep popping up, forcing you to kill FlashPlayer manually  [No problems so far] 
    • Constant "flickering" between layers when playing games or apps with several layers  [Problem persists even in FP10.1]

    I could file a bug report for these old problems, but considering how much Adobe ignores Linux users, I doubt they would go back and update Flash Player 10.0 for these fixes. Instead, I'll file bug reports only if I receive problems in the new version.

    Thursday, March 25, 2010

    Getting started with Flex/Flash Builder on Linux

    "Windows Restore cannot continue. Please contact the manufacturer if this problem persists."

    With those words I realized that my temporary fling with Linux had gone from a fun single date to a forced marriage proposal and an unexpected commitment. Yep, I am stuck with Linux for a while, and hopefully not for an entire 9 months.

    It's not that I hate Linux, in fact I love using Linux, but I'm never getting those three hours of my life back spent on trying to get Flash CS4 working in Wine.

    Instead of sitting on my hands doing nothing, I'm going to get back to Flash development. Since Flash Professional CS4 is now out of the question, I guess my next logical option is Flash/Flex Builder.

    For anyone else getting started with building for Flash Player or AIR on Linux, I have compiled a small pool of information, so you don't have to dig through dozens of different sites for hours trying to make heads and tails of it all and sort it all out. Note that I have only been working with Flash in Linux for about two weeks, so please correct me (by leaving a comment) if I give any faulty or incomplete information.

    What is Flex Builder 3 for Linux?

    First of all, Flex Builder (now renamed Flash Builder so it won't be confused with the Flex SDK) is a plugin that Adobe developed for the already popular development environment Eclipse. Most of the features, such as code hinting, were already developed by the Eclipse team, so Adobe can safely charge almost $300 for relatively little effort. Of course, they also added a few new features to the plugin beyond Eclipse's current capabilities, and they didn't charge the full $700 for Flex Builder, so I will cut them some slack.

    In an effort to connect to developers of all platforms, (and considering how Eclipse is already available in Linux, all they had to do was update the plugin to match) Adobe released Flex Builder 3 for Linux (currently alpha version 5). Note that Adobe considers this plugin separate from the "regular" Flex Builder. According to Adobe, "Although many of the features in Flex 3 are included in the Linux release, there are several features that are not yet included. Our main goal is to get the base features in place and then to solicit user feedback and their priorities for additional features, such as the profiler or design view."

    Although it sounds like Adobe is making a great effort at making this world a better place, Adobe seems to have abandoned the project. Aside from releasing the alpha 5 version in November of 2009 that extended the trial period (from 1 Dec, 2009. I'm not sure of the new trial expiration date), there hasn't been any updates for Linux users since April 2009.

    Despite the recent release of Flash Builder 4, Adobe still has not updated the Linux version, and the reply of choice when asked is "Adobe has not yet announced a release date for the Flex Builder Linux product."

    Am I being too hard on Adobe? If you feel offended, please tell me, and then show me what progress they have made and steps toward finishing the Linux version. Then I will go back and correct any hateful remarks.

    That's horrible! We need to do something!

    The valour is honourable, and if you really feel like it you can vote on this bug:
    However, unless you hold a major share of stock in Adobe, I doubt they will do anything about it. They will either drop the project, or will reinvest in it once it becomes obviously financially beneficial to them.

    Oh well, I guess FB3 Beta is better than nothing

    That's the spirit! The FlexBuilder trial can be downloaded from Adobe's site:
    The installation process is pretty straightforward. Remember to have Eclipse installed first, as the installed only includes the plugin. Eclipse can be found here:

    WARNING: Several people have trouble installing the plugin on Eclipse version 3.5! (including me at first) Although there are fixes for this, it might be better to install version 3.3.

    In Ubuntu, it should be as simple as going to "Applications > Ubuntu Software Center" and installing it from there (worked for me). If Eclipse doesn't show up in the list of available programs, make sure you have marked all the software sources in "System > Administration > Software Sources". If you have any problems, this walkthrough might be able to help (he beat me to writing the tutorial):
    (and a second tutorial in case the first one wasn't enough)

    What about Wine?

    I'm not complaining that much about Adobe... oh... you mean. Yes, I see now. My failure with Flash Professional and Wine caused me to give up, and I didn't even think about using it with Flash Builder. This section wasn't even added until after my try with fb4linux, so I have not personally tested this yet.

    According to their website, Wine should be able to emulate Both Flex Builder 3 and Flash Builder 4 fairly well. It's definitely worth checking out.

    This guy seems to have accomplished it, and has written a guide:

    So what other alternatives are there?

    One name that appears a lot is Aptana (which I believe is free) and also Eclipse based. I still have not tried it, and I'm not sure how full fledged it is, so I would really appreciate any opinions on it or trustworthy reviews of it to link to.

    Another one I have seen links to is IntelliJ IDEA, however, this one has a price tag of $249. They have a free "community version" on their site, but I have no idea of the difference between the two. According to their site, it should incorporate well into Flex without any major modifications. [source] This one I have not tested either, and would really appreciate any reviews.

    AXDT seems to be another Eclipse plugin. No experience with that one either, but it uses the Flex SDK, so it should have about the same amount of features as if you were using FlashDevelop and the SDK.

    FlexBean another plugin, but this one for NetBeans. Likely similar to AXDT.

    Screw Adobe! I want Flash Builder 4 in Linux now!

    I was hoping you would want that. Finally, there is Flash Builder 4 Linux (I'm not sure if the 4 is to match the version number of the newest Flash Builder, or if it's supposed to read "for").

    This release is NOT by Adobe. This is a port of Flash Builder to Linux. I'm still not sure exactly how it is ported (possibly because Eclipse plugins are operating system independent due to being Java-based, and all they did was copy the data from the Windows version to the Linux version, however, I believe there was a bit more involved)

    If you need hand with the installation, this site has a small tutorial:

    What now? It's installed, I want to learn Flex in Linux!

    I'm still trying to dig up links for this. The good thing is most tutorials that work for Flex Builder should work just the same for the Linux version.

    I have however found one video that specifically names Linux - Getting started with AIR on Linux. It's 'hosted' by Mike Chambers, and even though he says he has planned on releasing future tutorials on Linux development, I have not found any. GotoAndLearn has several other great videos on Flex development as well.

    Additional reading

    You could get these yourself from Google, but then you have to sort through which ones are on topic and which ones are just wasting bytes on a server.

    So what about you? Can we expect more Linux tutorials?

    Definitely! If Windows keeps being evil, I'm likely to stay in Linux for a while, so hopefully I can be of some help to others who are also using Linux and developing for Flash.

    I'm in the process of downloading Flash Builder 4 Linux right now, so I will give a full review and maybe even a guide some time soon!

    I also got my hands on SWF Protector. Thank goodness they have a Linux version. Once I get everything up and running, I will give my thoughts and hopefully also a performance evaluation on how well it runs. There will also be both a drawing and a competition for free licenses, so stay tuned!

    Any links or alternatives I missed?

    Wednesday, March 10, 2010

    ActionScript Blogs to Follow [Open Post]

    A Google search for "ActionScript blog" returns over 5,790,000 results. In a widespread internet world like this, it can be difficult (especially for beginners) sifting through which information is reliable and helpful, and which simply isn't (hopefully this blog is not in the latter category)

    Here is my personal list of blogs I find quite worthwhile to bookmark and check up on from time to time.

    Thursday, February 11, 2010

    Optimize AS3 for speed - Bitmap filters reply

    I originally posted this as a reply to a comment on MichaelJamesWilliam's blog entry "Learn how to Optimize your AS3 Code". The spam catcher kept refusing to submit it (I'm guessing because of all the links), so I reposted the reply here.

    kustrle February 11, 2010 at 7:51 am
    I was sure pixel perfect collision detection already first check if two objects are overlaping. Is there any way of reducing lag that comes from glow, blue, etc without photoshop? Since we lose flexibility there too. If we want to change glow to other color later it will be much harder. Can we tell flash to convert those objects to some kind of bitmap picture and then forgot about all filters? Great tutorial!

    @kustrle - Yes, it is possible to save the "filtered" version of DisplayObjects as BitmapData and use that the entire time.

    Tuesday, February 9, 2010

    The Language Reference at the tip of your fingers!

    There is no question or dispute about it,
    If you want to be a good ActionScript developer, you need to learn how to use the ActionScript 3.0 Language Reference. (Unless you have decided to do all your coding using only primitives...)
    I'll write a guide on how to use the language reference some time in the future, but until then, it still needs to be convenient and easy to get to. I will show you how to save the language reference to your hard drive (faster than loading it in from the internet, and then it's also available when you are offline!), and then add it to your bookmarks toolbar.

    The end result will look something like this:

    I will be using FireFox (version 3.5.7) running on Windows XP. It should be fairly straightforward, and pretty much the same for any browser or operating system, but if you have any difficulties, leave a comment. If you have gotten this to work in a different operating system or browser, please share your results.

    Step 1 - Find and download the ActionScript reference from Adobe's website

    The newest version of the language reference can be found at:

    Note that Adobe often throws around and rearranges their site, so if that should happen, this site will always link you to the most up to date version of the language reference:

    About at the bottom of the page of the online reference, it should say something like "Download a standalone ZIP file version of this reference, including its own local search for offline use, here:" with a link to the ZIP. The current link is as follows:

    Save that ZIP file (about 6MB) to your desktop, and proceed to step 2...

    If you are using Flash CS3, the online version of the language reference can be found here:

    I can't seem to find a downloadable ZIP, however, if you installed CS3 correctly, the language reference should already be stored on your computer in the following directory:
    C:\Documents and Settings\All Users\Application Data\Adobe\Flash CS3\en\Configuration\HelpPanel\Help\ActionScriptLangRefV3\index.html

    If you are using any other version of ActionScript (such as AS2, Flex, FlashLite etc), the entire list of avialable language references can be found at:
    However, it seems that only the Flex Language Reference and the Flash CS4 Language Reference can be downloaded as ZIP files. Sorry. :(

    Step 2 - Extract the ZIP file to an appropriate location

    If you can't do this one on your own, you have more to worry about than learning ActionScript.

    You can extract the directory to any place that is convenient for you, however, if you decide to move it later you will need to redo the entire procedure, so choose wisely!

    Some recommended directories:
    c:\Documents and Settings\All users\Documents\AS3 Language Reference\
    c:\Documents and Settings\All users\Application Data\Adobe\AS3 Language Reference\
    c:\Program Files\Adobe\Flash CS4\AS3 Language Reference\
    c:\Program Files\Adobe\AS3 Language Reference\
    c:\Program Files\Mozilla Firefox\AS3 Language Reference\
    c:\Programming\Flash\Language References\AS3 Language Reference\
    c:\AS3 Language Reference\

    I will be using the first option for this tutorial as it will be the least likely to be overwritten in case any programs update.

    If you are using CS3, play it safe and keep the language reference in the directory where you found it. If you want to have it elsewhere, make a copy.

    Step 3 - Add "index.html" and "all index pages"

    EDIT: For some reason the context menu option "Open selected links in new tabs" seems to have disappeared, so in order to continue the tutorial you need to install one of the following add-ons:
    Linky -
    Multi Links -
    Snaplinks -

    For this example, I will be using "Linky", but you are free to use whatever plugin you prefer.

    In the directory you downloaded the language reference to, open the "index.html" file into FireFox (or whatever browser you are using).

    The site's url should say something like

    And you should see a page like this

    The main index page for the ActionScript 3.0 Language Reference

    To begin, bookmark "index.html" and rename it to "Main Page" or something and place it in a new bookmark folder named "AS3 Language Reference".

    For convenience, I added the bookmark folder directly to the "Bookmarks Toolbar", but you can keep them hidden away in the plain old bookmarks menu if you prefer.

    Next we will be adding a "search feature" (more like an index with CTRL+F) Remove the "index.html" text from the url bar and hit enter. This should bring up the folder contents in FireFox with the following url:

    Select all the links you see from "all-index-A.html" to "all-index-Z.html", right click the selection, and (at least in Linky) choose "Open selected links in tabs". After a while, you should have 27 new tabs opened. You can close down the "folder view" so it doesn't get included when bookmarking.

    Go to "Bookmarks > Bookmark all Tabs..." or hit "CTRL+SHIFT+D". Choose where to store these bookmarks, and name the folder for them something like "Search". It may take a few seconds, but once the bookmarks are saved, you can close down those pages. This is easiest by just closing and reopening the window, but if you have TabMix Plus plugin installed, there is a very handy "Close other tabs" option.

    Linky - open selected links in tabs

    Save all tabs as bookmarks

    A quick alphabetical index of classes, properties, and functions is now available in your bookmarks

    For the next steps, you will be repeating this procedure quite a bit.

    Also, if it makes it easier, you can add the root folder where the language reference is stored as a bookmark as well (I named mine "Browse Folder")

    Step 3 - Add the packages

    Next we will be adding the following packages as sub folders of the bookmarks menu:
    adobe.* (only a few files)
    air.* (if you don't develop in AIR at all, you can ignore this one)
    fl.* (Flash components)
    flash.* (All the actual class files - this one is the most important!)

    This part is the one that takes the longest. Unless you have a trusty army of Oompah Loompahs to do the job for you, prepare to take out at least half an hour in bookmarking them all. If you have a short attention span, bookmark them small parts at a time over time.

    In any order you like, start by opening one of the subfolders with the matching package name, and in most folders, you will need to open an additional sub-folder package.

    I'm going to start with "flash.accessibility" (in folder "flash\accessibility\") and start working down the list in alphabetical order until the entire flash directory is added.

    Use Linky to open the list of classes into your tabs

    Keep doing this to all 4 folders (and their respective subfolders) until you get an organization something like this in your bookmarks toolbar:

    Browsing for the documentation for flash.display.MovieClip

    Wohoo!! Almost done... (After all that you probably don't want to see another bookmark again, but bear with me. It is definitely worth it and VERY convenient once it's done!)

    Step 4 - The global package and Appendix

    There are several classes just laying their in the main folder that don't have a package. You could add them directly to your bookmarks toolbar, or you can group them into a new "global" folder to avoid clutter.

    Better organized global classes and functions bookmarks

    I found, the easiest way to track down all global classes, instead of guessing which ones are classes and which ones are just HTML pages, open the page named "class-list.html". It will contain a list of all the global functions and classes.

    Note that even though the classes are organized into separate HTML files, the global functions are all stored in one single HTML file (named "package.html"). So, instead of selecting all links on the page, only select the classes, and bookmark them. After that, go back and bookmark "package.html". If you have any use for it, you can also bookmark "package-classes.html", which is basically a list of all classes and functions in the top level package.

    You can even add the pages "operators.html", "statements.html", and "specialTypes.html".

    Finally, the Appendix ("appendix.html") contains pages such as a list of errors and what they mean, some AS2 to AS3 migration help, and other information. You can either add this single page and bookmark it, or select all outgoing links and bookmark those instead, creating a subfolder named "Appendixes".

    The only page left is "conventions.html", and unless you will be checking on it every few days, I wouldn't bother adding it as most of the Language Reference conventions are quite self-explanatory anyway.

    Last thoughts

    So, that's it. If you did everything right you should have a bookmarks menu which is easy to navigate around in, and has really helped me at times.

    An added bonus is that if you start typing in something in the address bar, FireFox will automatically recommend pages in your bookmarks.
    Firefox will auto-complete any text you type in with a class in the language reference from the bookmarks if a match is found

    I'll create a post in the near future which better uses the "search" ability of the language reference, but that is yet to come.