Hi there, thanks for checking my post. I am building a simple flash lite app that I want to connect to an xml socket server running on my mac
http://www.rshields.com/?q=node/91I can connect to the server when I run my Flash Lite application in Adobe Device Central but when I place the swf on my phone (Nokia N96) in the folder c:/data/others/trusted and run it through the gallery I can't connect to the server (the swf tries to connect but fails).
I believe I have fulfilled all of the security requirements, (crossdomain.xml file in the root of my mac's sites folder) but I still can't get this to work!
If anyone can help me sort this I would be really grateful, I only need this app to run on my local network as it's for an installation.
My code is below
Many thanks!
Hect
var keyListener:Object = new Object();
var holder:MovieClip = this.createEmptyMovieClip("holder", this.getNextHighestDepth());
function setupSecurity(){
System.security.allowDomain("*");
System.security.allowInsecureDomain("*");
System.security.loadPolicyFile("http://192.168.1.3");
}
// Define the onKeyDown events to listen to
keyListener.onKeyDown = function() {
//trace(text_txt);
attachMovie("square", "sq",1);
trace(">");
if (Key.getCode() == Key.ENTER) {
//this address won't connect when running on the phone
socket.connect("192.168.1.3", 6780);
traceIt("connecting 192.168.1.3");
}
else if (Key.getCode() == ExtendedKey.SOFT1) {
traceIt("Left softkey pressed");
}
else if (Key.getCode() == ExtendedKey.SOFT2) {
traceIt("Right softkey pressed");
}
else if (Key.getCode() == Key.UP) {
// loads an image to check that the ip address is correct
loadMovie("http://192.168.1.3/~username/project/img.jpg", holder);
}
else if (Key.getCode() == Key.DOWN) {
// this works when running the app locally in adobe device central
traceIt("connecting 127.0.0.1");
socket.connect("127.0.0.1", 6780);
}else if (Key.getCode() == Key.LEFT){
traceIt("setting security");
setupSecurity();
}
}
var socket:XMLSocket = new XMLSocket();
socket.onConnect = function (success) {
traceIt("onc");
if (success){
traceIt("success");
}else{
traceIt("fail");
}
}
socket.onData = function(d){
traceIt("data:"+d.toString());
}
function traceIt(s:String){
text_txt.text += s+"\r";
}
// Enable the key listener
Key.addListener(keyListener);
setupSecurity();