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:
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.
I have nearly completed my new portfolio site. I built it using Flash and Joomla. I created a Flash application to display the actual portfolio (thumbnails, links, etc). I then created a Joomla component and module (gsPortfolio) that incorporates the Flash portfolio application.
When I created the Joomla template for my site, I designed it specifically for the display my portfolio. Unfortunately, this layout was not generic enough to accommodate secondary pages (my portfolio is displayed on the home page). After looking at the code of the JA_Purity template, I was able to figure out how to create multiple views in a single template.
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.
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.
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.
Although, I have been creating Flash Classes for some time, I had never created a class for my main Flash document – it has always been just a bunch of ActionScript functions. This wasn’t the OO way, so I decided to use the Document Class for the current application that I am working on. I was easy to set up.
I began loading thumbnails using AS3′s URLRequest and URLLoader in my main application file. I decided to create a package that would request/load the thumbnails, but I needed to return the data from the URLRequest to my main application. I was able to accomplish it using the dispatchEvent method.
I’m working on a Flash/AS3 application where I am loading various types of files (images, xml, etc). After writing the same code over and over again, I decided to create an AS3 class to use with my application. This class will load image, swf, text, xml, html, stylesheet, json, and sound files.