Hi Lisa I came to the conclusion that it is
impossible to call an external function from within Flex if the SWF file and
the container HTML file are located on the local hard disk, rather than on a remote
web server – with the exception that it will work in the location to
which the SWF application was compiled, i.e. your project’s bin folder. If
anyone can prove me wrong, I’d be glad to see how. I don’t think this is your situation
though. You don’t make clear if you are trying this using the “play”
button from within Flex, or in a deployed application, but it sounds as though
you are not getting the same problem as I did, where I saw a security error
raised by the Flash Player plugin. Maybe send an example of the code in your
container page, and the calling code in your app. Cheers, Tim From: Tim, Did Rost's suggestion
help your situation? I have a similar issue. This works: ExternalInterface.call("alert","Hey
this is an external interface call."); But when I try to call
one of our own _javascript_ functions, it just doesn't seem to find the function
and does absolutely nothing. I even tried getting rid of all the
parameters, and just sticking an alert call as the first thing in the
_javascript_ function. It is just not reaching the function. In my case,
neither the <param name="AllowScriptAccess" value="always"> nor the
cross-domain-policy made any difference. I am super-new to Flex. I am trying
to migrate a 1.5 application to 2.0 and am going through major teething
pains. So it is very possible I have some "dumb" problem that
more experienced Flexers would not have. --Lisa From: Maybe crossdomain Policy File will help? <?xml
version="1.0"?> <!--
http://domainwhereaccesedmovieis/ crossdomain.xml --> <cross-domain-policy> <allow-access-from domain="
domainfromtryingtogetaccessfrom
" /> <!-- following will allow access
from all domains --> <allow-access-from domain="* "
/> </cross-domain-policy> Rost From: I’m trying to develop a Flex app that calls a
_javascript_ function in the container page. I did a simple test app using the
call() method of the ExternalInterface API, and it worked fine with the HTML
page and the SWF file in the original compile folder. But when I moved both
files, the attempt to run the _javascript_ produces the following ActionScript
error box: SecurityError: Error #2060: Security sandbox
violation: ExternalInterface caller file://C:\ExternalTest.swf may not access
file://C:\Container.htm.
at flash.external::ExternalInterface$/call()
at SimpleNETComp/::btn1_click()
at SimpleNETComp/__btn1_click() So, I tried switching it to call the _javascript_ using
the navigateToUrl() method of ActionScript. Again, it worked when the files
were in the original compile folder, but when I move them to another folder, I
get the error: SecurityError: Error #2051: Security sandbox
violation: file://C:\ExternalTest.swf may not evaluate scripting URLs within
file://C:\Container.htm (allowScriptAccess is 'always'). Attempted URL was
_javascript_:test('called with navigateToUrl')
at ExternalTest/::btn1_click()
at ExternalTest/__btn1_click() By the way, the HTML file contains only the basic
object wrapper, none of the history or version checking stuff, and I changed
the SWF parameter to try and open the security up, as follows: <param name="AllowScriptAccess" value="always"> Any ideas how to get the calls to work? How does the
compile location get stored into the SWF (if that’s what’s
happening)? Cheers, Tim
|