• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

how to use motion xml in as3

Explorer ,
Apr 17, 2015 Apr 17, 2015

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?

TOPICS
ActionScript

Views

531

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 18, 2015 Apr 18, 2015

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.)

Votes

Translate

Translate
Community Expert ,
Apr 17, 2015 Apr 17, 2015

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();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 17, 2015 Apr 17, 2015

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 17, 2015 Apr 17, 2015

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();


}


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 18, 2015 Apr 18, 2015

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 18, 2015 Apr 18, 2015

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.)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 18, 2015 Apr 18, 2015

Copy link to clipboard

Copied

when i use

event.target

i trace

[object MovieClip]

without the mc

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 18, 2015 Apr 18, 2015

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines