本文介绍了FLASH as3无法识别本地主机的PHP网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用php(products.php)检索mysql数据,并以xml格式将数据返回到ADobe flash as3;但我正在跟随错误。

 打开网址http://localhost/Flash/player/products.php时出错

Error#2044:Unhandled ioError :.文本=错误#2032:流错误。 URL:在php_mysql3_as3_fla :: MainTimeline / frame1()



请任何建议或帮助为什么闪光不识别地址。我已经安装了WAMP。这工作得很好,因为我有很多其他的PHP项目在这里工作。

在此先感谢您的帮助和建议



以下是我的php代码

 <?php 
link = mysql_connect(localhost,root , );

mysql_select_db(test);

$ query =select * from products;
$ results = mysql_query($ query);


echo'<?xml version =1.0encoding =utf-8?>'。\\\
;
echo< GALLERY> \\\
;
$ cnt = 0;
while($ line = mysql_fetch_assoc($ results))
{
echo'< IMAGE TITLE ='。$ cnt。'>'。$ line ['product'] '< / IMAGE>'。\\\
;
$ cnt ++;
}

echo< / GALLERY> \\\
;

mysql_close($ link);

?>

php文件位于c:\wamp\www\Flash\player \\ product.php






下面是我的AS3 flash代码

  var myXML:XML; 
var myLoader:URLLoader = new URLLoader();
myLoader.dataFormat = URLLoaderDataFormat.VARIABLES;

//myLoader.load(new URLRequest(c:\\wamp\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\)) ;
myLoader.load(new URLRequest(http://localhost/Flash/player/products.php));
myLoader.addEventListener(Event.COMPLETE,processXML);


函数processXML(evt:Event):void {

myXML = new XML(evt.target.data);
for(var i:int = 0; i< myXML。*。length(); i ++){
trace(我的图片号码是+(i + 1)+,它的标题是+ myXML.IMAGE [i]。@ TITLE +,它的URL是+ myXML.IMAGE [i];
};
// trace(data:+ myLoader.data);;


解决方案

问题是一个防火墙。



这是另一个相关的问题:


I am trying to retrieve mysql data using php(products.php) and return the data in xml format to ADobe flash as3; but i am getting following error.

Error opening URL 'http://localhost/Flash/player/products.php'

Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: http://localhost/Flash/player/products.php at php_mysql3_as3_fla::MainTimeline/frame1()

Please any suggestion or help why flash is not identifying the http://localhost/Flash/player/products.php addres. i have WAMP installed; which works fine as i have many other php projects working here.

Thanks in advance for help and suggestion.

THe following is my php code

<?php
    $link = mysql_connect("localhost","root","");

mysql_select_db("test");

$query = "select * from products";
$results = mysql_query($query);


echo '<?xml version="1.0" encoding="utf-8" ?>'." \n";
echo"<GALLERY>\n";
$cnt=0;
while($line=mysql_fetch_assoc($results))
{
    echo '<IMAGE TITLE="'.$cnt.'">'.$line['product'].'</IMAGE>'." \n";
    $cnt++;
}

echo "</GALLERY>\n";

mysql_close($link);

?>

the php file is located at c:\wamp\www\Flash\player\products.php


below is my AS3 flash code

var myXML:XML;
var myLoader:URLLoader = new URLLoader();
myLoader.dataFormat = URLLoaderDataFormat.VARIABLES;

//myLoader.load(new URLRequest("c:\\wamp\\www\\Flash\\player\\products2.xml"));
myLoader.load(new URLRequest("http://localhost/Flash/player/products.php"));
myLoader.addEventListener(Event.COMPLETE, processXML);


function processXML(evt:Event):void {

myXML = new XML(evt.target.data);
for (var i:int = 0; i<myXML.*.length(); i++){
trace("My image number is " + (i+1) + ", it's title is " + myXML.IMAGE[i].@TITLE + " and it's URL is " + myXML.IMAGE[i]);
};
//trace("data: " + myLoader.data);;
}
解决方案

In chat it turned out the problem was a firewall.

Here is another related question:

Testing movie with Flash IDE fails to load file from localhost

这篇关于FLASH as3无法识别本地主机的PHP网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 17:30