var xml:XML = <Main>
<Event>
<Name>Name1<Name>
<Event>
<Name>Name2</Name>
...........
</Event>
</Event>
</Main>
var event:MyEvent = getEvent(xml);
function getEvent(xml:XML):MyEvent
{
var event:MyEvent = new MyEvent();
var xmlList:XMLList = xml.children();
for(i = 0; i < xmlList.length(); i++){
if(xml[i].hasOwnProperty("Name")){
event.name = xml[i]["Name"];
}
if(xml[i].hasOwnProperty("Event")){
event.event = getEventVO(xml[i]["Event"]);
}
}
return event;
}
我的事件.as
package
{
public class MyEvent
{
public var name:String;
public var event:Event;
public function MyEvent():void
{
}
}
}