4 Replies Latest reply on Apr 12, 2007 9:29 AM by dimival

    Custom object properties

      I want to add a property to my <mx:TextInput on my given project, that property being "errortext"


      <mx:TextInput errorText="You must fill in this field"/> etc.

      How do i go about this?

      I figure i have to extend mx.controls.textInput...how do i do this?
        • 1. Re: Custom object properties
          Like this

          import mx.controls.TextInput;

          public class ExtTextInput extends TextInput{
          private var _errorText:String;

          public function set errorText(value:String):void{
          this._errorText = value;

          public function get errorText():String{
          return this._errorText;
          • 2. Custom object properties
            ok so i've given your idea a shot but i've had no success :< sorry.

            Have i missed anything? It says the code is right but i get errors when i try to put it into my <mx:httpService tag or in <mx:script> httpService.

            This package has been put in a subdirectory of the mxml file and named extHttpService.as under the extClasses directory.

            my mx:script contains import extClasses.*;

            package extClasses
            import mx.rpc.http.mxml.HTTPService;

            public class ExtHttpService extends HTTPService{
            private var _errorString:String;

            public function set errorString(value:String):void{
            this._errorString = value;

            public function get errorString():String{
            return this._errorString;
            • 3. Re: Custom object properties
              edit; ok it seems to work fine when i extend mx.controls.label yet it fails when i extend mx.rpc.http.mxml.httpservice

              Have i imported the wrong package for extending?
              • 4. Re: Custom object properties
                dimival Level 1
                I see you are declaring the Bindable metadata on the setter method, i always put the bindable on the getter method. I am not sure if it will make any difference but you can try it out.

                The package you are importing is correct, is the one for the HTTPService mxml tag so i don't think the error is there
                1 person found this helpful