enum types are an easy and efficient way to make an integer type without all the overhead of something like a
class or even a
struct. They’re basically a synonym for an integer type like
int. However, that “basically” hides a lot of details that affect the way you can work with them. Today’s article explores the arithmetic and operators you are and aren’t allowed to use when you opt for an
enum over an
int so you’ll have a better understanding of how and how not to use them.
Posts Tagged operator
As with types and variables, there is a lot of subtlety in the differences between AS3 and C# when it comes to loops, casts, and operators. As core parts of the language, it’s important that we know all the little details of our most fundamental tools. Read on to learn what they have in common, what new operators C# offers, and what operators C# doesn’t have.
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"] against their equivalents in plain
Object instances and typed
class instances. Just how slow are the XML operators? Read on to find out.
This is an extremely common task: converting a
Number to an
int. There are a lot of ways to do it, but which is fastest in AS3? Today we’ll look at a performance test app that attempts to find the fastest way to accomplish this. The answer just may surprise you!
I recently received a tip about a thread discussing an interesting problem: how to tell if one
Class object represents a class that subclasses another
Class object. If you had an instance of the class, you could simply use the
instanceof keywords, but that won’t do here. Today’s article shows how to solve this tricky problem.
Logical operators are necessary in every app, so it’s unfortunate that they are so slow in AS3. That’s why I was happy to see a potential alternative in a recent comment by Skyboy. Today’s article shows you how to do logic faster by avoiding logical operators (e.g.
&&) and using their bitwise (e.g.
&) operator counterparts instead.
There are actually three ways to call a function in AS3. Can you name all three? Do you know which is fastest? Does the type of function being called matter? Today I’ll tackle these questions and find some surprising facts about the three ways to call a function in AS3.