Hey guys i need help doing this : please read and sorry if the code is too long :
This is my AS file :
package
{
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.display.Sprite;
import fl.controls.DataGrid;
import fl.core.UIComponent;
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.Shape;
import flash.events.MouseEvent;
import fl.controls.Label;
import fl.events.ComponentEvent;
import flash.system.System;
public class tut extends Sprite
{
private var xml:XML;
var aGrid:DataGrid = new DataGrid ;
public function tut()
{
readXML();
}
private function readXML():void
{
var loader:URLLoader = new URLLoader(new URLRequest("points.xml"));
loader.addEventListener(Event.COMPLETE,xmlLoaded);
aGrid.x = 30;
aGrid.y = 300;
}
public function restartAll(e:MouseEvent):void
{
readXML();
}
public function xmlLoaded(e:Event):void
{
var ind:int
var myCircR:int = 20;
xml = new XML(e.target.data);
xml.ignoreWhitespace = true;
var f:uint;
for (f = 0; f < xml.point.length(); f++)
{
var full_mc:MovieClip = new MovieClip ;
var dr:MovieClip = new MovieClip ;
full_mc.buttonMode = false;
full_mc.x = xml.point[f]. @ xPos;
full_mc.y = xml.point[f]. @ yPos;
full_mc.ind = f
dr.graphics.lineStyle(1)
dr.graphics.beginFill(0xff0000);
dr.graphics.drawCircle(myCircR/2,myCircR/2,myCircR/2);
full_mc.addEventListener(MouseEvent.CLICK,drawGrid);
full_mc.addChild(dr)
addChild(full_mc)
}
}
public function drawGrid(e:Event):void
{
aGrid.width = 250;
aGrid.height = 100;
aGrid.removeAll();
aGrid.columns = ["Label","Data"];
var s:uint;
var q:Number = e.target.ind
for (s = 0; s < xml.point[q].value.length(); s++)
{
aGrid.addItem({Label:xml.point[q].value[s]. @ label,Data:xml.point[q].value[s]});
}
trace(q)
addChild(aGrid);
}
}
}
here is my XML file :
<?xml version="1.0" encoding="utf-8"?>
<data>
<point id="1" dateAdded="07-04-2009" xPos="15" yPos="11">
<value label="Message">
01Here is our message.
</value>
<value label="Phone Number">
564848744
</value>
</point>
<point id="1" dateAdded="07-04-2009" xPos="267" yPos="50">
<value label="Message">
02Here is our message.
</value>
<value label="Phone Number">
564848744
</value>
</point>
<point id="1" dateAdded="07-04-2009" xPos="332" yPos="412">
<value label="Message">
03Here is our message.
</value>
<value label="Phone Number">
564848744
</value>
</point>
<point id="1" dateAdded="07-04-2009" xPos="130" yPos="226">
<value label="Message">
04Here is our message.
</value>
<value label="Phone Number">
564848744
</value>
</point>
<point id="1" dateAdded="07-04-2009" xPos="434" yPos="300">
<value label="Message">
05Here is our message.
</value>
<value label="Phone Number">
564848744
</value>
</point>
<point id="1" dateAdded="07-04-2009" xPos="377" yPos="315">
<value label="Message">
01Here is our message.
</value>
<value label="Phone Number">
564848744
</value>
</point>
<point id="1" dateAdded="07-04-2009" xPos="464" yPos="385">
<value label="Message">
02Here is our message.
</value>
<value label="Phone Number">
564848744
</value>
</point>
<point id="1" dateAdded="07-04-2009" xPos="200" yPos="150">
<value label="Message">
03Here is our message.
</value>
<value label="Phone Number">
564848744
</value>
</point>
<point id="1" dateAdded="07-04-2009" xPos="250" yPos="200">
<value label="Message">
04Here is our message.
</value>
<value label="Phone Number">
564848744
</value>
</point>
<point id="1" dateAdded="07-04-2009" xPos="300" yPos="250">
<value label="Message">
05Here is our message.
</value>
<value label="Phone Number">
564848744
</value>
</point>
</data>
So as you see all i need is when i call drawGrid() i can get some kind of number from the clicked full_mc so i can loop the <values> in that certain <point>
Please help and if anyone have any comment on my coding plz let me know.