PDA

View Full Version : display mxml in flex from external file without recompling


ratziger
08-19-2008, 01:14 PM
Hello there!

I'm trynig to build in Flex simple application to display Simplified DocBook.

My idea is to change xml with xls, for instance from


<article>
<title>Sample title</title>

<section>
<title>Sample section #1</title>

<para>Sample text</para>
</section>
</article>


to


<mx:Panel>
<mx:Box>

<mx:Label text="Sample title"/>
<mx:Box>
<mx:Label text="Sample section #1"/>
<mx:Text text="Sample text"/>

</mx:Box>

</mx:Box>
</mx:Panel>


and then put this inside flex to get result like this


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:docbook="myComponents.*" >

<!-- other code... -->

<mx:Panel>
<mx:Box>

<mx:Label text="Sample title"/>
<mx:Box>
<mx:Label text="Sample section #1"/>
<mx:Text text="Sample text"/>

</mx:Box>

</mx:Box>
</mx:Panel>

<!-- other code... -->

</mx:Application>


Do I need to build actionscript parser for my xmls or is there any other like to put this tags inside SWF without recompling, like eval() method ??

Thanks for any help

drkstr
08-19-2008, 06:45 PM
MXML is not evaluated, it's used to generate Actionscript code at compile time. To generate the docbook at runtime, you will need to create some Actionscript code to parse the xml and manually add the components to the display list.


Best Regards,
~Aaron