Archive for the ‘Actionscript’ Category

Integration tier with ActionScript 3

Of all the new features of ActionScript 3, one of the coolest has to be the ability to create new instances of the movie MovieClip class via ActionScript, then add them, move them around, and remove them from the display hierarchy as required. This gives us a much more flexible level of control over the movieclips in a Flash movie.

One side benefit of this, is that we finally have the ability to separate the integration tier of our movies, that which communicates with our server sending and fetching data, from the control and display tiers, which are concerned with management of data within our movie, and the display of data to the user.

For example in AS2 we can create a GetXML class that loads XML data from a specified source, then broadcasts an event when that data is loaded. Other classes can then decide what to do with this data and how to display it to the user. They may even decide to defer the display of this data until some other event. However, if the data we are dealing with is an image file, we don’t have anything like the same control.

A standard practice would be to load the image into its container MovieClip using loadMovie, or the MovieClipLoader class. A drawback of this is that the image is displayed as soon as it is loaded, unless we choose to hide the container clip. Also this means it is usually our control and display tiers doing the loading of the data, breaking down the separations between these and our integration tier.

With ActionScipt 3, we can use the new Loader class in a separate integration tier, in a similar way as we would for XML data etc. We can return the instance of the Loader class, containing our loaded swf or image file when we receive our integration tier events. It is then a matter of using our control tier to decide whether to display this data, using addChild to add the instance to our display list, or simply to hang on to it until it is needed in the future. This is exactly the sort of deferred use scenario, which up till now would have been impossible, and as an added benefit we have separated our integration tier completely from the other elements of our code, this leads to much better OOP, and code that is much easier to re-use in the future.

One great use of these techniques would be an image caching utility, which would load images beforehand as a user was navigating through a site. This utility would take care of displaying the images as needed, and with much quicker response times from the perspective of the user.

No Comments


Particle Playground

I’ve been working on a particle simulation class, similar to the particle playground tool in Adobe after effects. You can try it out in this example. I’ve tried to make the example include as many of the features of the class as possible. The example is flash 8, but the class works in 7.

Edit: this project has finished the beta stage and is available for purchase on flashden

No Comments


Actionscript best practice

Ok so since starting to look at AS3, i’ve been trying to be a lot more anal about the way I code. When AS3 fully hits the scene i’ll have no choice (unless i stick with AS2, which will probably be the route of choice for smaller projects) as it’s totally strictly typed and a whole load of other initially daunting things, but as I’ve been trying more and more to adhere to these standards. I’m seeing the benefits when code debugging etc start to pay off. Once you can get in to the habit of sticking to the rules that is.

But what of other un-required programming methods. Commenting, variable naming, and code order still aren’t set in stone, and while you can try to make your code as intuitive as possible, there’s still no hard and fast rules as to best practice in actionscript programming.

So i’ve come across this documentation. It’s a collaborative effort by Simon Wacker, Alex Uhlmann and Martin Heidegger, to document a set of rules regarding documenting your code using comments and javadoc, method naming, code layout, etc.

Some of it may be a bit too intense for small projects, but it’s definately a good set of guidelines to follow if you’re writing AS2 code that you’ll use again in the future, or if you’re working on collaborative projects. It’s also good reading for anybody taking the plunge into AS2 OOP.

1 Comment


Flash security problems.

This was always going to happen sooner or later. But microsofts involvement goes against all those predicting a microsoft macromedia RIA war.

In an unprecedented move, Microsoft has issued a critical advisory urging users to apply a critical update from Flash Player update from Macromedia.
Microsoft is aware of recent security vulnerabilities in Macromedia Flash Player, a third party software application that also was redistributed with Microsoft Windows XP Service Pack 1, Windows XP Service Pack 2, Windows 98, Windows 98 SE, and Windows Millennium Edition. The Microsoft Security Response Center is in communication with Macromedia and is aware that Macromedia has made updates that are available on their Web site.

According to macromedia:

The current version of Macromedia Flash Player (8.0.22.0) contains a fix for the vulnerability. Users who have already upgraded to Flash Player 8 are not affected by this issue. Macromedia recommends all Flash Player 7 and earlier users upgrade to this new version, which can be downloaded from the Macromedia Player Download Center. Updated versions of Flash Player 7 for Linux and Solaris, which contain a fix for the vulnerability, are also available from the Macromedia Player Download Center. For customers with operating systems that do not support Flash Player 8 (Microsoft Windows 95, Microsoft Windows NT, or classic Macintosh operating systems), please refer to the Flash Player 7 update TechNote.

So it seems more reason to upgrade your flash player (insert conspiracy theory ;) ). Good thing flash has its funky new auto update features. hopefully we won’t see too many of these in the future.

No Comments


The future of MTASC and AS3

Strange goings on at the MTASC camp. According to the author Nicolas Canasse, on the OSFlash mailing list, the next version of the open source compiler won’t use actionscript (huh?!) but will instead compile from its own proprietry language, and will also compile for NekoVM (i have no idea) and generate javascript too.

I realize that this is a free compiler, but it seems such a shame to not have an open source alternative to flash’s MMC. I’m not sure if this is a reaction to the flex 2 compiler, but if you’re working for a client who wants you to supply the source code for the project, in a format other developers can undeerstand, then it pretty much makes this useless. Add on the fact that you have to learn another language to do what you already can with as3, and this is one of the most bizzare developments ever seen in OSFlash.

In the words of one poster on the list “I am not meaning to be personally critical of anybody or there intentions but really, I think we need another language like we need a hole in the head.”

Word!

1 Comment


Macromedia launches labs .. lovely

Macromedia’s added to its bewildering array of sub portals with macromedia labs.

Macromedia Labs is your source for early looks at emerging products and technologies from Macromedia.

In Labs, you’ll find early access to downloads, samples, documentation, release notes, tutorials and more. Labs also includes forums and a wiki, where you can ask questions, discuss, and share your feedback with Macromedia.

Pretty intersting stuff. For starters they have alphas of flex builder 2 (zorn) and player 8.5. I get the feeling that they’re not going to release every emerging tech on this site, only the ones they want to build up pre-interest for, and with the fall of flex from a $15000 setup, only affordable by enterpise class clients, to a reported developer freindly sub $1000, i’m sure they’ll be interested to build up hype in the dev community.

1 Comment



  • SetPageWidth