2 Replies Latest reply on Dec 30, 2009 6:55 AM by Exhomy

    string to event?

    Exhomy

      // bla bla bla

       

      <mx:TextInput      id="something"      text="my message"       enter="doSomething(event);"   />

       

      // bla bla bla

       

      private function doSomething(event:Event):void {

      //     bla bla bla

      }

       

       

      its working but I allready know what i will send,  so want to do it without text area. I don't know, how can I send a string data as a event. My function is working only with event .

       

      // bla bla bla

       

      var message:Event = new Event;

      var mydata:String = "my message";

      // ??

      doSomething(message):

       

      private function doSomething(event:Event):void {

      //     bla bla bla

      }

        • 1. Re: string to event?
          ShardulSingh Level 3

          Hi,

           

          Pls find the solution for your problem.............

          Let me know if u have any issue with this.............

           

          MainApplication.mxml

          <?xml versi

          <?xml version="1.0" encoding="utf-8"?>

          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

          <mx:Script>

                      <![CDATA[

                            import mx.controls.Alert;

                            private var yourStr : String = "This is your message";

                            private function doSomething(str:String):void

                            {

                                  Alert.show(str.toString() + "..........as u required.");

                            }

                      ]]>

          </mx:Script>

                      <mx:TextInput  id="something" text="my message" enter="doSomething(yourStr)"/>

          </mx:Application>

           

           

           

           

           

           

          with Regards,

           

          Shardul Singh Bartwal

           

          • 2. Re: string to event?
            Exhomy Level 1

            I'm realy sory, i tryed to do it until 3 days, but i got finaly found my mistake now, i just miss 1 line at end of script, thanx for everything.