Posts in Category "Flash / ActionScript"

New blog on using Flash, and AIR as it pertains to Flash CS3

A quick public service announcement that I have started up a new blog at a new domain ( I’ll be blogging about Flash authoring tool there (now that I re-joined the Flash team… by the way), instead of here.

Also, I just blogged about the AIR update as it pertains to Flash CS3 (mostly – where can you get that update??)

New Resources on Adobe Labs – AS3 Class Libraries

As learnt at FlashForward keynote(, new class libraries up on Adobe Labs as follows:

1 corelib (basic utilities)
2 FlexUnit
3 Flickr
4 Mappr
5 RSS and Atom libraries
6 Odeo
7 YouTube

Check out the details, and download the open source libraries from here:

Flash Player version penetration: new stats are up for Flash Player 8

The new NPD survey results are online for Flash Player 8. Please take a look at the amazing results here:

Worldwide Ubiquity of Macromedia Flash Player by Version – December 2005

For Flash Player 8, note:

US: 45.2%
Canada: 56% (!!!)
Europe: 55.1%

Way to go, Player 8!

Event Listeners in Flash Macrochat

So many Macrochats!! Here’s another, on Flash this time!

Event Listeners in Flash Macrochat
Tuesday, June 7, 2005
1:00 PM – 2:00 PM US/Eastern

To Register:

Event Listeners in Flash: From OnHandlers to Listener Objects–the right way! Many Flash developers are still using outdated event handlers to catch events. This was fine for ActionScript 1.0, but ActionScript 2.0 users and v2.0 components users should be using Listener Objects to catch events. Macromedia Product Support Engineer Bentley Wolfe will lead this live discussion on how to migrate away from On Event handlers and towards the correct use of listeners.

What You Will Learn

Using event handlers and click handlers
Where event handlers won

MediaPlayback scrubbing event

1. Drag a MediaPlayback instance onto the Stage.
2. Open the Component Inspector panel and enter an instance name of my_mp
3. Type in a URL to some FLV video of yours.
4. Open the Actions panel and paste the following code:

my_mp.addEventListener(“scrubbing”, scrubbingListener);
function scrubbingListener(evt_obj:Object):Void {
trace(evt_obj.type+” @ “+getTimer()+” ms (isScrubbing=”+evt_obj.detail+”)”);

5. Ctrl+Enter to test.
6. Scrub that video (that means drag the playhead). The Output panel will open and tell you where you scrub and true/false.

Don’t know if that’ll be useful to any of you or not, but there you are.

Flash player statistics updated

To read the latest Flash Player statistics, head to:

To read about how the survey is conducted, see:

Avoiding sandbox messages

You might notice that, inconsistently, you see security sandbox errors when you create things in Flash. To clarify ‘odd time’ — if I load a JPEG into a Loader I don’t see the message, but if I load a JPEG into the ScrollPane I might see the message every 4/5 tests. Note: You only see the message in the Output panel (ie: in the test environment – when you Ctrl+Enter) – the SWF works in the test environment despite the message, and there is no message outside of the test environment.

I didn’t pay it much attention, but did run across this blog post recently:

Therefore, if I load a JPEG from and want to avoid seeing the message, I can add the following to the code:“”);

Then you won’t see anything in the Output panel.

So yes, pre-blogged but worthwhile nonetheless.

satellite images in Flash

Loosely staying with the theme of maps, this time check out a really cool Flash implementation of a satellite image viewer. You might be able find and zoom into your house (I did!)

Check it out the top 10 images here:

You could even catch an image of a building, such as our new office here.

Just need another zoom level to spot those pedestrians 😉

Using XPath with Flash

A blog post of mine from yesteryear, but the issue came up recently (and the class is undocumented) so I thought I’d reblog it.

Flash MX 2004 introduced the XPathAPI class which allows you to do simple XPath searches within Flash. This can be very useful for searching XML packets based on node names and attribute values.

In order to use XPath searches within Flash you first need to include the XPathAPI class into your Flash library by including the DataBindingClass if it hasn’t been included already. If you’ve already set up bindings this class may have been included automatically, otherwise you’ll need to select the class from the common libraries by selecting Window > Other Panels > Common Libraries > Classes. From the Classes.fla library panel you can simply drag a copy of the DataBindingClasses component into your current Flash document’s library. Now you can import the class by typing “import mx.xpath.XPathAPI;” or by using the classes fully qualified name when accessing its methods by prefixing the class’ methods with mx.xpath.XPathAPI.”.

The XPath class has two methods; selectNodeList and selectSingleNode. The selectNodeList method returns an array of XML nodes matching the XPath expression, whereas the selectSingleNode returns only the first matching node.

You can see an example of the XPath API in ActionScript below, before you can test the movie you have to make sre that you have a copy of the DataBindingClasses component in your movie’s library by dragging it from Common Libraries > Classes into your current Flash movie’s library.

import mx.xpath.XPathAPI;
var rssfeed_xml:XML = new XML();
rssfeed_xml.ignoreWhite = true;
rssfeed_xml.onLoad = function(success:Boolean) {
  if (success) {
    var titlePath:String = "/rdf:RDF/item/title";
    var title_array:Array = XPathAPI.selectNodeList(this.firstChild, titlePath);
    for (var i = 0; i<title_array.length; i++) {
  } else {
    trace("error loading XML");

If you want more info on this class, check out Nate Weiss’ book here.

Tweening with ActionScript

So the Tween/Transition stuff wasn’t put in the Flash documentation. Good news is that there’s now an article on the Developer Center about using the classes. Bad news is the article came from me 😉

If you haven’t used the classes yet, check the article out out anyway, see if it helps you with your Flash work. Fairly simple article (had to keep that word count in check…)

If you have any ideas for expanding the content, or wish to share some of your own tips, please comment below.