Hey there, I have been cramming as3 into my head at an unimaginable rate over the last few weeks, but I can’t seem to google my way out of this one.
I have a 6mb XML file, resetting my script timout in CS4 doesn’t help. (it does have some unnecesarry HTML in it I could probably do away with, but that would be the wrong direction I think)
I can’t even trace it.
I am loading it into an :XML object and trying to work with it, but all to no avail.
Is there anything I can do besides shortening the file? I would really HATE to do that…
Here is my Class:
/**
User class
author: Manaburn
version: .1
modified: 5/6/09
*/
//TODO:
/*
*/
package{
import flash.display.MovieClip;
import fl.controls.*
import flash.xml.*
import flash.text.TextFormat;
import flash.text.TextField;
import flash.display.BlendMode;
import flash.net.URLLoader
import flash.net.URLRequest
import flash.events.*
import fl.data.DataProvider;
import flash.errors.ScriptTimeoutError;
public class FoeClip extends MovieClip{
public var mySTATS:XML;
private var newColor:String;
private var labelStyle:TextFormat;
public var myName:TextField;
public var myOptions:ComboBox;
private var labelColor;
private var monsters:Array = [];
private var monsterCBItem:Object;
private var xmlloader:URLLoader;
private var monsterList:XMLList;
/*var countries:Array = [];
for each (var country:XML in myXML.countries.country){
var myObject:Object = new Object();
myObject.label = country.text();
myObject.data = country.text();
countries.push(myObject);
}
myComboBox.dataProvider = new DataProvider(countries);*/
public function FoeClip(){
this.buttonMode = true;
labelColor = Math.round( Math.random()*0xFFFFFF );
labelStyle = new TextFormat();
labelStyle.color = labelColor;
labelStyle.underline = true;
this.graphics.beginFill(0x000000);
this.graphics.lineStyle(2,labelColor);
this.graphics.drawCircle(0,0,19)
this.graphics.endFill();
myOptions = new ComboBox();
myOptions.width = 120;
myOptions.height = 20;
myOptions.x=-60;
myOptions.y= 0;
xmlloader = new URLLoader();
xmlloader.addEventListener(Event.COMPLETE,addXML);
xmlloader.load(new URLRequest("http://corry.seattlechromaworks.com/XML/OGLAndargor/monster.xml"));
trace("called");
//myOptions.dataProvider = new DataProvider(monsters);
myName = new TextField();
myName.width = 0;
myName.height = 20;
myName.x=-40;
myName.y=-20;
myName.mouseEnabled = false;
//myName.blendMode = BlendMode.INVERT;
myName.background = true;
myName.backgroundColor = labelColor;
myName.setTextFormat(labelStyle);
addChild(myOptions);
addChild(myName);
}
private function addXML(event:Event):void{
trace("called");
mySTATS = new XML(xmlloader.data);
trace("loaded");
//monsterList = mySTATS.monsters;
/*for(var i=0;i<mySTATS..monster.length();i++){
trace(mySTATS..monster*.name.text());
}*/
//trace(mySTATS);
for each (var monster:XML in monsterList){
trace(monster.name.text())
monsterCBItem = new Object();
monsterCBItem.label = monster.name.text();
monsterCBItem.data = monster.name.text();
monsters.push(monsterCBItem);
}
trace("done");
}
}
}
The for each loop wont iterate for some reason, but the for loop will, then again, it always crashes me with:
Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.
(which as I stated above I reset, but as this is a .as file, I don’t think it allows that.)