When I am writing a flash app or game which uses the keyboard to control a character's movement, there is a situation that becomes annoying while controlling the character. I do not know the proper term for it ("sticky keys"?) but I will describe it...
When an app or game is written we "expect" the user to precisely press the proper key or key combination at a time to execute programmatic actions. However, most of us have ten fingers and we use more than one finger to press more than one button on the keyboard. The expected program reaction from multiple fingered keyboard input might not occur because you have another function executing when you expect just one at a time. Read the rest of this entry »
Dynamically listing the properties of a class is pretty cool and useful. There are many things you could do by generating a list of existing properties. One example is you can make your class instances represent themselves dynamically in a custom format of your choosing. Like how "toString()" is use with the Array class or how Point is represented when toString() is called from it. Going further, listing current properties could be used to save the current values of the class as a "save point".
In the Flex framework, there is ObjectUtil.getClassInfo().properties, but I feel is more useful to just use the XML returned from the describeType method. I like using decribeType for both plain AS3 or when using the Flex framework because its accessible in both.
Since the return of describeType is XML I have more options with E4X filtering/Regular Expressions, than using getClassInfo(). With describeType I can get info on methods as well but to keep things simple I'm only talking about accessor properties in this post. Using the "listProperties" function, I am listing the properties between 3 different classes. This is a function I wrote to show how you can make your own way to use the XML of decribeType.
In the example SWF below, there are 3 classes under inspection. The Helicopter class is a custom class extending Sprite. By setting the parameters of listProperties you can list the properties of Helicopter, or all of the properties it has by being subclassed from Sprite. The other classes are a TextField and a Sprite class. Changing the options lists a different set of properties based on type of Class of properties listed and what class its properties are declared by.
Does anyone out there throw together rough tools to solve eccentric problems that drive you nuts?
I run into problems with point data occasionally and it's hard to find a solution for using the data, when I can only view the problem in messy code format.
This sometimes leaves me wondering if the function I'm writing is even working correctly or not.
The example below is a rough tool I made to visualize and edit the Array format of points I usually work with. Over time I have transformed, gutted, and replace its code for different tests I needed it for. (The insides are not pretty.)
Yep it looks like a drawing tool, just not intended for that. I've only added certain "drawing" features I needed to make it easy to visualize the data I'm working on.