Chat application developed in flash is not working when publishing in flashlight 3
Chat application developed in flash is working when publishing in flashplayer 8 or above but when i publishing in flashlight 3 it is not working ...i want to build the chatapplication for nokia n95..any one can help me in that part...........????
Re: Chat application developed in flash is not working when publishing in flashlight
What kind of a socket server are you using for the chat application?
If you are using a commercial server like SmartFoxServer or ElectroServer it will not function with Flash Lite. These are for web based applications.
You may want to read this article on working with multiplayer applications with Flash Lite and XML Sockets.
[url]http://www.adobe.com/devnet/devices/articles/flashlite_sockets.html[/url]
Mariam
Re: Chat application developed in flash is not working when publishing in flashlight
Thanks Mariam for your reply...
I am using flash Media server 3.For running the application in mobile we have to develop that in flash itself.So i developed chatprogram in flash and connecting to flash media server 3.when it is publishing in flash 8 it is working.I copied that swf file into Nokia N95, there is one connect button so when connct with fms server it shows "Established socket connection to 192.168.7.62" but not displaying online users and messages from the server..can you help me in this problem.......
Re: Chat application developed in flash is not working when publishing in flashlight
Hi,
Do you get a prompt from the device asking to establish a network connection?
Re: Chat application developed in flash is not working when publishing in flashlight
[QUOTE=yamunaks123;425585]Thanks Mariam for your reply...
I am using flash Media server 3.For running the application in mobile we have to develop that in flash itself.So i developed chatprogram in flash and connecting to flash media server 3.when it is publishing in flash 8 it is working.I copied that swf file into Nokia N95, there is one connect button so when connct with fms server it shows "Established socket connection to 192.168.7.62" but not displaying online users and messages from the server..can you help me in this problem.......[/QUOTE]
yaa when it is connecting to the server it got connecting..that is"Established a socket connection to serverIpaddress..."...connection is success but that messages and list of online users are not displaying in the textarea.....
Re: Chat application developed in flash is not working when publishing in flashlight
I will paste my code here..
import mx.collections.ArrayCollection;
import mx.utils.Delegate;
import flash.net.*;
import flash.events.*;
import flash.utils.*;
import mx.controls.*;
import mx.core.UIComponent;
// Current release of FMS only understands AMF0 so tell Flex to
// use AMF0 for all NetConnection, NetStream, and SharedObject objects.
//NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0;
//NetStream.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0;
//SharedObject.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0;
// echoResponder is used when nc.call("echo", echoResponder ...) is called.
//var echoResponder:Responder = new Responder(echoResult, echoStatus);
// SharedObject and NetConnection vars
var nc:NetConnection;
var ro:SharedObject;
nc = new NetConnection();
function init()
{
//trace("Initializing application... in player: " + flash.system.Capabilities.version + "\n");
// create new connection to FMS and add listeners
nc = new NetConnection();
//nc.addEventListener(NetStatusEvent.NET_STATUS, onStatus);
//nc.addEventListener("click", Delegate.create(this, onStatus));
//nc.onStatus= Delegate.create(this, onStatus);
//nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, netSecurityError);
}
/**
* connect is called whenever the connectButton is pressed
* and decides what to do based on the current label of the button.
* NOTE: the rtmp address is in this function. Change it if you need to.
*/
function connect()
{
if(userName.text == ""){
Alert.show("Please enter a user name.");
return;
}
//onStatus()
nc.onStatus = function ( info )
{
// Write out information about connection events:
trace("netStatus: " + info);
// var info:Object = event.info;
var info:Object=info;
for(var p:String in info) {
trace(p + " : " + info[p]);
}
trace("eventttts..");
writeln("");
switch (info.code)
{
case "NetConnection.Connect.Success" :
connectButton.label = "Disconnect";
connectButton.enabled = true;
sendButton.enabled = true;
trace("Connecting non-persistent Remote SharedObject...\n");
ro = SharedObject.getRemote("ChatUsers", nc.uri);
trace("printin ro"+ro);
trace("netconnection...."+ nc.uri);
if(ro){
ro.onSync= Delegate.create(this, chatonSync);
ro.msgFromSrvr = Delegate.create(this, chatMsg);
trace("hiii in onStatus()");
ro.connect(nc);
ro.client = this; // refers to the scope of application and public funtions
}
break;
case "NetConnection.Connect.Closed" :
connectButton.label = "Connect";
connectButton.enabled = true;
sendButton.enabled = false;
break;
case "NetConnection.Connect.Failed" :
break;
case "NetConnection.Connect.Rejected" :
break;
default :
//statements
break;
}
}
switch(connectButton.label){
case "Connect":
connectButton.label = "Wait";
connectButton.enabled = false;
nc.connect("rtmp://192.168.7.67/chat_test",userName.text);
nc.client = this;
break;
case "Disconnect":
connectButton.label = "Connect";
connectButton.enabled = true;
nc.close();
break;
}
}
/* function netSecurityError(event:SecurityErrorEvent) {
writeln("netSecurityError: " + event);
}
*/
/**
* This method could be named anything - even onStatus. I've named it
* netStatus as in Dave Simmons example. In the docs they use the
* name netStatusHandler. Instead of receiving an information object
* it is passed an event that contains the information object.
*/
/*function netStatus(event:NetStatusEvent)
nc.onStatus = function ( info )
{
// Write out information about connection events:
var info:Object = event.info;
for(var p:String in info) {
}
writeln("");
switch (info.code)
{
case "NetConnection.Connect.Success" :
connectButton.label = "Disconnect";
connectButton.enabled = true;
sendButton.enabled = true;
writeln("Connecting non-persistent Remote SharedObject...\n");
ro = SharedObject.getRemote("ChatUsers", nc.uri);
if(ro){
//ro.addEventListener(SyncEvent.SYNC, OnSync);
ro.onSync= Delegate.create(this, onSync);
trace("hiii in onStatus()");
ro.connect(nc);
ro.client = this; // refers to the scope of application and public funtions
}
getServerTime(); // get local time
break;
case "NetConnection.Connect.Closed" :
connectButton.label = "Connect";
connectButton.enabled = true;
sendButton.enabled = false;
break;
case "NetConnection.Connect.Failed" :
break;
case "NetConnection.Connect.Rejected" :
break;
default :
//statements
break;
}
}
*/
function chatonSync(list)
{
trace("chatonSync");
// Show the ChangeList:
var info:Object;
var currentIndex:Number;
var currentNode:Object;
var changeList:Array = event.changeList;
var temp:Array = new Array();
trace("---- Shared Object Data -----");
for(var p:String in ro.data){
trace("OnSync> RO: " + p + ": " + ro.data[p]);
temp.push(ro.data[p]);
}
//this.usersList.dataProvider = temp; //update list of users
trace("print..temp" + temp);
usersList.addItem(temp);
trace("values in temp"+temp);
trace("length"+changeList.length);
for (var i:Number=0; i < changeList.length; i++)
{
info = changeList[i];
for (var k:String in info){
trace("OnSync> changeList[" + i + "]." + k + ": " + info[k]);
}
}
}
/** echoResult is called when the echoResponder gets a result from the nc.call("echoMessage"..) */
function echoResult(msg:String){
trace("echoResult: " + msg + "\n");
this.serverTime.text = msg;
}
/** echoResult is called when the echoResponder gets a error after a nc.call("echoMessage"..) */
/*function echoStatus(event:Event):void{
}
*/
/** sendMessage is called when the sendButton is pressed to test ns.send */
function sendMessage(){
// call our remote function and send the message to all connected clients
var msg=sendMessageInput.text;
trace("message from sendMessage...."+msg);
//nc.call("msgFromClient", null, sendMessageInput.text);
nc.call("msgFromClient", null, msg);
trace("after nc.call"+ msg);
sendMessageInput.text = "";
}
function getServerTime(){
trace("server Time");
var date=new Date();
serverTime.text=date;
}
/** showMessage is the function called by the inStream. See the netStatus function */
function showMessage(msg){
trace("showMessage: " + msg + "\n");
}
function setUserID(msg:Number){
trace("showMessage: " + msg + "\n");
}
function setHistory(msg:String){
trace("showHistory: " + msg + "\n");
}
function chatMsg(msg:String){
/*trace("printing message from server"+msg);
writeMessage(msg);*/
messageArea.text += msg + "\n";
trace("printing message in writeMessage()..."+msg);
messageArea.validateNow();
messageArea.verticalScrollPosition = messageArea.maxVerticalScrollPosition;
}
/**
* writeln writes text into the traceArea TextArea instead of using trace.
* Note to get scrolling to the bottom of the TextArea to work validateNow()
* must be called before scrolling.
*/
function writeln(msg){
traceArea.text += msg + "\n";
traceArea.validateNow();
traceArea.verticalScrollPosition = traceArea.maxVerticalScrollPosition;
}
/**
* writeMessage writes text into the main chat text area
*/
/* function writeMessage(msg){
messageArea.text += msg + "\n";
trace("printing message in writeMessage()..."+msg);
//messageArea.validateNow();
messageArea.verticalScrollPosition = messageArea.maxVerticalScrollPosition;
}
*/
connectButton.addEventListener("click", Delegate.create(this, connect));
connectButton.addEventListener("click", Delegate.create(this, getServerTime))
sendButton.addEventListener("click", Delegate.create(this, sendMessage));
rtmp://192.168.7.67/chat_test..Server side code is put in 192.168.7.67/chat_test..
Chat application developed in flash is not working when publishing in flashlight
In chat application messages can send but online users and sendmessages are not seeing in textarea...How to fix that problem..
please anyone can help me in that problem.....
Re: Chat application developed in flash is not working when publishing in flashlight
[QUOTE=yamunaks123;429210]In chat application messages can send but online users and sendmessages are not seeing in textarea...How to fix that problem..
please anyone can help me in that problem.....[/QUOTE]
I think its not possible if you developed flash8 swf file and you want to run in flashlite
i think you can not run it.
you you to create again it from adobe cs3 and use device central for it.
you can use only ActionScript 1.0 and ActionScript 2.0 in mobile.
Regards
Ashish