In almost all circumstances, Stage3D
requires you to provide textures with power-of-two dimensions. This is often inconvenient as most images are not already sized that way. Today’s article provides a simple class to easily build a texture with power-of-two dimensions. An example app is also provided.
Archive for category AS3
AS3 has always had great support for XML built right into the language, but how fast is it? Today’s article compares the performance of operators that work on XML
objects like .@x
, .x
, ..x
, and ["x"]
against their equivalents in plain Object
instances and typed class
instances. Just how slow are the XML operators? Read on to find out.
There are four Vector
classes in AS3. It seems like there is only one—Vector
—and that it supports generics, but that is only an illusion. Today’s article will do some tests to reveal the implications to your app’s correctness and efficiency.
When you request a Context3D
you’ll either get the requested profile or software rendering. But what if you’d rather fall back to a lesser hardware context? What if your app can make use of the regular/baseline profile but can run with reduced graphical effects using the constrained mode profile? Today’s article presents a utility class that makes it a snap to always get the best Context3D
that Flash Player can give you.
AS3 has never had very good support for multi-line strings… until now. Today’s article discusses the proper and improper ways of writing multi-line strings and delves into the bytecode so you really understand what’s going on.
The last article gave a very basic example of the flash.concurrent.Condition
class introduced in Flash Player 11.5. That example was (hopefully) a simple and easy way to understand the mechanics of how the Condition
class works. Unfortunately, it was not a useful example and actually demonstrated the opposite of what you’d want to use it for. Today’s article shows a somewhat more complicated example that should serve as an example of appropriate usage for Condition
.
The Condition
class that debuted alongside the Mutex
class in Flash Player 11.5 is very useful but much less understood. Unfortunately, Adobe’s documentation doesn’t include a usage example and there seem to be none available elsewhere on the internet. So today’s article provides an example of how to use the flash.concurrent.Condition
class.
In the last article we learned that a ByteArray
shared between two workers also shares its length
field but not its position
field. This raises a followup question: what about when the length changes? Today’s article sees what happens when you change the length of a ByteArray
that is shared between two ActionScript workers to see just how shared that length
field really is.
ActionScript workers allow you to take advantage of today’s multi-core processors by creating multiple threads of execution. These threads will invariably need to share some data between them. By default, all data passed between the workers/threads is copied, which can be really slow. The ByteArray
class can be shared without copying. Today’s article discusses this and talks about some quirks that come along with it.
The assert
function is found in many languages to provide a way for you to check for errors only in debug builds of your code. For release/production builds, the asserts are removed to make the compiled code smaller and remove all of the overhead of the error checking. Flash doesn’t come with such a feature built-in, but can we build one ourselves? Today’s article will try to do just that using nothing but Adobe’s modern AS3 compiler: ASC 2.0.