GhostWire Studios - Flash/Flex UI Components Development And Consulting Services
Quality User Interface Controls For Flash Application DevelopmentAspireUI Components

Aug 16 2011

[AS3] Referencing Embedded Assets Of Another Class Using Underscore

Published by under Flash,Flash AS3,Tips

This is rather unorthodox but it works. In Flash, when you embed an image into the SWF using a static class member of a class, a new class with the name of CLASSNAME_MEMBERNAME is actually created internally. Using flash.utils.getDefinitionByName(), you can access this class, regardless of whether the static member was declared as public or private. This makes it possible to make a very simple embedded image assets manager.

Continue Reading »

One response so far

Dec 13 2009

[AS3] Serializing A Bundle Of Bitmaps As Data Objects

Published by under Flash,Flash AS3,Tips

This post is a supplement to “Serializing Bitmaps (Storing BitmapData As Raw Binary/ByteArray)”. In that article, we looked at how to convert BitmapData to a ByteArray, save that ByteArray, and re-construct the BitmapData from the saved ByteArray.

It is important to note that the technique saves the ByteArray “as is” in a flat binary file without any header or any block of metadata – this means that the file will in itself not be able to communicate its data structure and therefore, proper usage of the data requires prior knowledge of how the data has been packed (we used the first four bytes for storing the value of the width of the image). As a result, that method may be deemed as an “unorthodox” hack and unsuitable in team development.

In this post, we look at how you can employ the same basic idea while making the saved data more “consumable” by other developers.

Continue Reading »

2 responses so far

Dec 04 2009

uiImage: Preloading External Bitmap Images

Published by under Aspire UI,Tips

The uiImage class is used to display an image, the source of which can either be a MovieClip symbol in the library, or an external SWF/GIF/JPG/PNG file.

When using external bitmap images (GIF/JPG/PNG), the uiImage class will load from the external source only once and use cached data if the same source is requested subsequently again by the same or other uiImage instances. This is efficient because the same BitmapData is used across different uiImage instances that use the same image source. This is why image icons in Aspire UI scrollable lists do not suffer from the “flickering” symptom (which you will experience when using Flash/Flex components).

Continue Reading »

No responses yet

Dec 03 2009

[AS3] Serializing Bitmaps (Storing BitmapData As Raw Binary/ByteArray)

Published by under Flash,Flash AS3,Tips

Whenever an application needs to save bitmap images to local storage or post them to a server script, a common practice is to encode the image as JPEG or PNG before sending that binary data off as the respective mimeType. However, if the intention is simply to save the bitmap image, ie to serialize the BitmapData, then converting the image to JPEG/PNG would actually be unnecessary.

Continue Reading »

8 responses so far

Nov 10 2009

uiImage: Using Embedded And/Or Dynamically Generated BitmapData

Published by under Aspire UI,Flash,Tips

The uiImage component is used to display non-interactive images.

The source property is a String value and determines the image source, which can be an external image file (property value specifies the file name) or an image embedded in the SWF (property value specifies the class name).

This means that the image source has to be expressed as a String value, which is not always possible. For example, a Bitmap could be dynamically generated during run-time and you may wish to (re)use its BitmapData as the source in uiImage instances.

As of Aspire UI Version 1.3, the uiImage class has a static registerBitmapData() method. You may use this method to register a BitmapData object in the image cache, giving it a unique id. Subsequently, you will be able to use the id as the image source for uiImage instances.

Continue Reading »

No responses yet