Object-Orientated Programming in Adobe Flash Lite 2.x

Object-Orientated Programming in Adobe Flash Lite 2.x

Object-Orientated Programming in Flash Lite 2.x

In this post i will show how you can use custom classes while developing your mobile application in Flash Lite 2.x with the ActionScript 2.0 code.

As many of you already know how to do this in ActionScript 3.0 there are some slight differences while using Flash Lite 2.x.

Why use the Object – Orientated approach?

In my understanding , it is very usefull when working with a larger amount of data. With this approach we can just make Objects with the different properties , and when making these new objects we just assign the matching values to its constructor.

Example: imagine we are working with a XML-file containing thse records


You can see that we the image , id , name and adress fields are re-used with every item. So in this case we can define those properties in 1 Object , and every time a new item is made/loaded we can just assign those new values to its constructor and store them in a array. It’s a better and more structural of working , and you don’t need to push every single item into a new array.

Making a new Object – Class

Location Class

Importing and Using these custom Object Classes



If you look at the output screen , you will see the traces when creating a new object , and the traces when looping the location array.


This way of working is very interesting for any Flash Lite developer , no need of making different arrays for the properties when we can just create an Object with these properties and push that Object into 1 single array.

About the Author

Daan is a Creative-Geek who loves learning and sharing new techniques! Follow him on Twitter to keep up to date with the Creative-Geeks blog and other subjects. Contact him on e-mail : info[at]creative-geeks.com.