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

Archive for the 'Flash AS3' Category

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

Feb 09 2011

FlashDevelop, Flex SDK, Windows 7, Missing DLL

Published by under Flash,Flash AS3,Others

This post is for my own future reference because I have forgotten about this problem until a recent reinstall of Windows 7.

After a clean install of Windows 7, trying to use compc and/or mxmlc from the Flex SDK through command line may yield a “System Error” message:

It seems like Microsoft somehow forgot to ship this Microsoft C Runtime Library DLL in Windows 7. When installing some programs, this DLL may be installed by the respective installers. If you encounter this missing DLL problem, the only way to fix it is to install one of these programs, or otherwise grab hold of the DLL from somewhere and place it in the correct folder:

For Windows 7 32-bit, place the DLL in
C:\Windows\System32

For Windows 7 64-bit, place it in
C:\Windows\SysWOW64

WARNING: Do not install DLL obtained from untrusted sources. You can actually copy the DLL from one of your old Windows OS installations. If you want to use my copy, here it is.

No responses yet

Aug 21 2010

[Game Programming] Consider A Different Approach To Cards Shuffling

Published by under Flash,Flash AS3,Tips

Very commonly, computer programs (usually games) that have the need to simulate a shuffling of a deck of cards (or drawing a tile from a bag, etc.) will go the obvious way of putting the items in an array, and then randomize the order of the elements of the array. A common algorithm for doing that is the Fisher–Yates shuffle (you can find a suitable implementation easily by googling).

The purpose of this post, however, is not to discuss “how” to shuffle arrays. Rather, I would like to bring up the question of “why” (do it) in the first place.

Continue Reading »

13 responses so far

Aug 19 2010

FlashDevelop: Getting trace() Statements To Show In Output Panel

Published by under Flash,Flash AS3,Tips

This is quite an obscure, little known, hidden-by-default feature, but the FlashDevelop IDE actually has a built-in Flash tracer. The plug-in is unfortunately not enabled by default, and new users of FlashDevelop often get frustrated wondering where to look for the output of their trace statements.

To get the tracer to work:

1) Go to Tools -> Program Settings (F10).

2) In the Plugins list on the left of the dialog box, look for FlashLogViewer and click on it.

3) On the right panel, look for the “Start Tracking” property, click on the drop down box and select “OnBuildComplete” (it is set to “Manually” by default).

The output of your trace statements are now shown in the Output Panel after you build your project.

2 responses 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

[AS3] Embedding Binary XML

Published by under Flash,Flash AS3,Tips

This post is a supplement to “Saving XML As Binary”. I neglected to mention in that post that you can, if so desired, embed the binary XML within your SWF instead of loading it during run-time. That means you still get to keep the XML externally, not as part of your application code, so that the code and data can still be kept separate and maintained more easily.

However, it must be mentioned that embedding a text XML within SWF will get it compressed as part of the SWF compression anyway. Therefore, if compression is the only motivation, don’t convert the XML to binary and embed the binary version – it does not make sense. But if you wish to do some data encryption, then the additional work may be appropriate.

Continue Reading »

2 responses so far

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 18 2009

[AS3] Drawing Outline on Text Glyphs

Published by under Flash,Flash AS3,Tips

Here is how you can draw an outline on text glyphs during run-time via ActionScript. This method works with embedded as well as non-embedded fonts.

Continue Reading »

No responses yet

Nov 16 2009

[AS3] Applying ROT128 Encryption On Binary XML

Published by under Flash,Flash AS3,Tips

This is Part III of our discussion on ROT128 Encryption.

Part I: “Applying ROT128 Encryption On ByteArray”
Part II: “Applying ROT128 Encryption On Embedded/Module SWFs”

In “Saving XML As Binary”, we looked at how text XML can be stored in a ByteArray object so that it can be compressed and made non-human-readable. In this post, we look at how you can integrate ROT128 into the XML-to-ByteArray-to-XML routines. Binary XML is used only as an example; you can definitely apply the same concept to other binary data.

Continue Reading »

2 responses so far

Nov 13 2009

[AS3] Applying ROT128 Encryption On Embedded/Module SWFs

Published by under Flash,Flash AS3,Tips

This post is a supplement to “Applying ROT128 Encryption On ByteArray”.

Some time back, we posted a simple technique for hiding assets and AS3 code from prying eyes by embedding one SWF within another SWF. In this post, we revisit that topic and look at how ROT128 can be used to provide an additional layer of protection.

Continue Reading »

3 responses so far

Next »