flash.utils.describeType
has been around since Flash 9 and is the standard way to find out interesting information about a Class
type, including its metadata/annotations. However, there’s a hidden function called describeTypeJSON
that provides an interesting alternative. Since describeType
is notoriously slow, could describeTypeJSON
be the speedy alternative we’ve been looking for? Today’s article puts them to the test!
Posts Tagged class
There are lots of ways to check the type of an object in AS3. These include the is
operator, the deprecated instanceof
operator, the constructor
field, and a combination of getQualifiedClassName
and getDefinitionByName
. Which is fastest, cleanest, and most effective? Today’s article puts them all to the test to find out!
You’ve probably seen built-in metadata tags like [SWF]
and [Embed]
, but have you ever wondered how you could add your very own, custom tags? Today’s article shows you how to add custom annotations to your AS3 classes and methods. Mark old methods of your library with [Deprecated]
, file format classes with [Version]
, or anything else you’d like. Today’s article shows you how.
When you instantiate one of your classes, how much memory does it use? Today’s article tries out a lot of combinations and counts the bytes used. The conclusion is easy to remember and will give you a solid understanding of how much memory your app is using.
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.
To save precious bandwidth, keeping your AMF data size small is crucial. By default, AMF has a tendency to create bloated data sizes. In the last article, I showed a way to shrink your class names to a single character when stored in AMF data. Today I’ll show a you a trick to shrink your class field names to a single character. Read on to find out how.
I’ve talked about AMF serialization size before, but there’s one tip I left out. Today’s article shows you one crucial step you need to take to make sure your AMF data is packed as tightly as possible so you’re not wasting file size or bandwidth.
The [Embed]
metadata tag has been in AS3 since the beginning, but few know how to use it fully. Today’s article shows how you can go beyond the standard usage to maximize the usefulness of [Embed]
. Read on for some useful tricks you may not know about and take another step toward mastering AS3.
If you want to check if one class inherits another without actually having instances of those classes, you may have read my article on Checking Class Inheritance. However, as the many comments quickly pointed out, the methods of checking this may have some flaws. There were also additional methods posted in the comments that should be added and tested. Today I’m adding them, testing them, and checking all of their validity to find the ultimate approach to check class inheritance.
The const
and final
keywords only apply at compile time. Despite having written about const and final before, readers frequently ask me about these two keywords. Today’s article will answer the question and definitively show that these keywords only apply at compile time: not runtime. UPDATE: const
is still just a variable as far as performance goes, but its protections do extend to runtime.