Aii there…Im just hook up to AS3 and facing this simple problems for most of u guys…but I really need help/shed some light on how to achieve it…Here’s the situation I Just attempt to make a simple crossword by loading data from xml file…so here’s are my xml format data
/*
<?xml version="1.0" encoding="iso-8859-1"?>
<puzzle>
<board>
<grid cell=". . . . f . . w . ." />
<grid cell=". . . . e . . o . ." />
<grid cell=". . h o r r o w . ." />
<grid cell=". . e . r . . . . ." />
<grid cell=". . l i a r . . . ." />
<grid cell=". . l . r . . . . ." />
<grid cell=". . o . i l l . . ." />
<grid cell=". . . . . . u . . ." />
<grid cell=". . . . . . s . . ." />
<grid cell=". . . . . . t . . ." />
</board>
<words>
<word direction="down" string="ferrari" clue="just sport car" />
<word direction="down" string="wow" clue="intriguing expression" />
<word direction="cross" string="horrow" clue="creepy" />
<word direction="down" string="hello" clue="welcomings" />
<word direction="cross" string="liar" clue="bluffing persons" />
<word direction="cross" string="ill" clue="unwell conditions" />
<word direction="down" string="lust" clue="flirtious feeling" />
</words>
</puzzle>
*/
and here’s are my current attempt code…
stop();
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
var xmldata:XML;
var loader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest("cw.xml");
loader.load(request);
loader.addEventListener(Event.COMPLETE, onComplete);
function onComplete(e:Event):void{
if (loader != null){
xmldata = new XML(e.target.data);
var board:XMLList = xmldata.board;
var words:XMLList = xmldata.words;
trace(board.grid);
}else{
trace("loader is not a URLLoader!");
}
}
So my problem is how to loop this value which is total 10
/*
<grid cell=". . . . f . . w . ." />
<grid cell=". . . . e . . o . ." />
<grid cell=". . h o r r o w . ." />
<grid cell=". . e . r . . . . ." />
<grid cell=". . l i a r . . . ." />
<grid cell=". . l . r . . . . ." />
<grid cell=". . o . i l l . . ." />
<grid cell=". . . . . . u . . ." />
<grid cell=". . . . . . s . . ." />
<grid cell=". . . . . . t . . ." />
/
because i want to attach my movieclip from library by counting the total of node 1010 grid…
Or maybe someone can lead me to the rite path…any help are really appreciated…tq