开发者

Php outputs mxml for Flash player

I have some ideas about flex and php comunation, and i want your suggestions and answers of the problem. My flex project will communicate with PHP that will output xml code, Actionscript will get this xml code (got from开发者_如何学Python php) and add some objects at run time. But I sought that it would be easier that PHP file itself echo_ed MXML code and flash player should do anything else without Actionscript object creating on live. So is it possible to do this?


You cannot do this in a real word application:) A MXML file is compiled by the flex compiler into a swf file that is played by the Flash Player. Your PHP back-end has the job of passing data to the flash player.

Now, in a fantasy world, where there are unicorns to entertain the user while a web application is loading I think that this could work:

  1. PHP creates MXML(blame the unicorns for this)
  2. The MXML file is passed to the flex compiler and compiled
  3. the resulting swf file is send to the webbrowser
  4. after some unicorn fun the user starts clicking around

But why would someone do something like this?


No, Flex is a compiled language.

MXML is just a tag based syntax to define portions of code. Just like actionscript, that code is compiled into a swf.

It may resemble XML or HTML, but it doesn't work that way.


No, its not possible. Flex need to be compiled into swf to be used.


It is best to think of MXML as a pre-compiler tool for ActionScript. It isn't really even used to output the final swf file, it is translated first by the "pre-compiler" into the equivalent of an .as file. Only after it is translated does the "compiler" add the class definition to the swf.

While it is possible to get PHP to output MXML and then call mxmlc (? can't remember the command line command to compile a swf) on it to output a swf, you're far better off coming up with some custom XML parsing engine of your own and dynamically add/remove objects based on that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜