开发者

Generate XML with PHP and pass it to an SWF

开发者 https://www.devze.com 2022-12-19 07:39 出处:网络
In the past I have created a php file that generates the XML and then referenced it in place of the xml file and it has worked. I am trying this with a precompiled flash app and it is not working.

In the past I have created a php file that generates the XML and then referenced it in place of the xml file and it has worked. I am trying this with a precompiled flash app and it is not working.

Any ideas why?

It works if I run the script, save it and then reference that file to the swf. I would rather not generate a file to the filesystem if poss开发者_如何学JAVAible. Anyone any solutions?


IF you pull the php page up in the browser are you sure that:

  1. The file has no white space preceding the XML prolog (<?xml version="1.0" ... ?>)
  2. The XML is wellformed

Another thing to check would be to look in firebug on the net panel... it shoudl show all the requests/responses made - including those done by flash (im assuming this is embedded in a web page). Look and make sure your flash is actually looking for the file you think its supposed to be looking for.


Without further information (code etc) I can only guess:

  • Are you trying to execute it on a server? php needs to be interpreted to generate the actual XML output, so if you don't put it on a webserver (that supports php), no content will be generated and the flash movie just sees the php code.
  • Check the content of the loaded php/XML file, trace it into some text field for debugging, so you can check if the actual content is being loaded correctly.
  • Listen for all available events of the URLLoader object. Maybe there is some IO error, you are not seeing. Alternatively you can also use the Flash debug player to see if errors are being thrown.

Also: What ActionScript version are you using?


Without seeing any of the code I would suspect the content type header isn't being set correctly and the php script is sending as html.

You can set the content type with the header funciton:

header('Content-Type: text/xml');


I'd suggest checking if some setting in your php.ini causes the output to be compressed (zlib.output_compression or ob_gzhandler).

0

精彩评论

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