Set up a custom LoaderContext with checkPolicyFile=true

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of dorkie dork from dorktown
Sent: Monday, November 12, 2007 1:03 PM
To: [email protected]
Subject: Re: [flexcoders]SWFLoader Security Sandbox issue

 

I'm still getting the error. I created a button that creates the swf
dynamically so I can make sure to wait long enough to load the
crossdomain file. I think maybe its that I am trying to script (change
the values of) the chat.swf application. 

http://www.flexcapacitor.com/flashusers/chatTest.html
<http://www.flexcapacitor.com/flashusers/chatTest.html> 

reading the manual again...



On Nov 12, 2007 2:23 PM, Paul Decoursey <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:

Ok here is my other idea..

 

change this:

initialize="{init()}" 

 

to this:

preinitialize="this.init();" 

 

My thinking is that the load is failing before you allow the domain.

 

 

 

On Nov 12, 2007, at 2:15 PM, dorkie dork from dorktown wrote: 





Still getting this error:

SecurityError: Error #2121: Security sandbox violation: Loader.content:
http://www.flexcapacitor.com/flashusers/chatTest.swf
<http://www.flexcapacitor.com/flashusers/chatTest.swf>  cannot access
http://static.chatopica.com/chat.swf?room=flash
<http://static.chatopica.com/chat.swf?room=flash> . This may be worked
around by calling Security.allowDomain .
    at flash.display::Loader/get content() 
    at mx.controls::SWFLoader/get content()
    at chatTest/__swfLoader1_init()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent ()
    at mx.controls::SWFLoader/contentLoaderInfo_initEventHandler()




On Nov 12, 2007 1:43 PM, Paul Decoursey < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote: 

I'm going to say try loading the crossdomain.xml explicitly and see if
that fixes it.

 

Security.loadPolicyFile("  http://static.chatopica.com/crossdomain.xml
<http://static.chatopica.com/crossdomain.xml> ");

 

 

Paul

 

 

On Nov 12, 2007, at 12:45 PM, dorkie dork from dorktown wrote:





I'm trying to load in a swf from another domain (chatopica chat room)
and cant work around the security sandbox. This works fine locally but
when I put it on the server I get the security domain errors. What am I
missing?   

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " layout="absolute" 
    initialize="{init()}" 
    backgroundGradientAlphas="[1.0, 1.0]" 
    backgroundGradientColors="[#FFFFFF, #FFFFFF]" xmlns:ns1="*"> 
     
    <mx:Script>
        <![CDATA[ 
            private function init():void {
                Security.allowDomain(' static.chatopica.com
<http://static.chatopica.com> ')
                Security.allowDomain(' static.chatopica.com/chat.swf'
<http://static.chatopica.com/chat.swf%27> )
                Security.allowDomain('
http://static.chatopica.com/chat.swf'
<http://static.chatopica.com/chat.swf%27> )
                Security.allowDomain ('
static.chatopica.com/chat.swf?room=flash'
<http://static.chatopica.com/chat.swf?room=flash%27> )
                Security.allowDomain('
http://static.chatopica.com/chat.swf?room=flash'
<http://static.chatopica.com/chat.swf?room=flash%27> )
                Security.allowDomain('http://static.chatopica.com'
<http://static.chatopica.com%27> )
            }
            private function initLoader(event:Event):void {   
                // errors out here. this is a hack to fix the width and
height of the chat room to match the swfloader
                event.target.application.width = swfLoader1.width;
                event.target.application.height = swfLoader1.height;
            }
        ]]>
    </mx:Script>
    <mx:SWFLoader id="swfLoader1" scaleContent="true" x="30" y="30"
width="500" height="500"   
        source="http://static.chatopica.com/chat.swf?room=flash
<http://static.chatopica.com/chat.swf?room=flash> "
        init="{event.target.content.addEventListener
('applicationComplete',initLoader)}"/> 
    <mx:Label x="30" y="4" 
        text="Example embedding Chatopica"/>

</mx:Application>  




 





 

 

 

Reply via email to