Groups | Blog | Home
all groups > flash data integration > september 2005 >

flash data integration : Making wind blow - XML and Flash



mrjug
9/29/2005 3:13:06 PM
Hi
I am trying to get the values out of an xml file to manipulate the rotation
of a movie clip.
The idea is that an xml file will provide wind direction data and a movie clip
of an arrow will be rotated to match the xml file data.
Here is the actionscript code at the moment and the xml code
any help would be much appreciated - for my sanity as much as any thing
cheers
Hope this makes sense




import mx.utils.Delegate;

var Wind:Array = new Array();

xcWind.addEventListener("result",Delegate.create(this,gotXML));
function gotXML(ev:Object):Void {
var mXML:XML = ev.target.results;
var nodes = mXML.firstChild.childNodes.length;
for (var i=0;i<nodes;i++) {
var node = mXML.firstChild.childNodes[i];
Wind.push({ winddirection:node.childNodes[0].firstChild.nodeValue
});
}
for (i=0;i<Wind.length;i++) {
var clipName:String = "circle" + i + "_mc";
this.attachMovie("circle_mc",clipName,i);
this[clipName]._rotation ="????",_x = 150,_y = 150; //value to go in
here?????//
}
}
xcWind.trigger();




<?xml version="1.0" encoding="ISO-8859-1"?>
<document>
<locationdata>
<winddirection>300</winddirection>
</locationdata>
</document>
mrjug
9/29/2005 4:56:38 PM
chaos58
10/3/2005 9:36:41 AM
Flash Grettir
10/4/2005 12:07:46 AM
Hi,

this[clipName]._rotation ="????",_x = 150,_y = 150; //value to go in here?????

Try:

this[clipNam]._rotation = Wind,_x=150,_y=150;

mrjug
10/14/2005 12:00:00 AM
Cheers for the replies

Chaos58
when I trace mXML it come up undefined

and Flash Grettir
when i put wind as the value it doesnt work
cheers for replies
AddThis Social Bookmark Button