Copy link to clipboard
Copied
import flash.utils.ByteArray;
import com.adobe.serialization.*;
import com.adobe.serialization.json.JSON;
import br.com.MundoSabido.Base64;
////////////////////////////////////////////////////////////
teste.addEventListener("click", btnClick);
var request = new URLRequest("http://192.168.0.105:3000/imagens/1");
var reqSwf: URLLoader = new URLLoader();
function btnClick(event: MouseEvent): void {
request.method = URLRequestMethod.GET;
trace("antes");
try {
reqSwf.load(request);
} catch (error: Error) {
trace(error.message);
}
trace("OI")
}
////////////////////////////////////////////////////////////
var Xpos: Number = 0;
var Ypos: Number = 0;
var swf: MovieClip;
var loader: Loader = new Loader();
reqSwf.addEventListener(Event.COMPLETE, function (e: Event): void {
var decodedObj: Object = com.adobe.serialization.json.JSON.decode(e.target.data);
//trace(decodedObj.arquivo);
/* trace(decodedObj.firstName);
for(var key:String in decodedObj) {
trace("Name: " + key + " - Value: " + decodedObj[key]);
}
*/
//trace(decodedObj.arquivo);
trace("arquivo "+decodedObj.arquivo);
loader.loadBytes(Base64.decode(decodedObj.conteudo));
trace("deu certo ")
loader.x = Xpos;
loader.y = Ypos;
addChild(loader);
});
reqSwf.addEventListener(IOErrorEvent.IO_ERROR, function (e: IOErrorEvent): void {
trace("deu errado ")
trace(e.target.data);
});
/*reqSwf.load(request);*/
return
you have to use URLRequest(yourswf);
loader.load(new URLRequest("whatever.swf",lc));
and you have to enable the allowCodeImport property of your loadercontext if there's code in the loaded swf
lc.allowCodeImport=true;
Copy link to clipboard
Copied
upload to a server and test or check your publish settings to see if you can disable "access local files only".
Copy link to clipboard
Copied
keeps giving this error what else can i do?
SecurityError: Error #3226: Cannot import a SWF file when LoaderContext.allowCodeImport is false.
at flash.display::Loader/_loadBytes()
at flash.display::Loader/loadBytes()
at Function/<anonymous>()[ANDROIDCARREGARSWFDIMANICO_SWF__fla.MainTimeline::frame1:48]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
Copy link to clipboard
Copied
ios app?
Copy link to clipboard
Copied
ios and apk both give the same error!
Copy link to clipboard
Copied
your loader must provide a loadercontext object that uses the current applicationdomain:
var lc:LoaderContext=new LoaderContext(false,ApplicationDomain.currentDomain,null);
yourloader.load(yourexternalswf.swf,lc);
Copy link to clipboard
Copied
var decodedObj: Object = com.adobe.serialization.json.JSON.decode(e.target.data);
var lc: LoaderContext = new LoaderContext (false, ApplicationDomain.currentDomain, null);
yourloader.load (yourexternalswf.swf, lc);
loader.loadBytes(Base64.decode(decodedObj.conteudo));
loader.x = Xpos;
loader.y = Ypos;
addChild(loader);
how it would look in context using this cod????
var lc: LoaderContext = new LoaderContext (false, ApplicationDomain.currentDomain, null);
yourloader.load (yourexternalswf.swf, lc);
Copy link to clipboard
Copied
Hi is new error! Look ->
TypeError: Error #1034: Type Coercion failed: cannot convert "sistematização_de_tabuada_3_ANO_8.swf" to flash.net.URLRequest.
at Function/<anonymous>()[ANDROIDCARREGARSWFDIMANICO_SWF__2__fla.MainTimeline::frame1:37]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
//////////////////////////////////////////////
var decodedObj: Object = com.adobe.serialization.json.JSON.decode(e.target.data);
var lc:LoaderContext=new LoaderContext(false,ApplicationDomain.currentDomain,null);
loader.load(decodedObj.arquivo,lc);
loader.loadBytes(Base64.decode(decodedObj.conteudo));
Copy link to clipboard
Copied
you have to use URLRequest(yourswf);
loader.load(new URLRequest("whatever.swf",lc));
and you have to enable the allowCodeImport property of your loadercontext if there's code in the loaded swf
lc.allowCodeImport=true;
Copy link to clipboard
Copied
Is new error 1!
Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
/////////////////////////////////////////////Cod
var lc:LoaderContext=new LoaderContext(false,ApplicationDomain.currentDomain,null);
loader.load(new URLRequest(decodedObj.arquivo),lc);
lc.allowCodeImport=true;
////////////////////////////////////////////////
//loader.loadBytes(Base64.decode(decodedObj.conteudo));
//loader.loadBytes(Base64.decode(loader.conteudo));
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Is new error 2!
SecurityError: Error #3226: Cannot import a SWF file when LoaderContext.allowCodeImport is false.
/////////////////////////////////////////////Cod
var lc:LoaderContext=new LoaderContext(false,ApplicationDomain.currentDomain,null);
loader.load(new URLRequest(decodedObj.arquivo),lc);
lc.allowCodeImport=true;
////////////////////////////////////////////////
loader.loadBytes(Base64.decode(decodedObj.conteudo));
//loader.loadBytes(Base64.decode(loader.conteudo));
Copy link to clipboard
Copied
follow the link if you want to see the .fla file and help me!
https://mega.nz/file/r35jzCCJ#buh0wQgjPiAkQd0fuES8GC_2Y3-g8eyh7HL_UkCTEfA
Copy link to clipboard
Copied
what's decodedObj.arquivo?
Copy link to clipboard
Copied
i don't download and fix fla files unless i'm hired. if you want to hire me to solve this for you, let me know.
Copy link to clipboard
Copied
Thank you it worked!
Copy link to clipboard
Copied
you're welcome.