Hi,
> Okay, that looks pretty good. Can I put that Embed in a .as file, or does it
> have to be in an MXML file?
Components can be MXML or Actionscript. You can also include a script file like
so:
<fx:Script source="myscript.as" />
> So... if I wanted to read in the script from an external file, how would I do
> that?
Something like this:
protected var loader:URLLoader = new URLLoader();
protected function fileLoaded(event:Event):void{
// parse event.target.data
}
protected function fileError(event:Event):void{
// error
}
public function load():void {
loader.addEventListener(Event.COMPLETE, fileLoaded);
loader.addEventListener(IOErrorEvent.IO_ERROR, fileError);
loader.load(new URLRequest("data.txt"));
}
But if you're doing that I suggest you keep the data in XML not plain text
format.
Thanks,
Justin