Loading Multiple Images using the gpUrlLoader Class

Actionscript, Flash

I discussed the use of the gpUrlLoader Class in a previous post (see: AS3: A URLLoader Class). This class, part of my gpAS3Library, will load image, swf, text, xml, html, stylesheet, json, and sound files.

In this post, I will discuss how to use the gpUrlLoader class to load multiple images into a Flash movie. I used this technique when I created the gpFlashGallery (A free Flash/XML photo gallery).

Continue reading

Checkout My New Site - T-shirts For Geeks

gpAS3Library – Part 2a: gpColorSchemes

Actionscript, Flash

When I converted the gpShapes class from AS2 to AS3, I wanted to be able to create shapes with web 2.0 type color schemes, but I did not want to hand code each color scheme in an XML file every time that I wanted to use one. So I created the gpColorSchemes class by duplicating a set of web 2.0 styles that I have in Photoshop. The gpColorSchemes contains 34 preset color schemes that can be used with any Flash/ActionScript application. I named this post Part 2a because I created this class to be used with the gpShapes class (Part 2), but the gpColorSchemes class can be used separately from the gpShapes class.

Continue reading

Checkout My New Site - T-shirts For Geeks

gpAS3Library – Part 2: The Shape Class

Actionscript, Flash

The gpAS3Library is a set of Flash AS3 utilities that I use when creating my Flash applications.

In Part 0, I discussed the gpUrlLoader class – This class will load image, swf, text, xml, html, stylesheet, json, and sound files.

In Part 2 of the gpAS3Libary, I will discuss the gpShapes class. This class is the basis for much of the UI that I create in my Flash applications.

Continue reading

Checkout My New Site - T-shirts For Geeks

gpAS3Library – Part 1: A Global Configuration Class

Actionscript, Flash

When I created Flash applications with AS2 in the past, I loaded application information such as page color, button colors and sizes via an XML file. I used this XML configuration file throughout the application, but, because I hated manipulating XML with AS2, I always converted the XML into arrays as soon as it was loaded.

Now with AS3 and E4X, using ActionScript to manipulate XML has made flash application development much easier.

The gpAS3Library is, to some degree, an ActionScript framework (albeit, in the very early stages). I use most of these classes in every Flash application that I develop. When I decided to convert these classes from AS2 to AS3, I realized that I needed a global configuration class to store the XML data that I loaded from the server. And with E4X, I can now easily retrieve the information I need from the XML lists.

Although I named this post Part 1, I have already discussed one of the classes of the gpAS3Libary in a previous post (see: A UrlLoader Class). In this post, I will discuss the gpConfig class.

Continue reading

Checkout My New Site - T-shirts For Geeks

ActionScript: Setting up ExternalInterface on Linux

Actionscript, Flash, Ubuntu

I have nearly completed my new portfolio site. I developed the Flash Movie on my Windows machine, but the rest of the development (Joomla, etc) has been done on my Ubuntu box. I’m using ActionScript’s ExternalInterface Class for this project. During integration, I learned that the Javascript code on Linux is a bit different than the code needed for Windows.

Continue reading

Checkout My New Site - T-shirts For Geeks

ActionScript: Removing Event Listeners

Actionscript, Flash

I came across an interesting problem the other day with regards to AS3 garbage collection. I assumed that when an object is removed from the stage, everything is removed, including event listeners. This is not the case. I created a carousel class for my new portfolio site. The carousel displays images for a specific portfolio category (web, business cards, magazines, etc). When the user clicks a link for a different category, all images for the current category are removed and then the new images are loaded. But when the new images loaded, I received the error:

?View Code ACTIONSCRIPT
Error #1009: Cannot access a property or method of a null object reference.

After some testing, I found that the event listeners were not being removed.

Continue reading

Checkout My New Site - T-shirts For Geeks

ActionScript: Using Lightbox With Flash

Actionscript, Flash, JQuery

I’m working on a portfolio site where I’m using Flash to display my work. When a user clicks on a link for a website that I designed, they will be taken to the actual website. But when the user clicks on the link for book cover or magazine, I want the large image to be displayed using lightbox (A JQuery Plugin). The primary reason is that I want to use lightbox is because the Flash movie has a height of 225 pixels – not nearly enough to display a large image. Surprisingly, with the help of ActionScript’s ExternalInterface Class and JQuery, creating this functionality was easier than I thought.

Continue reading

Checkout My New Site - T-shirts For Geeks

ActionScript: Removing all Children From the Stage

Actionscript, Flash

I ran into an interesting problem today when I attempted to remove all objects from the Stage. I didn’t realize that there was not an ActionScript method like removeAll (or something). After about a half hour of trying I was finally able to create a script that will remove all children from the Stage.

Continue reading

Checkout My New Site - T-shirts For Geeks

ActionScript: Extending Custom Classes

Actionscript, Flash

Extending a custom class with ActionScript is fairly straightforward. As part of my gpAS3Library, I have a button class (gpButton) that extends a shape class (gpShapes). Originally (in my AS2 version), I instantiated the shape class from within the button class and the shape class was always a separate entity. Now that I have created the button class by extending my shape class, interacting with and manipulating the button is much more tidy and easier to maintain.

Continue reading

Checkout My New Site - T-shirts For Geeks