javascript - Using Function in Adobe Air -


hi started playing adobe air. , using javascript library called angular.

however, there line in library triggers adobe air's sand box:

fn = function('s', code); 

on adobe air support page there sentence:

calls new function(param, body) can replaced inline function declaration or used before page load event has been handled.

can please explain me inline function declaration mean , how use in general achieve same effect?

thanks

javascript frameworks use eval , other blocked methods can work in adobe air, not in application sandbox.

see document details, can work loading page(s) use framework secondary frame. top frame in air considered application sandbox, whereas other frame runs in non-application mode, , therefore allows access of blocked javascript methods.

http://help.adobe.com/en_us/air/html/dev/air_htmldevguide.pdf

search section "overview on configuring html-based application"

here example of frameset have used around problem

<body>      <iframe src="/blank.html" width="100%" height="0" scrolling="no" id="top" ></iframe>     <iframe src="http://www.example.com/air/home.html"  documentroot="app:/" sandboxroot="http://www.example.com/air" allowcrossdomainxhr="true" width="100%" height="720" scrolling="no" id="bottom">     </iframe>  </body> 

the magic in documentroot , sandboxroot attributes. whatever set documentroot replaces domain used in sandboxroot. note result sandboxroot doesn't need valid path.

in instance top frame loads file called blank.html application application sandbox, hence file can call file system functions etc.. app sandbox has privileges do.

the second frame load "home.html" application directory, load non-application sandbox, can contain pretty javascript framework run in safari 4 (assuming using latest version of air runtime). frame cannot call secure air functions such file system access.

if want call file system functions , other secure methods second frame, need create sandbox bridge, covered in document refer above.

hope helps.


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 -