duannaikuang1301 2013-07-19 08:28
浏览 47
已采纳

即时通讯必须以奇怪的方式将php数据传递给actionscript [关闭]

I have some values in a loop.php that generate a link like "page.php?id=1" "page.php?id=2" ecc.

I need to pass the value of "id" into actionscript3, who read a link page.php like this:

var myVars:URLVariables = new URLVariables(); 
myVars.flashVar = "myValue";

var myRequest:URLRequest = new URLRequest("page.php");
myRequest.method = URLRequestMethod.POST;
myRequest.data = myVars;

var myLoader:URLLoader = new URLLoader();
myLoader.addEventListener(Event.COMPLETE, completeHandler);
myLoader.load(myRequest);

function completeHandler(e:Event){
    var receiveVars:URLVariables = new URLVariables(e.target.data);


    vartxt1.text = receiveVars.phpVar1;

the problem is that i could change the link in actionscript like this:

var myRequest:URLRequest = new URLRequest("page.php?id=1");

but the problem is that is a static link, and if my value is changing to "4", then the link is working always with the value of "1".

i have think that maybe i could write an .xml with the value, and put actionscript to read that file...practically:

page.php?id=1 => page.xml.php (writing the xml) => redirect to page-with-swf-file.html

and when i'm on the page-with-swf-file.html i read the page.xml.php for the "id", and then load all the rest of the data that i need.

Is there an easier way of doing all this go-forward then go-back...?

  • 写回答

1条回答 默认 最新

  • doubeishuai6598 2013-07-19 11:37
    关注

    Is page.php a valid link as well? Just off the top of my head, some ways to do it:

    • Flash contacts page.php, and it returns an array of all the values (id=1, id=2...)
    • Flash contacts another page that returns an array of all the values
    • Flash controls the generates the variables (i.e. in a loop do "page?id=" + i)
    • Flash just starts with "page?id=1" and in the return, php tells it the next page
    • Php passes all the values to flash vars when writing the embed code for the swf
    • Php writes all the values to an xml files, and flash loads it
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示