Jump to content
Search Community

Error #3764 Reloading a SWF is not supported on this operating system.

Keyda test
Moderator Tag

Recommended Posts

Hello, is there another way to reload a swf on AIR iOS using the greensock swf loader? The regular loader seems to work fine.

 

var loaderf: SWFLoader;
var queue: LoaderMax;
function moduleClicked(e: Event): void {
loadSWF("com/SWF/" + e.target.moduleTitle_txt.text.replace(/ /g, "_") + ".swf");


}
function loadSWF(path: String): void {
var request: URLRequest;
request = new URLRequest();
request.url = path + "?newfile=" + Math.random();
request.cacheResponse = false;
request.useCache = false;


var lc: LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
lc.allowCodeImport = true;
try {
Security.allowDomain("*");
} catch (e) {}
queue = new LoaderMax({
name: "mainQueue",
onProgress: progressHandler,
onComplete: completeHandler,
onError: errorHandler
});
loaderf = new SWFLoader(request, {
name: "childClip",
estimatedBytes: 15000000,
container: this,
autoPlay: true,
onInit: initHandler,
context: lc,
scaleX: stage.stageWidth / 640,
scaleY: stage.stageHeight / 480


});


queue.append(loaderf);
queue.load(true);






}


function initHandler(event: LoaderEvent): void {
loaderf.rawContent.addEventListener("close", closeLoader);
}


function closeLoader(event: Event): void {
queue.getLoader("childClip").unload();
queue.getLoader("childClip").dispose();
}


function progressHandler(event: LoaderEvent): void {
trace("progress: " + event.target.progress);
}


function completeHandler(event: LoaderEvent): void {
trace(event.target + " is complete!");
}


function errorHandler(event: LoaderEvent): void {
trace("error occured with " + event.target + ": " + event.text);
}

 

 

And this is my code for the regular Loader (this works on reloading but it seems the greensock loader doesn't work)

 

var _swfLoader: Loader;
var _urlLoader: URLLoader;
var _swfContent: MovieClip;
function moduleClicked(e: Event): void {
try{
loadSWF("com/SWF/" + e.target.moduleTitle_txt.text.replace(/ /g, "_") + ".swf");
}catch(e:Error){}
trace("clicked");


}
function loadSWF(path: String): void {




try {
Security.allowDomain("*");
} catch (e) {}


_swfLoader = new Loader();


_urlLoader = new URLLoader();
setupListeners(_swfLoader.contentLoaderInfo); 


_urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
_urlLoader.addEventListener(IOErrorEvent.IO_ERROR, loginError);
_urlLoader.addEventListener(Event.COMPLETE,onLoads);
_urlLoader.load(new URLRequest(path));










}


function onLoads(e:Event){
var lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
lc.allowCodeImport = true;


_swfLoader.loadBytes(_urlLoader.data,lc);
// setupListeners(_swfLoader.contentLoaderInfo); 
}


function preloadSWF(event: ProgressEvent): void {
var _perc: int = (event.bytesLoaded / event.bytesTotal) * 100;
// swfPreloader.percentTF.text = _perc + "%";
/*Loading_bar.text = "Loading" + _perc;*/
trace(_perc);
}


function addSWF(event: Event): void {




event.target.removeEventListener(Event.COMPLETE, addSWF);
event.target.removeEventListener(ProgressEvent.PROGRESS, preloadSWF);




_swfContent = event.target.content;
_swfContent.addEventListener("close", unloadSWF);
try{
addChild(_swfContent);
}catch(e:Error){}
_swfContent.scaleX = stage.stageWidth / 640;
_swfContent.scaleY = stage.stageHeight / 480;






}
function loginError(event:IOErrorEvent): void {
trace("Error loading the URL");
}


public function unloadSWF(event: Event): void {
_swfLoader.unloadAndStop();


removeChild(_swfContent);
//_swfLoader = null;
_swfContent = null;
/*System.gc();*/
}




function setupListeners(dispatcher: IEventDispatcher): void {
dispatcher.addEventListener(Event.COMPLETE, addSWF);
dispatcher.addEventListener(ProgressEvent.PROGRESS, preloadSWF);
}
 
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...