actionscript 3 - Difference between getDefinition and getDefinitionByName in AS3 -


can explain difference between getdefinitionbyname , getdefinition ina as3?

when load external swf can't use getdefinitionbyname because error #1065.

but using externalswf_contentloaderinfo.applicationdomain.getdefinition works ok.

so, why getdefinitionbyname doesn't find classname? mean, if definition inside applicationdomain of loaded swf, why not in main swf too? (i'm using flex).

offtopic: can't create new tags can't add tags getdefinition , getdefinitionbyname :(

getdefinition method of applicationdomain returns definition of class, namespace or function.

getdefinitionbyname package-level function flash.utils returns class object can use instantiate new objects. definition must loaded somewhere in applicationdomain.

the reason can't make getdefinitionbyname external swf is loaded separate applicationdomain. second example works because targeting correct applicationdomain. make first example work must load external swf current applicationdomain this:

var request:urlrequest = new urlrequest("externalswf.swf"); var context:loadercontext = new loadercontext(); context.applicationdomain = applicationdomain.currentdomain; var loader:loader = new loader(); loader.load(request,context); 

this works because passes current applicationdomain property of loader context.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -