Currently Browsing: ActionScript 3

Undo in TextFields

I presented on creating your own undo/redo at 360 MAX unconference and a uFlash meeting. People seemed interested in knowing how to do it, but were more interested in having the code. It really should be part of Flex TextAreas and TextInputs. So I was going to code up a couple custom components that extended TextArea and TextInput (e.g. UndoableTextArea) and release them for use. However, as Tyler reminded me, that wouldn’t work in Flash apps, only Flex. So I have a proposal and would like to get your feedback. If I created a component that you put on the root of your application (or any...read more
Page 3 of 41234

Finally getting my preso up

Here’s a PDF version of my presentation. Advanced ActionScript APIs Presentation read more
Page 3 of 41234

Don’t use Number to iterate over for-loops

A while back I read a couple of blog posts about the slowness of using uint and int to iterate through for-loops. I needed to do some testing for a little project today and found this is false. When using the “i” variable in for(var i = 0; i < length; i++) as an input into mathematical operation, especially when doing fractions, Number is faster for obvious reasons. This was established in the posts of the previously mentioned blogs. But when simply iterating over an array which is a very common use-case for for-loops uint is faster. Here is my test setup: var value:Object; var arr:Array...read more
Page 3 of 41234

Using Your Own Custom Metadata in AS3

Flex 3 gives us a great new feature, custom metadata tags. Now, I know you could actually use custom metadata in Flex 2, but you would have to add "-keep-as3-metadata MyTag" to every single project that utilized these custom tags. In Flex 3, if you add "-keep-as3-metadata MyTag" to a library (using compc to compile a SWC or a Flex Builder Library project), then EVERY project that uses that SWC will automatically keep the "MyTag" metadata tags. This allows custom libraries that utilize these tags for development. Would be cool to create a library to hook up listeners so you can create listeners...read more
Page 3 of 41234

Flight Stealth, a Flex Component Alternative

The first question you probably have after seeing the title of this post is "why would you make an alternative to Flex?" Or perhaps, "how could you even think of competing with Flex?" Honestly, we aren't trying to compete. This will be open source. And alternatives are always nice to have. We could talk about how difficult it can be to extend the Flex components, how limited the styling is, or how Flex makes complicated things easy and easy things complicated, but the fact of the matter is we just thought building an alternative would be fun. Now, that being said, I think we're going to have a...read more
Page 3 of 41234

Binding to Container children in Flex

I guess this week is my week for creating AS3/Flex hacks. I created an XML encoder/decoder that will accept a class-map and create your model from your XML and visa-versa. As part of that I have display objects as part of the model that needs saving out. I suppose you could liken it to MXML. In order for the XML encoder to work with DisplayObjectContainers I had to give it a way to work with an ArrayCollection to add or remove the children. So I subclassed LayoutContainer and gave it a property called "children" which is an ArrayCollection. Then I set up as a listener to it and every time something...read more
Page 3 of 41234