Search code examples
apache-flexactionscriptmxml

Dynamic loading and compilation of MXML/AS at runtime


Greetings!

I am trying to build an application which has a flex front-end and a php back-end. I am struggling to do something with this application which I couldn't figure out a way to do. I would want my flex application to show a view based on an MXML it recieves from the server as a response to some interaction in the flex application. for example, lets say there are two buttons on the current view and if i press the first button, it will load one mxml/as3 from the server, and when i click the other, it will load a different mxml. How do you think i can tackle this situation ? Please shed some light if you know how to do this as i've been banging my head on the wall trying to figure out a way.

Best Regards,

Roshan Amadoru


Solution

  • I think what you want to do is achieved by modules in Flex. You can't send MXML or .as to the flex application as it doesn't have a compiler to change them into binary executable code. So the way to do this is prepare separate application parts, which aren't downloaded with the main app but can be loaded to it later, called modules.

    A blog post about flex modules: sujitreddyg.wordpress.com

    If you don't want to compile modules before deploying them to the server but would rather put mxml code there (PHP style) you would need to install the Flex Module for Apache (the name module here is the same as flex modules by coincidence, it's an unrelated thing).