Copy link to clipboard
Copied
the following is the result of exporting motion preset to xml.
<Motion duration="1" xmlns="fl.motion.*" xmlns:geom="flash.geom.*" xmlns:filters="flash.filters.*">
<source>
<Source frameRate="24" x="449.5" y="138.55" scaleX="1" scaleY="1" rotation="0" elementType="movie clip" instanceName="ball" symbolName="ball">
<dimensions>
<geom:Rectangle left="-51.5" top="-51.5" width="103" height="103"/>
</dimensions>
<transformationPoint>
<geom:Point x="0.5" y="0.9956310679611651"/>
</transformationPoint>
</Source>
</source>
<Keyframe index="0"/>
</Motion>
can some one show me how the as3 script in flash should be in order to set the motion to my "ball" mc in the fla?
Copy link to clipboard
Copied
i don't see any motion there but you would use the animator class to apply xml motion:
var anim:Animator=new Animator(yourxml,ball);
anim.play();
Copy link to clipboard
Copied
kglad please help
all i need is to apply preset motion called multiple_bounce to movie clip "ball" on stage using as3.
i understand that i have to export the preset motion as xml and than load it to my script.
i did the following:
var myXML:XML;
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("oman3d.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void {
myXML = new XML(e.target.data);
trace(myXML);
}
what is my mistake?
Copy link to clipboard
Copied
use:
var myXML:XML;
var anim:Animator;
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("oman3d.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void {
myXML = XML(e.target.data);animr=new Animator(myXML,ball);
anim.play();
}
Copy link to clipboard
Copied
excellent thank you
now i have new issue:
i have several mc on stage. i need each one of them to be animated when clicking on it. for that i need var which identify the mc.
var my_animator:Animator = new Animator(my_tween_xml, required_mc);
i tried doing it by creating a var
var required_mc:String
and on clicking on each mc :
required_mc=evt.target.name
but it does not work.
thank you
Copy link to clipboard
Copied
you can't use a string. use the movieclip, evt.target not evt.target.name.
(p.s when using the adobe forums, please mark helpful/correct responses, if there are any.)
Copy link to clipboard
Copied
when i use
event.target
i trace
[object MovieClip]
without the mc
Copy link to clipboard
Copied
the trace is expected and adds no significant info. if you're having a problem with something you should probably start a new thread because it looks like the problem is unrelated to this topic.