1 Reply Latest reply on Jun 23, 2009 5:26 PM by EMelville

    I Setup RemoteObject Ok! But not the effect i'm looking for?

    EMelville

      So my goal is to simply make the txtID box below disappear... that's right!.... on everyone's screen. (Code is in bold)

       

      Can you tell me what i'm missing? The Code works ok below, just when I initiate the  writefn(); command, the textbox "txtID" only disappears on my screen, no one elses. I've got to be close...

       

      Take a look:

       

      <mx:Script>

                 <![CDATA[

       

                      //variables

                      public static var nc:NetConnection;

                      public static var module_so:SharedObject;

       

                      //init function on creationComplete

                      public function init():void

                      {

                            nc = new NetConnection();

                            nc.connect("rtmp://media.thealphacompany.net/ambientdemo");

                            nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);

       

                      }

       

                      //netStatusHandler function

                     public function netStatusHandler(e:NetStatusEvent):void

                     {

                                     switch (e.info.code)

                                     {

                                      case "NetConnection.Connect.Success":

                                          my_connection_label.text="CONNECTED";

                                          initRSO();

                                              break;

                                      case "NetStream.Play.StreamNotFound":

                                            my_connection_label.text="DISCONNECTED";

                                              break;

                                      }

                           trace( "netStatusHandler : " + e.info.code );

                   }

       

                      //init remote shared object          

                   public function initRSO():void

                    {

                        module_so = SharedObject.getRemote("module", nc.uri, true);

                        module_so.addEventListener(SyncEvent.SYNC,rsoHandler);

                        module_so.connect(nc);

                   }          

       

                   //remote shared object handler    

                   private function rsoHandler(e:Object):void

                    {

                        trace("SyncEvent.SYNC");

                   }

       

                      //write-set remote shared object when writeSO button is released          

                   public function writefn():void

                    {

                             module_so.setProperty("PollQ",txtID.visible=false);

                   }

       

                   //read remote shared object when readSO button is released

                   public function readfn():void

                    {

                             my_rso_label.text=module_so.data.PollQ;

                   }

       

                 ]]>

           </mx:Script>

       

           <mx:Label x="423" y="144" text="Label" id="my_connection_label"/>

       

           <mx:Button x="423" y="170" label="writeSO" id="writeSO" click="writefn();"/>

           <mx:Button x="502" y="170" label="readSO" id="readSO" click="readfn();"/>

       

           <mx:Label x="423" y="198" text="Label" id="my_rso_label"/>

       

           <mx:TextInput x="94" y="248" id="txtID"/>

        • 1. Re: I Setup RemoteObject Ok! But not the effect i'm looking for?
          EMelville Level 1

          I've updated these two values:

           

            //write-set remote shared object when writeSO button is released            

                       public function writefn():void

                        {

                                 module_so.setProperty("PollQ",false);

                       }

           

                       //read remote shared object when readSO button is released

                       public function readfn():void

                        {

           

                                 if (module_so.data.PollQ == false){

                                 my_rso_label.text=module_so.data.PollQ;

                                 txtID.visible = false;

                                 }

                       }

           

          However, still trying to have it remove that txt box automatically for all users