Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Flex > Flex 1

Reply
 
Thread Tools Rate Thread Display Modes
Old 06-04-2010, 01:12 AM   #1
deadlyAlive
Registered User
 
Join Date: Jun 2010
Posts: 3
Default Socket

I will be receiving message in the format - "code,message". Example "10, message". I am trying to seperate them based on the code so that, whenever i call the method, code3() i should be getting the relevant message. But when i alert the method, code3() i am getting blank. However when i try alert in progressEvent i am getting the correct value.

package Classes
{

import flash.events.ProgressEvent;
import flash.net.Socket;

import mx.controls.Alert;


public class Sock
{
public var access_all:String;
public var socket:Socket = new Socket();

public function Sock()
{
socket.connect("localhost", 1234);

socket.writeUTFBytes("2\n");
socket.flush();

socket.addEventListener(ProgressEvent.SOCKET_DATA, progressEvent);
}


public function progressEvent(event:ProgressEvent):void
{
var data:String = socket.readUTFBytes(socket.bytesAvailable);
var a:array = data.split(",");

if(data[0] == "3")
{
this.access_all = data[1];
// Alert.show(this.access_all); //correctly alerting
}
}

public function code3():void
{
Alert.show(this.access_all); //alerting blank
}
}
}
deadlyAlive is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:13 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.