You can include an ActionScript file in it's own script block. Then in the .as file, you could just have the XML defined and nothing else. // put this in books.as -- or whatever filename you choose private var novel:XML = <BOOK><TITLE>My Book</TITLE></BOOK>; <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script source="books.as"/>
... rest of your code </mx:Application> HTH, ~randy _____ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of edlueze Sent: Sunday, July 20, 2008 11:02 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Bake XML File into ActionScript What's the best way to compile an XML file directly into ActionScript? You can assign an XML literal to a variable as such: var novel:XML = <BOOK><TITLE>-My Book</TITLE>-</BOOK> But it would be much better to have the XML in an externally managed file. I'd much prefer to do something like: var novel:XML = {include "Books.xml";-}; But this doesn't seem to be allowed. I could load the XML file at runtime but then I'd have to deal with the asynchronous nature of the loading and I'd have to handle any runtime errors if there was a problem - yuck! If I was working in MXML I'd be able to do something very elegant such as using the compile-time tag <mx:XML id="MyBooks" source="books.-xml"/> So how do I include XML into ActionScript in a way that is as elegant as it is for MXML? No virus found in this outgoing message. Checked by AVG. Version: 7.5.523 / Virus Database: 270.5.2/1562 - Release Date: 7/19/2008 2:01 PM