on ErrorError #2048: Security sandbox violation:
https://10.3.54.30:4343/screens/switch/HttpStreaming.swf cannot load
data from
10.3.54.30:4343.
If I run the code from Flex build, iut works, but after I copy put the
swf file in to html and load from server, I got the error shown above.
I have put the crossdomain.xml at root to allow access from all domain
and all port. I am using Apache.
Does any one know why?
A lot of thanks!
Code is attached:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" xmlns:cmp="org.httpclient.*" borderStyle="none"
height="500" width="500" creationComplete="initInterface()">
<mx:Script>
<![CDATA[
import com.adobe.net.URI;
import org.httpclient.events.*;
import mx.controls.TextArea;
import mx.containers.Panel;
import mx.controls.Alert;
import asscript.*;
import mx.controls.Alert;
import org.httpclient.*;
var output:TextArea;
var bufferSize:int=1024;
var dataIn:Array=new Array();
var rDataSize:int=0
var count:int=0
var inputByteArray:ByteArray=new ByteArray();
var dataString:String=new String();
var s1:Number;
var s2:Number;
public function initInterface():void
{
output=new TextArea();
output.width=500;
output.height=500;
this.addChild(output);
/* var myTimer:Timer = new Timer(100, 20000);
myTimer.addEventListener("timer", updateUI);
myTimer.start(); */
var client:HttpClient = new HttpClient();
/* client.listener.onStatus = function(event:HTTPStatusEvent):void
{
Alert.show("on status");
};*/
client.listener.onData = function(event:HttpDataEvent):void
{
/* var d:ByteArray = event.bytes;
inputByteArray.writeBytes(d);
count=count+d.length;
if(inputByteArray.length>=bufferSize)
{
updateUI1();
}*/
var d:String= event.readUTFBytes();
rDataSize=rDataSize+d.length;
count=count+d.length;
updateUI3(d);
};
client.listener.onComplete = function(event:HttpResponseEvent):void {
var now2:Date=new Date();
s2=now2.getTime()-s1;
Alert.show("on Complete"+count +"time "+s2+
"array="+inputByteArray.length);
updateUI2();
};
client.listener.onError = function(event:ErrorEvent):void {
var errorMessage:String = event.text;
Alert.show("on Error"+errorMessage);
};
var uri:URI = new URI("
https://10.3.54.30/images/spectrumdata");
var now:Date = new Date();
s1=now.getTime();
client.get(uri);
}
public function updateUI(event:TimerEvent):void
{
output.text+=".";
}
public function updateUI2():void
{
/* var iByteArray:ByteArray=new ByteArray();
iByteArray.writeDouble(Math.PI);
iByteArray.position=0;
var k:Number=iByteArray.readDouble();
output.text+=" "+k;*/
inputByteArray.position=0;
do
{
var i:uint=inputByteArray.readByte();
output.text+=i+" ";
}
while(inputByteArray.bytesAvailable!=0);
}
public function updateUI3(s:String):void
{
output.text+=s;
}
public function updateUI1():void
{
var bArray:ByteArray=new ByteArray();
/*if(inputByteArray.length>1024)
inputByteArray.readBytes(bArray,0,1024);*/
output.text+=".";
}
]]>
</mx:Script>
</mx:Application>