Posts Tagged class

describeType vs. describeTypeJSON

Tags: , , , , , ,

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!

Read the rest of this article »

7 Comments

The Right Way to Check An Object’s Type

Tags: , , , , ,

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!

Read the rest of this article »

5 Comments

Custom AS3 Annotations

Tags: , , ,

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.

Read the rest of this article »

2 Comments

How Big Is That Class?

Tags: , , , , , , , ,

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.

Read the rest of this article »

5 Comments

XML Operator Speed

Tags: , , , , , ,

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.

Read the rest of this article »

4 Comments

How To Shrink Field Names in AMF Data

Tags: , , , , , ,

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.

Read the rest of this article »

2 Comments

How To Minimize AMF Serialization Size

Tags: , , ,

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.

Read the rest of this article »

4 Comments

Get Control Over [Embed]

Tags: , ,

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.

Read the rest of this article »

9 Comments

Better Ways To Check Class Inheritance

Tags: , , ,

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.

Read the rest of this article »

2 Comments

Compile Time Only

Tags: , , , , , ,

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.

Read the rest of this article »

13 Comments