PHP code:
<? //header("Content-type: text/xml"); echo '<?xml version=\'1.0\' encoding=\'UTF-8\'?> <game> <gamer> <ID>1</ID> <login>Игрок 1</login> <x>0</x> <y>0</y> <Rotation>30</Rotation> </gamer> <player> <ID>2</ID> <login>Игрок 2</login> <lvl>10</lvl> <x>570</x> <y>570</y> <Rotation>0</Rotation> </player> <player> <ID>3</ID> <title>Игрок 3</title> <lvl>42</lvl> <x>200</x> <y>200</y> <Rotation>'.rand().'</Rotation> </player> </game>'; ?>
Wrote a class on AS3.0. On the locale worked. Then he decided to transfer to the site. Began to customize the cross policy. Then he scored, he stopped working. HZ that .. just does not display anything and the data is not loaded.
package main { import flash.events.*; import flash.net.*; import flash.system.*; public class communication { var loader:URLLoader; function communication(){ Security.loadPolicyFile("http://subdomain2.example/vk_pc/crossdomain.xml"); loader = new URLLoader(); loader.addEventListener(Event.COMPLETE, xmlLoaded); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); loader.addEventListener(ProgressEvent.PROGRESS, progressHandler); var request:URLRequest = new URLRequest("http://subdomain2.example/vk_pc/game.php"); try { loader.load(request); } catch (error:SecurityError) { trace("SecurityError"); } } function xmlLoaded(event:Event):void { trace("Загружено"); trace(loader.data); } private function securityErrorHandler(event:SecurityErrorEvent):void { trace("securityErrorHandler: " + event); } private function ioErrorHandler(event:IOErrorEvent):void { trace("ioErrorHandler: " + event); } private function progressHandler(event:ProgressEvent):void { trace("progressHandler loaded:" + event.bytesLoaded + " total: " + event.bytesTotal); } } }
UPD: I fixed it, but I began to write like that. Error opening URL 'http://fpdownload.adobe.com/pub/swz/crossdomain.xml' Error opening URL 'http: //subdomain2.example/vk_pc/crossdomain.xml' Error opening URL 'http: // subdomain2. example / vk_pc / game.php 'ioErrorHandler: [IOErrorEvent type = "ioError" bubbles = false cancelable = false eventPhase = 2 text = "Error # 2032: Stream error. URL: http: //subdomain2.example/vk_pc/game. php "] up