8 Replies Latest reply: Dec 10, 2009 9:06 AM by couto.vicente RSS

    Security Error #2060

    couto.vicente Community Member

      Hello folks!

      I'm with a problem and I cannit fix it. It must be very simples, but I've ever already loooked at lots of tips, and nothing works.

      I hava a flex application that needs to read some javascript functions, and this does not works anyway!

      For examplo, if I open this html file in my browser:


      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html>
      <head>
      <title>Test</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <meta name="language" content="en" />
      <meta name="description" content="" />
      <meta name="keywords" content="" />

       

      <script src="js/swfobject.js" type="text/javascript"></script>
      <script type="text/javascript">
        var flashvars = {
        };
        var params = {
         menu: "false",
         scale: "noScale",
         allowFullscreen: "true",
         allowScriptAccess: "always",
         bgcolor: "#FFFFFF"
        };
        var attributes = {
         id:"Test"
        };
        swfobject.embedSWF("Test.swf", "altContent", "100%", "100%", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
      </script>
      <style>
        html, body { height:100%; }
        body { margin:0; }
      </style>
              <script type="text/javascript">
                  function getTestValue(){
                    return "Ok";
                  }
              </script>
      </head>
      <body>
      <div id="altContent">
        <h1>Test</h1>
        <p>Alternative content</p>
        <p><a href="http://www.adobe.com/go/getflashplayer"><img
         src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
         alt="Get Adobe Flash player" /></a></p>
      </div>
      </body>
      </html>

      If I click at the application button I receive the security error message.

       

      The mxml file:
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >
       
      <mx:Button label="Click me" click="onClick()" />
       
      <mx:Script>
        <![CDATA[
         import flash.external.ExternalInterface;
         import mx.controls.Alert;
         import mx.core.Application;
        
         private function onClick():void {
          if (ExternalInterface.available)
           try{
            Alert.show(ExternalInterface.call("getTestValue"));
           }catch (e:SecurityError) {
            Alert.show(e.message);
           }
         }
        ]]>
      </mx:Script>
      </mx:Application>

       

      Does anyone can help me please?

      Best regards!