Copy Motion As AS3, use variables?


I’ve copied motion as AS3 and amend the XML and use it fine.

What I would like to do though is use a variable in place of the XML e.g.
import fl.motion.Animator;

var testObject_xml:XML = <Motion duration="10" xmlns="fl.motion.*" xmlns:geom="flash.geom.*" xmlns:filters="flash.filters.*">
  <Source frameRate="24" x="-9.25" y="8.75" scaleX="1" scaleY="1" rotation="0" elementType="graphic" symbolName="block">
    <geom:Rectangle left="0" top="0" width="35.5" height="35.5"/>
    <geom:Point x="0.5" y="0.5"/>
 <Keyframe index="0" tweenSnap="true" tweenSync="true">
   <SimpleEase ease="0"/>
[COLOR=red] <Keyframe index="9" scaleX="3.645"/>[/COLOR]
var testObject_animator:Animator = new Animator(testObject_xml, testObject);;

I would like to change the highlighted line to use a variable instead e.g.

 <Keyframe index="9" scaleX=myVar/>

This doesn’t work! :diss: Is there something that will achieve directly or is there a quick way to set it using the XML?