Thanks! I added this line to the init() method

myFormatter=new mx.formatters.CurrencyFormatter();

and that did the trick.

-Matt

 

 

-----Original Message-----
From: Waldo Smeets [mailto:[EMAIL PROTECTED]
Sent: Monday, March 29, 2004 7:41 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] CurrencyFormatter in ActionScript

 

Hi Matt,

 

it looks like you are missing something like myFormatter = new mx.formatters.CurrencyFormatter();

 

Best,

 

  Waldo Smeets
  Sales Engineer Macromedia Benelux
  Blog: www.macromedia.com/go/blog_benelux
___________________________
This e-mail is intended solely for the named recipient.  The information contained in this message is confidential.  If you are not the named recipient, you are hereby notified that any use, dissemination, or reproduction is prohibited and may be unlawful.  If you are not the named recipient of this e-mail, please notify the sender by return e-mail and delete all copies of it from your computer.

 

 


From: Matt Boles [mailto:[EMAIL PROTECTED]
Sent: 29 March 2004 13:57
To: 'flexcoders@yahoogroups.com'
Subject: [flexcoders] CurrencyFormatter in ActionScript

I am using a CurrencyFormatter class in an ActionScript controller.  It works fine if I first declare the object as an Object, then as a CurrencyFormatter:

class P4_6Controllerb

{

            // properties

            public var exampleView:Object;

            private var myFormatter:Object;

           

            // constructor

            public function P4_6Controllerb()

            {

                        init();

            }

           

            // methods

            private function init():Void

 

            {

                        myFormatter=new mx.formatters.CurrencyFormatter();

                        myFormatter.precision=2;

                        myFormatter.currencySymbol="$";

                        myFormatter.alignSymbol="left";

            }

           

            public function fillLabel():Void

            {

                        exampleView.testLabel.text = myFormatter.format(exampleView.testLabel.text);

            }

}

 

But, if I try to declare the object as a CurrencyFormatter the controller compiles fine, but no longer works. The text in the Label just disappears when the format method is used:

class P4_6Controllerb

{

            // properties

            public var exampleView:Object;

            private var myFormatter:mx.formatters.CurrencyFormatter;

           

            // constructor

            public function P4_6Controllerb()

            {

                        init();

            }

           

            // methods

            private function init():Void

 

            {

                        myFormatter.precision=2;

                        myFormatter.currencySymbol="$";

                        myFormatter.alignSymbol="left";

            }

           

            public function fillLabel():Void

            {

                        exampleView.testLabel.text = myFormatter.format(exampleView.testLabel.text);

            }

}

 

Any hints??

 

Thanks-

Matt

 

 

Matthew S. Boles
Principal Instructor
Macromedia
[EMAIL PROTECTED]

 



Reply via email to