Need help AS3 navigateToURL opening new window

故事扮演 提交于 2019-12-11 14:32:18

问题


AS3 noob here. I am using the following code to successfully send a var to my php/database. My problem is that, of course, when I click my button in the Flash movie the browser navigates away to the "http://www.mydomain.com/charity.php?id=c" url.

    function onPressHandlerc(evt:MouseEvent):void { 
    var url:String = "http://www.mydomain.com/charity.php?id=c";
    var request:URLRequest = new URLRequest(url);
    try {
    navigateToURL(request, '_blank');
    } catch (e:Error) {
    trace("Error occurred!");
    }
    } 

How do I set the navigateToURL() to not try to open a "_blank" window and just pass the var silently?

Thanks in advance for any help!


回答1:


Ah think you actually want to use a URLLoader instead of navigateToURL for this case. navigateToURL is real similar to window.open in js if you're familiar, you want something more like AJAX I think which is where the URLLoader comes in.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLLoader.html

http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7cfd.html#WS5b3ccc516d4fbf351e63e3d118a9b90204-7cf5



来源:https://stackoverflow.com/questions/13731223/need-help-as3-navigatetourl-opening-new-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!