On 2/23/2014 9:40 PM, Alex Harui wrote:
1.  If the mx:Text file is named BarryScript.mxml, then in the main MXML file, you would include a 
namespace like xmlns:local="*" and then somewhere, add the tag<local:BarryScript 
id="theScript"/>
2.  Then your code would access theScript.text.

Is that a "global" variable? I would expect it to be an instance variable in my application class. Then I would tell the Parser class where to find it, by calling a setter function, right?

But really, it isn't obvious why you aren't just including the script as a 
String unless you want to display that script to the user.

IIUC, ActionScript does not allow multi-line quoted strings. So I would have to wrap each line in quote marks and concatenate them (with the + operator, I guess).

This way, the entire text -- including newlines separating the lines (I'm using a partly line-oriented parser) is in the control and I can go ahead and parse it.

Also, you may want to load the script externally so you can change it without 
having to recompile the app.

I suppose I might do that, but then I have to make a package (install script?) that deploys the script, too. If it's compiled in, all I have to do is hand out the .swf file.

And other people who want to use my game layout and engine can just change the script and recompile to make a different game. (I'd be making the whole thing available under CC-BY-SA.)

Reply via email to