Wednesday, May 7, 2008
I have a gallery application that uses two instances of a Loader. Instead of creating/destroying the instances, I re-use the instances... but for me to make swapping galleries (full swap), I needed a way to clear out the images in the Loader instances... essentially creating a reset method in my gallery class.
Well... there isn't an obvious clear() anywhere, and when you inspect the contents of a Loader instance (that has been loaded successfully), you'll notice it's BitmapData. Okay... so we need a way of throwing out that type of data. We have the dispose() method.
However, depending on where one might be in the cycling of images (fading), you might have a Loader that doesn't presently contain BitmapData. This might be when you're only one image into the whole cycle of images... trying to clear out both at once in the reset would throw an error.
The code below reflects usage that works for me right now.
var li = child2.loader.contentLoaderInfo;
if( child2.loader.content != null )
{
if(li.childAllowsParent && li.content is Bitmap)
{
(li.content as Bitmap).bitmapData.dispose();
}
}
var li2 = child1.loader.contentLoaderInfo;
if( child1.loader.content != null )
{
if(li2.childAllowsParent && li2.content is Bitmap)
{
(li2.content as Bitmap).bitmapData.dispose();
}
}
So this checks the contents of each of the loaders and then clears the contents out... then I am free to load up the new XML and start my timer, etc. It works... before I was getting mucked up cycling after a gallery switch.
Tuesday, March 4, 2008

I finally managed to get a 20" x 48" roll print of the ActionScript 3.0 Class Diagram [reference] to print (updated with AIR APIs), and even at this size, its probably close to 50% of how large it actually needs to be printed. Combine this with the Flex posters (new and the old powder blue ones) and I could probably fully wallpaper a decently-sized bathroom.
I taped the AS3 one up on my locker so the department has full access to it. Very nice. That must be one huge ass Illustrator file someplace in bowels of Adobe. A lot of work went into these, thanks Adobe!
Friday, July 6, 2007
package
{
import flash.display.DisplayObject;
import flash.events.Event;
import flash.display.Sprite;
import flash.geom.ColorTransform;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
// XML-Specific
import flash.events.ErrorEvent;
import flash.xml.XMLDocument;
import flash.net.URLLoader;
import flash.net.URLRequest;
/**
* AS3.0 Class to provide user selection of various
* Flash-specific resource documentation/files.
*
* Author: Eric E. Dolecki
* Copyright: 2007, Eric E. Dolecki
*/
public class Resources extends Sprite
{
private var BaseColor:Number = 0x414042;
private var RollOverColor:Number = 0xCCC2C0;
private var SelectedColor:Number = 0xF15B40;
private var navArray;
private var nCurrentSelection:Number = 0;
public var sectionId = "";
// XML-Specific
private var urlLoader:URLLoader;
public static var data:XML;
public function Resources()
{
navArray = new Array();
xmlLoader();
};
}
}







