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

Archive for the 'Tips' Category

Nov 09 2009

Aspire UI: Applying Background Glow+Shadow

Published by under Aspire UI,Flash,Tips

The “background” property defined by the com.ghostwire.ui.core.uiComponent class determines the style of the background for a component instance – color, opacity, border color, border width, gradient fills, and corner radius.

By default, no background will be drawn. The following is an example on how to draw a simple background:

Continue Reading »

No responses yet

Nov 07 2009

[AS3] Simple Editor For Loading And Saving XML As Binary

Published by under Flash,Flash AS3,Tips

This post is a supplement to “Saving XML As Binary”.

As mentioned in the previous post, you can save XML in binary and get the benefits of compression, but doing so would make it impossible to edit the data through a text editor.

This post explores a simple tool you can create easily using Flash/ActionScript 3, a tool that will allow you (or your clients and end-users) to load, read, edit and save XML in compressed binary format. As shown below, this is a minimalist approach – feel free to beautify and/or customize it to fit your own requirements.

You can find the source code at the end of this post. The code does not use any UI component, not from Aspire UI, Flex or Flash, just plain native Flash Player classes so you can compile the AS3 class alone without any additional library.

Continue Reading »

10 responses so far

Nov 06 2009

[AS3] Saving XML As Binary

Published by under Flash,Flash AS3,Tips

This could be useful if you have an external large, verbose XML file which your application must load during run-time. By saving the XML as binary, you can compress the data and get a much smaller file. Of course, the amount of compression you can get depends on the complexity of your data, but it would typically be over 50% (conservative estimate).

Admittedly, having the XML data in compressed binary format contradicts the original intention of using XML in the first place – to allow human-readable data. Therefore, you will have to decide what exactly is important for your application before proceeding. Perhaps having cryptic external data is indeed what you want – allowing data to be externalized so they can be changed without requiring the SWF to be recompiled, and yet would prefer the data to be non-human-readable.

Continue Reading »

8 responses so far

Nov 05 2009

[AS3] Hiding the Built-In Native MenuBar (And ContextMenu Items)

Published by under Flash,Flash AS3,Tips

By default, the SWFs you publish will show a native menu bar (the pull down menu showing the items File – View – Control – Help) when run locally. The same case applies to Projector (.exe) files published either from the Adobe Flash IDE, or created from local SWFs using the File – Create Projector… menu item from the native pull down menu.

flash menu bar


In my opinion, this menu does not add any functionality to any Flash application, is as useless as the built-in contextMenu items, and should always be hidden. Luckily, it takes only one line of code to hide the menu.

Continue Reading »

No responses yet

Oct 07 2009

[AS3] Truncating ByteArray Does Not Dispose Contents, Free Up Memory

Published by under Flash,Flash AS3,Tips

When targeting Flash Player 10 or AIR 1.5, you can use the clear() method of the ByteArray class to explicitly clear the contents of the byte array and free up the memory otherwise used by the bytes. The length and position properties are reset to zero after calling the clear() method.

Unfortunately, when targeting Flash Player 9, this clear() method is not available. If you are using a ByteArray object as a data store, keeping a reference to the object and therefore not allowing the object to be garbage collected, do take note that there is no way to clear the contents. This means that the size of ByteArray objects can only be enlarged and never shrunk.

It is important to note that while you can truncate the ByteArray to zero byte by setting its length property to zero, this will not dispose the contents or free up the memory used.

Continue Reading »

2 responses so far

Sep 16 2009

uiBox: Implementing Some Common Layouts

Published by under Aspire UI,Flash,Tips

The uiBox is a layout container that automatically organizes its child objects horizontally in a row or vertically in a column based on some pre-defined “layout hints”. In this post, we look at some common simple layouts that you can implement using this component.

Continue Reading »

No responses yet

Sep 10 2009

[AS3] Difference Between Stage Size, Screen Size And SWF Size

Published by under Flash,Flash AS3,Tips

In this post, we look at three different pairs of width and height properties that are commonly misunderstood – “stage.width/stage.height“, “stage.stageWidth/stage.stageHeight” and “loaderInfo.width/loaderInfo.height“.

Continue Reading »

4 responses so far

Sep 07 2009

[AS3] Finding Occurrences Of A Sequence Of Bytes Within A ByteArray

Published by under Flash,Flash AS3,Tips

The following is a simple way to search within a ByteArray for specific patterns of bytes. At the end of this post is a ByteArrayUtils class that contains the indexOf(), indicesOf and lastIndexOf() methods discussed below. If you just want to grab the code and skip all the walk-through, please feel free to jump there.

Continue Reading »

No responses yet

Sep 05 2009

uiImage: “maintainAspectRatio” Property

Published by under Aspire UI,Flash,Tips

This post is a supplement to “uiImage: Resizing While Maintaining Original Aspect Ratio”. In this post, we will look at the maintainAspectRatio property of the uiImage class and see how it affects resizing when it is set to true.

Continue Reading »

One response so far

Sep 04 2009

uiDialog: Displaying Custom Dialog Content

Published by under Aspire UI,Flash,Tips

A modal window is a window that must be dismissed before interaction with the other parts of the application can be resumed. This is usually used to draw attention to a certain task at hand.

The uiDialog class helps to display simple modal windows. There are three types of built-in dialogs you can call up using the show() method of the class.

Continue Reading »

No responses yet

« Prev - Next »