NetStream : send text data

hi,
I try to do a really simple chat with NetStream. I would like to send a text on my netstream (I don't want to use camera, only text !)
I run a red5 server and I use flex 4.5
As I my new, I don't understand what is the best way to do this. I try code to send video streaming and it works but I can't send text.
Is somebody have a really simple example to do this ?

//Simple solution,
import flash.events.*
public var chat_so:SharedObject;
public var nc:NetConnection;
public var username:String;
public function createConnection():void
    nc = new NetConnection();
    nc.objectEncoding = ObjectEncoding.AMF0;
    nc.addEventListener( NetStatusEvent.NET_STATUS, netStatusHandler );
    nc.connect( "rtmp://path_to_red5/oflaDemo",username);
//Then in the netStatusHandler you would need something like this....
public function netStatusHandler( event:NetStatusEvent ):void
    switch( event.info.code )
        case "NetConnection.Connect.Success":
             connectComponents()
        break;
        case "NetConnection.Connect.Rejected":
        break;                   
//This sets up a SyncEvent handler...
public function connectComponents():void
    SharedObject.defaultObjectEncoding  = flash.net.ObjectEncoding.AMF0;
    chat_so = SharedObject.getRemote("chat_so", nc.uri, false);
    chat_so.addEventListener( SyncEvent.SYNC, usersSyncHandler_chat );
    chat_so.connect( nc );
//This fires when the sharedObject is updated...
public function usersSyncHandler_chat( event:SyncEvent ):void
        var results:Object = event.target.data;
        for( var a:String in results )
        if (  results[ a ] != undefined )
             //this will add a message to a text component...
            chatCanvas.htmlText += "" + results[ a ];
            chatCanvas.validateNow();
            chatCanvas.verticalScrollPosition = chatCanvas.maxVerticalScrollPosition;
//this button or key listener function will send a message by updating a sharedObject on all clients...
public function sendMessage():void
      //grab message from an input text component.
      var msg:String = chatInputTxt.text;
      //send the msg...
      chat_so.setProperty("textValue", username + ": " + msg );
      //clear text from chatInputTxt.text
      chatInputTxt.text = "";
HTH

Similar Messages

  • Netstream.send only text messages or any type?

    In Netstream.send() documentation it says: " ... arguments
    — Optional arguments that can be of any type."
    In the documentation to the Netstream class it says "You can
    also use NetStream objects to send text messages to all subscribed
    clients (see the NetStream.send() method)."
    I tried to send a Rectangle with Netstream.send:
    Code on Sender:
    var rect = new Rectangle(1,2,5,5);
    nc.call("serverShowRect",null, rect);
    Code on Flash Media Server: (FMS 2.0.4)
    STREAM_NAME = "myStream";
    Client.prototype.serverShowRect= function(msg)
    myStream = Stream.get(STREAM_NAME);
    myStream.send("@setDataFrame","onRectangle",msg);
    Code on Client:
    function onRectangle(infoObject:Object):void {
    trace ("Rectangle received.");
    trace ("tracing properties:");
    var key:String;
    for (key in infoObject) {
    trace(key + ": " + infoObject[key]);
    try {
    var rect:Rectangle = infoObject["rectangle"] as Rectangle;
    trace("Rect as rect:" +rect);
    catch (error:Error){
    trace(error.message);
    The function onRectangle() ist called ok. The infoObject's
    properties can be shown by trace. But I cannot convert infoObject
    into an Rectangle. var rect will be either null or I get an
    type-conversion error.
    Does anyone know how to send other data than Strings using
    Netstream.send()? Or can one actually only send Strings using FMS2

    You should receive an email receipt with every purchase that you make in iTunes on the computer or in iTunes, the App Store or the iBookstore on an iOS device. I always get a receipt via email. You are not getting them?
    If you are asking if Apple will send you a detailed purchase history, the answer to that is no since you can access that information in your account in iTunes on your computer. Click on Account under the Quick links on the right side of iTunes, enter your password at the prompt, and then click on "See all" to the right of Purchase History in the next window.

  • Iphone 4s-when wifi is off and I am away from my home connection can I receive and send texts and text messages?  I want to keep my wifi off to limit data (email etc) to when I want to check it.  Cellular is roaming"voice only" it says.Can I get texts?

    When my wifi is off and I'm away from my home connection - it shows wifi off (unless I turn it on to check my email etc.) - and in the settings cellular it shows "voice only". Will I be able to receive and send texts in those settings?  Or check voicemail.  I had wanted to keep my email from coming in all the time and only want to check it periodically - so I turn ON my wifi when I want to check my email.  But when my wifi was off away from home- I hadn't seemed to be getting my texts.  So- do I need to keep wifi roaming connected when away from home to receive and send my texts in real time.  (which is what I want) or am I still able to send and receive texts with my wifi off when I'm away from home.  (When I'm home I am connected to my home data plan automatically through wifi and I get texts when I'm home - but I'm thinking I'm not getting texts in real time - is it because my wifi is off when I'm away from home?  My cellular shows voice only when my wifi is off away from home.  Am I doing it right to receive and send texts away from home?  Or do I need to open up the wifi in order to receive and send text messages.  I know that I would need to turn on wifi roaming - which will use data - for email checking or sending - as well as to use browsing apps and now I'm guessing to receive voice messages I may have missed?  So do I need wifi on to receive texts too?  Thank you - GregorySC

    Hello GregorySC,
    In order to send and receive SMS or MMS messages, you will need to have an active cellular data or Wi-Fi connection.
    You will need these to send and receive iMessages:
    An iPhone, iPad, or iPod touch
    iOS 5.0 or later
    A cellular data connection or a Wi-Fi connection
    A phone number or Apple ID registered with iMessage in Settings > Messages
    iOS: Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Cheers,
    Allen

  • Sending user text data

    Hi everyone. I am not certain if I am in the correct section.
    I have a website designed in Flash. The site has a contact
    section with 3 fields (name, e-mail and message). Having completed
    these fields one would click "submit" to send the entered data to a
    text file which resides on a Linux (Apache) based server.
    My question is... What action statement do I need to
    configure?
    Any help \ suggestions will be appreciated.
    Regards
    Fred

    You'll need to send the data, from Flash, to a server-side
    script for
    processing. That can be done in PHP, ASP or others. Have a
    look at the
    LoadVars class in the help - the sendAndLoad method has a
    nice example you
    should be able to use to get started. For tutorials, search
    for 'forms in
    flash', this gets asked about a lot, so there's a good deal
    of info.
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • My phone isn't sending texts and only receiving some and I can't ise any Apps or Safari on cellular data.

    My Iphone 4S isn't sending texts and only receiving some incoming text messages.  My cellular data is turned on but it still won't let me use safari or any other App unless i'm connected to the WIFI at home. Any help would be much appreciated.

    I think I can help with the Cell usage issue.
    You may in fact have cell data turned on, but it may be turned off for specific apps.
    Please go to Settings...Cellular.
    First, ensure that Cellular Data is turned on.
    Next, scroll down the page and you should see a list of all your apps.
    Make sure Cell data is turned on for the apps in question.

  • Activated Device can't send text, can't receive data

    I just got this Moto Droid X phone yesterday and activated it. I don't have the best service in my area, but I wasn't in roaming. After it activated, I got my txt for the temporary password and all that. I waited the 15 mins before trying to send any texts. If all went well, I wouldn't be here.
    Anyways, when I send a text, it doesn't go through. I'll get a text to my phone, with my number as the number, saying "Recipient has insufficient funds to receive message." It'll then keep sending texts saying that (around 4). I have the $60 prepaid plan and it's not been 24 hours.
    I read somewhere (on these forums or elsewhere) to make a call to any number to speed up the process. Since I work 3rd shift it's hard to come up with people to call. I sent a call out and I let it ring a couple times and then hung up. Tried texting again to no avail. I tried the *22898 again to maybe re-verify myself. It said activated when done.
    I tried calling customer service but all the options (which was only 2) involved ways of just asking for money and on different ways of handling my money. LOL
    I want service, not options on how to take my money for service I've paid for, yet not used or received.
    Any help would be appreciated.
    Matt

        zerotone, I am sorry to hear of the difficulties you are having with activating your Motorola Droid X. We want to make sure you get the services that you are paying for! What number were you dialing to reach the prepaid department? Try to call 888-294-6804. This number will take you directly to our prepaid department so you can reach a live representative! Let us know if you need any futher help.
    LindseyT_VZW
    Follow us on Twitter @VZWSUPPORT

  • NetStream.send not working in Flash Player 11.2 Beta with Cirrus, Please confirm if it is a bug

    Title
    NetStream.send not working in Flash Player 11.2 Beta with Cirrus, Please confirm if it is a bug or feature
    Description
    Problem Description:
    NetStream.send can not send data to peerstreams when using with cirrus. Conflict with documents.
    Sorry for tag the build as 11.0.1.3 while the bug is actually on 11.2 beta since the bug report system didn't have 11.2 beta yet.
    If you are not responsible for 11.2 beta bug fix, please help a hand to handle this bug to 11.2 team.
    This bug is "killing" to your application, so we really appreciate your help. Thanks.
    ==Publisher==
    nc.connect("rtmfp://");
    var ns:NetStream = new NetStream(nc, NetStream.DIRECT_CONNECTIONS);
    ns.publish("sendtest");
    ...//after connection success.
    ns.send("clientfunction", "ok"); // this line cannot reach subscribers. even if subscribers have client object correctly.
    ==Subscriber==
    nc.connect("rtmfp://");
    var ns:NetStream = new NetStream(nc, cirrusid);
    var client:Object = new Object();
    client.clientfunction = clientfunction; // target function
    ns.client = client;
    ns.play("sendtest");
    Steps to Reproduce:
    1. compile the code in the attachment to SendTestExample.swf (not be able to paste it here)
    2. run it under flash player 11.2.202.19 beta
    3. run it under flash player 11
    Actual Result:
    HeartBeat is:
    Start HeartBeat:
    send hello
    send hello
    send hello
    which means NetStream.send was not able to call "clientfunction" as expected.
    Expected Result:
    Start HeartBeat:
    send hello
    in client function: hello
    send hello
    in client function: hello
    send hello
    in client function: hello
    which can call into the clientfunction as flash player 11 did.
    Any Workarounds:
    I can not find it out since it's an api level bug. But this can be very important for lots of applications which rely on send to do rpc.
    Test Configuration
    IE8, Firefox under Windows 7
    Also have problem under Windows XP (but not well tested on this platform)
    App Language(s)
    ALL
    OS Language(s)
    ALL
    Platform(s)
    Windows 7
    Browser(s)
    Internet Explorer 8.0
    ==Attachment==
    package {
        import flash.display.Sprite;
        import flash.events.Event;
        import flash.events.NetStatusEvent;
        import flash.events.TimerEvent;
        import flash.media.Video;
        import flash.net.NetConnection;
        import flash.net.NetStream;
        import flash.text.TextField;
        import flash.utils.Timer;
        import flash.utils.setTimeout;
        public class SendTestExample extends Sprite
            public static var statusArea:TextField;
            var ncServer:NetConnection = new NetConnection();
            var nsServer:NetStream;
            var ncClient:NetConnection = new NetConnection();
            var nsClient:NetStream;
            var timer:Timer = new Timer(1000);
            public function SendTestExample() {
                ncServer.addEventListener("netStatus", onNCStatusServer);
                ncServer.connect("rtmfp://p2p.rtmfp.net","99f72ccbed0948d7589dc38a-3ce1b2616680");
                statusArea = new TextField();
                status("status");
                statusArea.x = 0;
                statusArea.y = 0;
                statusArea.border = true;
                statusArea.width = 200;
                statusArea.height = 350;
                addChild(statusArea);
            function onNCStatusServer(event:NetStatusEvent):void {
                status("Step 1:");
                status("server: " + event.info.code);
                status("id: " + ncServer.nearID);
                switch (event.info.code) {
                    case "NetConnection.Connect.Success":
                        nsServer = new NetStream(ncServer, NetStream.DIRECT_CONNECTIONS);
                        nsServer.addEventListener(NetStatusEvent.NET_STATUS, onNSStatusServer);
                        nsServer.publish("sendtest");
                        ncServer.removeEventListener(NetStatusEvent.NET_STATUS, onNCStatusServer);
                        ncClient.connect("rtmfp://p2p.rtmfp.net","99f72ccbed0948d7589dc38a-3ce1b2616680");
                        ncClient.addEventListener("netStatus", onNCStatusClient);
                    case "NetStream.Publish.BadName":
                        //status("Please check the name of the publishing stream" );
                        break;
            function onNCStatusClient(event:NetStatusEvent):void {
                status("Step 2:");
                status("client: " + event.info.code);
                status("id: " + ncClient.nearID);
                switch (event.info.code) {
                    case "NetConnection.Connect.Success":
                        nsClient = new NetStream(ncClient, ncServer.nearID);
                        var c:Object = new Object();
                        c["clientfunction"] = clientfunction;
                        nsClient.client = c;
                        nsClient.play("sendtest");
                        ncClient.removeEventListener(NetStatusEvent.NET_STATUS, onNCStatusClient);
                        //setTimeout(sendHello, 5000);
                    case "NetStream.Publish.BadName":
                        //status("Please check the name of the publishing stream" );
                        break;
            protected function onNSStatusServer(event:NetStatusEvent):void {
                status("nsserver: " + event.info.code);
                if (event.info.code == "NetStream.Play.Start") {
                    status("Start HeartBeat:");
                    this.timer.addEventListener(TimerEvent.TIMER, function (e:Event):void {
                        sendHello();
                    this.timer.start();
            protected function sendHello():void {
                status("send hello");
                nsServer.send("clientfunction", "hello");
            protected function status(msg:String):void
                statusArea.appendText(msg + "\n");
                trace("ScriptDebug: " + msg);
            protected function clientfunction(event:Object):void {
                status("in client function: " + event);

    Thanks for reporting. I can reproduce the bug in house. We will investigate.
    Calise

  • My iPhone 5 won't send texts without wifi, even when I have 4G. It also won't make calls. Any ideas?

    My iPhone 5 won't send texts without wifi, even when I have 4G. It also won't make calls. Any ideas?

    Do you have a cellular plan with data and SMS activated?

  • How to print text/data in flex 3 using printer???Plz help...

       Hi,
              plz tell me the way to print text/data using printer in flex.  I tried the FlexPrintJob class. but it takes object of a container to be printed & prints the visible content of that container(along with scrollbars), bt i want to print all contents of the container(including invisible).
          I have tried to print bitmap image through FlexPrintJob but it takes lot of time for spooling... So plz help me out in printing(fast with all content) in flash
    I am using flex 3 (flex Builder 3 IDE).
      Thanks in advance!!!

    Hi Sagar,
    Don't worry You can use the below work around to print all the contents of the Container including the invisible contents under scrolll with out scroll bar..
    So what the idea here is we are seeting the container height to full size with out scrolls before sending the container object to printer and as soon as you print the object you are restoring it to the original height with scrolls...so that you can print the full contents without scrolls...
    You may have doubt that by chnaging and restoring the size the user may see momentary resize of the container but it is not so as it is a fraction of a second and user cannot notice this change... Give it a try ..I had already run into this problem recently and I have found a work around for this which is as below:
    // Here mainContainer is the container or box id the contents of which you want to print
       private function doPrintContainer():void
        var printJob:FlexPrintJob = new FlexPrintJob();
        if(printJob.start() != true) return;
        try
         var mainContainerHeight:int = mainContainer.height;
         //Increasing the height of the desired component to be printed.
         mainContainer.height = mainContainer.measuredMinHeight;
         mainContainer.verticalScrollPolicy = "off";
         //Adding the resized Component to our FlexPrintjob and then sending the print request
         printJob.addObject(this,FlexPrintJobScaleType.MATCH_WIDTH);    
         printJob.send();
         //Resizing the component back to normal size
         mainContainer.height = mainContainerHeight;
         mainContainer.verticalScrollPolicy = "auto";    
        catch(error:Error)
                     trace("Error : " + error.message);
    If this post answers your question or helps, please kindly mark it as such.
    Thanks,
    Bhasker Chari

  • TS2755 My wife and I both have iPhone 5s, I can't send text messages to non iPhone people that I use to but iPhone people I can, My wife can send text to non iPhone numbers.  I have checked and we both have the same settings.

    My wife and I both have iPhone 5s, I can't send text messages to non iPhone people that I use to but iPhone people I can, My wife can send text to non iPhone numbers.  I have checked and we both have the same settings.  Both of our phones are up to date 7.0.4.

    The ability to see and send calendar invites is a function of the calendar you are subscribing to and who owns it. We need more information, like what calendar are you subscribing to? MS Exchange? Google? Mobile Me?

  • How do I write a vi that will save graph data and text data (related to the graph) so the next time I want to view the graph data the text data is included in the read vi?

    I am new at writing vi's and hope you may be able to help. I would like to create a vi that will graph measurements taken from a daq device. I would like to include text data that a user can choose from (example: machine number, test circuit, load cell type) that will stay with the graph so when the graph is viewed at a later time the text data (explaining parts of the graph) will display with the graph data. I have included a vi I am using to capture and display a force value. Any help would be greatly appreicated.
    Attachments:
    force.vi ‏500 KB

    What you want is a DATALOG file:
    When you save a file, use the BUNDLE function to bundle your machine number, test circuit, whatever (include a few spare fields), plus your graph data. Get the graph data from the source, or use a local variable of the graph itself.
    Wire the bundle output to the DATALOG TYPE of a NEW FILE function. (I presume you'll use a FILE DIALOG set to SAVE FILE to choose a file path).
    Write the same bundle output to the DATA input of a WRITE FILE function.
    Use a CLOSE FILE function to (ahem) close the file.
    When you want to read a file, use a FILE DIALOG set to EXISTING FILE (or some other means) to specify what file to read. Wire the same cluster type to the DATALOG TYPE of the FILE DIALOG, so that it will only
    offer files of the correct type.
    When you have a file path chosen, wire the bundle to the DATALOG TYPE input of a FILE OPEN operation.
    Use a FILE READ to read a single cluster - the output of FILE READ will be a cluster of the right type.
    Use a CLOSE FILE function to....
    Out of the FILE READ function, you can UNBUNDLE BY NAME the data and send to the graph and the other fields, or, if you're clever, you can use a cluster on the screen, and not unbundle it. That's harder though, since you probably want the text fields to be controls (inputs) and the graph to be an indicator (output).
    Hope that helps.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • I have poor/no service on my iphone 6  in places that I do have service on my old iphone 5.  Takes 10 minutes to send text and webpages will not load but load within seconds on the iphone 5 and forget making a phone call.  How do i resolve this issue??

    I have poor/no service on my iphone 6  in places that I do have service on my old iphone 5.  Takes 10 minutes to send text and webpages will not load but load within seconds on the iphone 5 and forget making a phone call.  How do i resolve this issue??

    Hey kristiac,
    Thanks for the question. If I understand correctly, you have no service on the iPhone. I would recommend that you read this article, it may be able to help the issue.
    If you can't connect to a cellular network or cellular data - Apple Support
    Thanks for using Apple Support Communities.
    Have a good one,
    Mario

  • After I upgraded my iphone 4 with the ios 7.1.1 it locks up sending text messages.  It will send a few, then mid conversation I will have to turn my phone off and back on, sometimes a few times, before it will allow me to send or receive messages again.

    After I upgraded my Iphone 4 with the ios 7.1.1 it locks up while sending text messages.  I can usually send a few then will have to restart my phone(often more than once) to get it to send and receive messages again.  I have done a back up and complete reset and that has not fixed the problem.    Have been told that the ios 7.1.1 just isn't compatible with the Iphone 4 so that's why it is locking up so often, but I am hoping someone else may have a better answer since it can't be undone.  Thanks!

    7.1.1 is certainly compatible with the iPhone 4. Just try a reset first.
    Close all open apps by double-tapping the home button, then swiping up and off the screen with the app window (not the smaller icon).
    Reset your device: hold down the home button along with the sleep/wake button until the screen goes black and you see the Apple, then let go. (No data loss)

  • Losing network connection (phone, text, data)

    For the past couple of weeks I have had problems losing my network connection affecting phone calls, text messages and data access. The problems seem to be occurring more frequently, and have not been able to identify a consistent pattern yet.
    Phone: On 2-3 occasions recently, I have had calls dropped.  I see that I have no [phone] network connection.  In each case I've been in a location where I frequently make calls.  Twice this was while on a major freeway in the SF Bay Area.  In each case I do get a signal back, but it takes several minutes until I re-acquire a signal.
    Text:  On multiple occasions (3-4 in the past week), I have tried to send text messages from my office (in San Jose), where I have not had problems in the past.  After waiting for several minutes to re-acquire a signal, I re-booted my phone and my text messages were sent as soon as the phone re-booted.  Note:  changing the phone to airplane mode and then off, did not resolve the problem.
    Data:  On multiple occasions (8-10 times in the past couple of weeks), I noticed that my phone shows "4G", but no arrows and I have no data access (i.e. no access via web browser, can't use any email apps, can't use any apps that use data access).  Once I lose the data connection, it never re-acquires the network even after moving and/or waiting in excess of an hour.  The only way to re-acquire data is to re-boot my phone.
    This seem to have started 2-3 weeks ago, but definitely getting worse over the past week - very, very frustrating!
    Using Samsung S4, running Android 4.4.2.  I don't recall installing any new apps or new O/S versions in the past couple of weeks, though many updates auto-installed.

    I tried removing/replace the Sim card.  Still have the problem.
    I got really frustrated with this and after spending over an hour on the phone with technical support and then with Assurion, I got them to replace my  phone, with a replacement S4.   Spent another couple of hours getting my phone reconfigured, including having to spend another half an hour on the phone with technical support because the new phone wasn’t activating on the network.   And, still have the same problem on two consecutive days where the phone hangs when I try to make a call at the end of the day.  (Though I had been able to make a couple of calls during the day).
    So:
    ·         It fails in safe mode
    ·         It fails if I set the network to LTE/CDMA rather than Global
    ·         It fails after re-seating the Sim card
    ·         It fails with a replacement device
    What’s going on?  How do I fix this?

  • Master text data in Open Hub

    Hi All,
    I am working on BI 7.0 and am currently working on Open Hub. I have to extract data from a cost center infocube, but i also need to send the master text data for certain fields along with the infocube data into the file server.
    Is this possible with open hub services,could someone please provide me with a step by step procedure to this one.
    I have been following a similar thread
    Nav. Attrib in Open Hub 04s
    Please let me know if it was succefully implemented by someone.
    Regards
    Dipali

    Hi Uppala,
    Following are 2 approaches to achieve this
    Approach 1:
    1. Create info spoke which will extract data from cube to data base table (do not use file)
    2. Create one more info spoke which will extract master data text to data base table (again do not use file)
    3. Create join on both the data base tables.
    4. Write a ABAP program which will create a file based on the joins of tables.
    Approach 2 :
    1. Create multiprovider on cube and master data info object
    2. Create info spoke based on the multi provider, that will extract data to flat file
    For 2nd approach u have to put certain filters to avoid unwanted rows
    Regards,
    Ajinkya

Maybe you are looking for

  • Post with clearing

    Hi Experts, I'm using t-code F-04 to clear open items.  I entered a GL account and Account type S in the parameter but I cannot proceed due to the error 'There are no open items managed in account 171200' But if you check FBL3n there are lots of open

  • OnPremise: Sharepoint Hosted App gives 401 unauthorized error while accessing UserProfile Rest Service

    Hi All, I have SharePoint hosted app deployed on On-Premise using(F5) which reads User Profile data consumes WCF(Hosted on same server) through REST API to insert data in to SQL DB(Different server). SharePoint hosted app was working as expected and

  • Why did 4.3 cause the recopying of all my photos?

    Downloaded and installed IOS 4.3 with no problems on two phones, my iPhone 4 and my wife's 3Gs. But for both phones, subsequent syncs included the re-copying of all our photos. No problems with the photos, but does anyone know why the recopying? Than

  • Deleting prior messages

    Just got a new BB Curve 9300 yesterday and so far I've had several issues. I was a BB user for years, had to go try an android for a year, but now I'm back. First I had probelms going thru the set up email wizard....taked to my carrier and went all t

  • Want to install my Adobe photoshop/premiere elements 11 on new iMac.

    New iMac does not have cd drive, but I want to download my Adobe Photoshop/Premiere Elements 11 on the new iMac. I have the serial number, How do I download?