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.
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. Also, you may want to load the script externally so you can change it without having to recompile the app. -Alex ________________________________________ From: Barry Gold [[email protected]] Sent: Sunday, February 23, 2014 9:24 PM To: flex mailing list Subject: Including/referencing an external MXML file I have two mxml files in my top-level src directory. The first is the main application. The second is a Text control that has the script for the game in it, as text to be read and parsed at run-time. The two questions are: 1. How do I get the compiler to include this second file 2. How do I access the Text control's contents from a class in a different package? The second file looks like this: <?xml version="1.0" encoding="utf-8"?> <mx:Text id="gameScript" name="script"> <mx:text> // This is the script that controls the game ... </mx:text> </mx:Text>
