Flash CS3 animator class and loading XML animation at runtime
May4
So there is a new animator class. It works like FuseXML. The animations are set by nodes and attributes.
To do this:
- start a CS3 document
- make an mc called ‘abox’
- make an animation
- select the animation
- Commands > Export Motion XML
- name xml file “motion.xml”
- create an actionscript layer
- Then load XML as usual.
add:
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(); }