flash - How to call a function that is declared into the main SWF from a loaded .as script? -
i have 2 functions declared on timeline of .fla; xmlloader1 , randomnumber.
now, need execute command: xmlloader1.load(new urlrequest("http://67.23.233.236/~champate/djsoftlayer/reporte/estado.php?playa=489&nocache="+randomnumber()));
.as script loaded, logic, compiler gave me error because function not exist on .as.
so, how can modify command in order tell .as script need search functions on .fla ??? thanks!
in 1 of classes in swf file loading second swf can have this:
private var loader:loader; private var secondswf:displayobject; private function loadsecondswf():void { loader = new loader(); // should handle error events... loader.loaderinfo.addeventlistener(event.complete, loader_completehandler); loader.load(new urlrequest('path/to/second/file.swf'); } private function loader_completehandler(event:event):void { secondswf = loader.content; if (secondswf.hasownproperty('xmlloader1') { var xmlloader:loader = secondswf[xmlloader1]; // call methods need on xmlloader if not null } }
in order work no steps, both swf files have come same domain.
if reside in different domains need add crossdomain.xml
file root of domain second swf file located, authorising access domain first swf file located. have call flash.system.security.allowdomain('domain.where.first.swf.is.located');
second swf. without these steps security sandbox violation faults.
Comments
Post a Comment