Hey, I have a php document dynamicly generating the following:
peerID=e224d6cac76ef3181d4804858d82ebeee7e67ad7bdd7b02f3857a700b0ec7fbc
(from get_peerID.php) I'm using the following AS3 to try and get this data:
private var myLoader:URLLoader = new URLLoader();
private function sendData():void {
writeText("sending data...");
var objSend:Object = new Object;
objSend.peerID = myID.text;
put_peerID.send( objSend );
writeText("http://localhost/example.com/scripts/get_peerID.php?peerID=" + myID.text);
var myRequest:URLRequest = new URLRequest("http://localhost/example.com/scripts/get_peerID.php?peerID=" + myID.text);
myRequest.contentType = "text/plain";
//var myLoader:URLLoader = new URLLoader();
myLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
configureListeners(myLoader); //.addEventListener(Event.COMPLETE,onComplete);
myLoader.load(myRequest);
}
private function configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.COMPLETE, completeHandler);
dispatcher.addEventListener(Event.OPEN, openHandler);
dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
}
private function completeHandler(event:Event):void {
writeText("compl开发者_C百科eteHandler: " + myLoader.data.peerID);
}
private function openHandler(event:Event):void {
writeText("openHandler: " + event);
}
private function progressHandler(event:ProgressEvent):void {
writeText("progressHandler loaded:" + event.bytesLoaded + " total: " + event.bytesTotal);
}
private function securityErrorHandler(event:SecurityErrorEvent):void {
writeText("securityErrorHandler: " + event);
}
private function httpStatusHandler(event:HTTPStatusEvent):void {
writeText("httpStatusHandler: " + event);
}
private function ioErrorHandler(event:IOErrorEvent):void {
writeText("ioErrorHandler: " + event);
}
Which generates the following text (from writeText()
):
sending data...
http://localhost/example.com/scripts/get_peerID.php?peerID=5131079b60ba3ae05f9d54568896db1e04f772f97bb98c6d525cb8ba3032798b
openHandler: [Event type="open" bubbles=false cancelable=false eventPhase=2]
httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=200 responseURL=null]
So, its not giving me the data that I need. I'm not sure what to try next. I've been in and out of forums all day so any help would be appreciated.
It's not working because I was running it on my localhost. Adobe says: For Flash Player 8 and later:
- Data loading is not allowed if the calling file is in the local-with-file-system sandbox and the target resource is from a network sandbox.
- Data loading is also not allowed if the calling file is from a network sandbox and the target resource is local.
After released it and put it up online it work.
精彩评论