Tag Archives: ActionScript 2

ActionScript 2 – XML CDATA returns undefined, or htmlText doesn’t work!

The problem:

Your XML file is fine, it validates as XML.  The file encoding and the xml declaration encoding match.  You can parse the XML, but when you try and put html inside a CDATA element, and then populate a dynamic textbox with it, either your formatting doesn’t work (the text still has <b> tags in) or it returns ‘undefined’.

The solution:

This could actually be a twofold problem, and is not helped along by Flash’s quirks.  Its most likely that you’re either;

  • Accessing the XMLNode incorrectly,

Or

  • Being tripped up by the Flash players’ slightly dodgy XML parsing.

Accessing CDATA correctly

Now, the way that you should be accessing Read More…

Exempli Gratia : Using Tweener

Tweener (caurina.transitions.Tweener) is a Class used to create tweenings and other transitions via ActionScript code for projects built on the Flash platform.

To use Tweener in your projects, the first step is to download the class files that will work with your project from the Google Code page for Tweener, and then we’ll get started.

Download Tweener

Read More…

Stop using mx.transitions.Tween;

If you’re still using Flash’s inbuilt Tween classes for you scripted animations, I suggest you stop – and start making things easier for yourself by using Tweener instead. Tweener is a class that replaces Tween, works for Actionscript 2 and Actionscript 3, offers a simpler interface for creating tweens, and has a larger range of easing options to work with.

What’s wrong with Tween?

The Tween class is ok – up to a point. It does what it’s supposed to, but once you start trying to integrate it with serious full-on Actionscripting you’ll notice a few snags. If you’re dynamically creating and removing objects, and then want to dynamically modify the tweens, your tweens will likely go crazy. Start a new Tween and there’s very little way you can stop it – even by removing its subject. Stacking Tweens doesn’t go down well either – if you create one to move an object left to right, and then mid-animation another to move it back to the left, things go ok until the point that the first animation should finish – whereupon your object will flick back to the finishing position of the first, and then resume the second animation. Read More…

Work in progress…

I decided to give my old uni project an overhaul, and to that effect I’ve been putting in a few hours work to convert the old project to Actionscript 2, and take advantage of the newer features of Flash. Aside from incorporating or replacing elements of the original code with classes, I’ve also made a few improvements on the visuals, and stripped out the player interaction in order to concentrate more on what interests me most – the AI ‘simulation’.

Give me a few more [weeks worth of] evenings and I think I’ll have a far more exciting display, but for the meantime; Read More…

Syncronising ScrollPane Components in ActionScript 2.

This is perhaps an unusual one – and one I haven’t seen anyone else make much fuss over, so here goes.

Using the standard Version 2 components (Flash MX2004+) I’ve been trying to link the movement of three components together. “No biggie” you’d think. You can after all, set listeners on the .scroll property of the component instance, and then use that to set the .scroll properties of the other instances. Well yes, that’s true – but looking closely at the movement of the ScrollPanes, you can see a slight lag in their movement. A bit of frantic scrolling can throw the whole thing out of place.
Read More…