=================================
=================================
=================================
출처: http://stackoverflow.com/questions/3000299/urlloader-load-issue-when-using-the-same-urlrequest
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 |
||
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 을 추가 해서 값이 바꾸어지나 확인해 보는 것도 한가지 방법 입니다.
=================================
=================================
=================================
'ADOBE > ActionScript' 카테고리의 다른 글
adobe 액션스크립트 AS UTC를 이용한 각 국가별 시간 구하기 (0) | 2014.10.21 |
---|---|
플래시 액션스크립트 adobe ane 라이브러리를 이용한 ios 구매 관련 (0) | 2014.10.20 |
액션스크립트 actionScript 날짜 체크 (0) | 2014.10.07 |
[AS] adobe air flash actionscript 액션스크립트 URLRequest, loadPolicyFile, allowScriptAccess 보안 관련 (0) | 2014.10.02 |
액션스크립트 암호화 md5 등등 관련 (0) | 2014.10.01 |
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