public function getUploadURL():void { var request:URLRequest = new URLRequest(); request.url = getPath(); request.method = URLRequestMethod.GET; _loader = new URLLoader(); _loader.dataFormat = URLLoaderDataFormat.TEXT; _loader.addEventListener(Event.COMPLETE, getBaseURL); _loader.load(request); } private function getBaseURL(event:Event):void { _loader.removeEventListener(Event.COMPLETE, getBaseURL); }
The issue is that my getBaseURL gets executed automatically after I have executed the code at least once, but that is the case only in IE. What happens is I call my getUploadURL, I make sure the server sends an event that will result in an Event.COMPLETE, so the getBaseURL gets executed, and the listener is removed. If I call the getUploadURL method and put the wrong path, I do not get an Event.COMPLETE but some other event, and getBaseURL should not be executed.
That is the correct behavior in FireFox. In IE, it looks like the load() method does not actually call the server, it jumps directly to the getBaseURL() for the Event.COMPLETE. I checked the willTrigger() and hasEventListener() on _loader before assigning the new URLLoader, and it turns out the event has been well removed.
I hope I make sense, I simplified my code. To sum up quickly: in FireFox it works well, but in IE, the first call will work but the second call won't really call the .load() method; it seems it uses the previously stored result from the first call.
I hope someone can please help me, Thank you,
Rudy
ADOBE/ ActionScript
ActionScript URLLoader의 internet explorer ie8,9,10,11 버전등등 같은 url로 로드했을때 값이 같은 값이 나왔을때 문제관련 URLLoader.load() issue when using the same URLRequest , I have an issue with my eventListeners with the UR..
AlrepondTech
2014. 10. 8. 00:06
반응형
=================================
=================================
=================================
출처: http://stackoverflow.com/questions/3000299/urlloader-load-issue-when-using-the-same-urlrequest
add a comment
|
1
|
Try adding a random variable to the url to prevent caching.
var url:String = getPath(); //if path already contains some variables, replace ? with & url += "?random=" + Math.random(); request.url = getPath(); |
||
1
|
Possibly the request has been cached.
var hdr:URLRequestHeader = new URLRequestHeader("pragma", "no-cache"); .... request.requestHeaders.push(hdr); |
||||||||
|
=================================
=================================
=================================
액션 스크립트에서 url 로드 할때 ms의 인터넷익스플로어에서 값이 바꾸어 지지않는 현상이 일어나면 위와 같이 해결 해도 되지만
html 코드에 no-cache 을 추가 해서 값이 바꾸어지나 확인해 보는 것도 한가지 방법 입니다.
=================================
=================================
=================================
반응형
Math.random
giving same results within same session (before cache is cleared), is very small; but if you really want to make sure, you can use the current time - the number of milliseconds passed since linux epoch.url += "?random=" + (new Date()).getTime();
– Amarghosh Jun 10 '10 at 4:05