Stanford’s Sean Eron Anderson has a great page titled Bit Twiddling Hacks. This is a great resource for C programmers looking to employ bitwise operators (& | ^ ~ << <<< >> >>>
etc.) to speed up their code. But what about AS3 programmers? We have bitwise operators too, but will the same tricks work for us? Today’s article ports some of these bit twiddling hacks to AS3 and tests to see if any ground is gained.
Archive for category AS3
ATF textures already contain a lot of compression: DXT, ETC, or PVRTC texture compression plus JPEG-XR and LZMA for good measure. What more can we do? As it turns out, we can drastically reduce the file size by simply applying Zlib or LZMA compression to the files. Read on for some samples with file size breakdowns.
Adobe’s newly-released ATF tools have introduced an all-new image file format: ATF, the Adobe Texture Format. It’s not every day we get a new image format. After all, PNG was introduced in 1996 and JPEG in 1992. For various reasons I discussed last week, you probably have good reasons to use this new image format. So let’s dive into it a bit and see what kinds of images it produces.
Adobe has recently released tools to allow us to use compressed textures with the Stage3D
API via their ATF tools. What are these compressed textures? Why would we want to use them? How do they work? Today’s article is an overview of compressed textures covering these questions and more.
Flash Player 11.3 added a new way to compress and uncompress ByteArray
: the LZMA algorithm. This is useful because LZMA typically compresses to much smaller size than the existing zlib and deflate algorithms. But how much of a speed penalty does it incur? Today’s article seeks to find just that!
If you’ve ever used Instagram, you know about post-processing: full-screen effects applied just before the final image is shown to the user. With Stage3D
, we can do similar effects in real time with our 3D or 2D scenes! Today’s article will introduce you to the basic concepts behind post-processing effects and show the code for a few simple post-filters. Read on!
Chances are you’ve been bitten by the ErrorEvent
class at some point while programming AS3. It’s the asynchronous equivalent to throw
an Error
and it happens when, for example, a Loader
‘s load fails. If you write any code that performs an asynchronous task, perhaps more file loading, you too may want a way to inform users of your class that the task has failed. Just like with Event
, it’s nice to be able to add data on to the standard ErrorEvent
class. How does this work? Let’s dig in and find out.
Textures are usually simple bitmaps, but what if you wanted to use something more dynamic? How about a SWF you’ve created in Flash Professional? How about a Sprite
or MovieClip
you’ve created in code? Today’s article will show you how to do just that.
Try as I might, I just couldn’t find any articles about AS3’s finally
keyword. Sure I found Adobe’s documentation, but it seems no one is commenting any further about finally
. So today I’ll tackle the performance of what seems to be a straightforward keyword. Could it possibly cause a slowdown? Read on to find out!
AS3 has three kinds of loops—for
, for-in
, and for-each
—but which is fastest? I attempted to answer that question about three years ago, but the article is in dire need of a followup as many version of Flash Player have been released since then and the question is core to our everyday lives as AS3 programmers. So which type of loop is fastest in 2012?