A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Making the wind blow -flash and xml

  1. #1

    Making the wind blow -flash and xml

    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(t his,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 = VALUE OF WINDDIRECTION,_x = 150,_y = 150;
    }
    }
    xcWind.trigger();
    VALUE OF WINDDIRECTION is what the rotation should equal
    Last edited by bigchiefrandomchaos; 09-30-2005 at 06:31 AM.

  2. #2
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    I think you left out the XML code.

    Is the problem accessing the data in the XML code?

    Thanks

    Luke
    Flash-XML FAQ
    http://www.tupps.com/flash/faq/

  3. #3
    Cheers for the reply Tupps
    I can get the XML data into a text area
    eg. wind =300
    but cant get that data to be value of the rotation
    cheers
    chief
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <document>
    <locationdata>
    <winddirection>300</winddirection>
    </locationdata>
    </document>
    Last edited by bigchiefrandomchaos; 10-14-2005 at 10:50 AM. Reason: forgot xml code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center