Flash CS3 animator class and loading XML animation at runtime

May 4th, 2007

So there is a new animator class. It works like FuseXML. The animations are set by nodes and attributes.
To do this:

  1. start a CS3 document
  2. make an mc called ‘abox’
  3. make an animation
  4. select the animation
  5. Commands > Export Motion XML
  6. name xml file “motion.xml”
  7. create an actionscript layer
  8. Then load XML as usual.

add:

[as]import fl.motion.Animator;
import fl.motion.MotionEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.*;

var abox_xml:XML;
var requester:URLRequest = new URLRequest(”motion.xml”);
var loader:URLLoader = new URLLoader(requester);
var abox_animator:Animator;
loader.addEventListener(Event.COMPLETE, startAnimation);

function startAnimation(evt:Event):void {

abox_xml = XML(evt.target.data);
abox_animator = new Animator(abox_xml, abox);
abox_animator.play();

}[/as]

Entry Filed under: XML, actionscript, flash, flash CS3

Leave a Comment

Required

Required, hidden

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Trackback this post  |  Subscribe to the comments via RSS Feed