[flexcoders] Re: Accessing a Basic Auth protected site from flex.

2008-11-15 Thread wdsnapper
Thank you.  This explains a lot.  I had seen posts on how to do this but 
nowhere did I 
stumble on the info you provided.  Specifically, that 9.0.115.0 was a version 
that blocks 
the Authorization header regardless of what you do.  Guess what version I've 
been 
running?  So, I will update to a more recent version and give this a try.

Unfortunately while this will work for some basic auth protected systems I have 
to figure 
out what to do about network devices I'm connecting to that can't have any 
crossdomain 
file added to them.  For those I may just end up setting up a proxy using 
something like 
mod_proxy.

I will post the results after I try this out.

-Bill


--- In flexcoders@yahoogroups.com, nathanpdaniel [EMAIL PROTECTED] wrote:

 Add the request headers (as in the code), where userService is an 
 HTTPService, baseUrl is the page you need to be authorized to use, 
 and auth is the username:password (I'm assuming - I got this example 
 from here:
 http://geekzguru.wordpress.com/2008/07/04/howto-add-basic-
 authentication-header-to-httpservice/
 
 Also check the Adobe TechNote here:
 http://kb.adobe.com/selfservice/viewContent.do?
 externalId=kb403184sliceId=2
 
 
 mx:Script
 ![CDATA[
 import mx.utils.Base64Encoder;
 import mx.controls.Alert;
 
 private var baseUrl:String 
 = http://phprestsql.sourceforge.net/tutorial/user;;
 private var auth:String = p126371rw:demo;
 
 private function init():void{
 var encoder : Base64Encoder = new Base64Encoder();
 encoder.encode(auth);
 userService.headers[Authorization] = Basic  + 
 encoder.toString();
 deleteUser();
 }
 ]]
 /mx:Script
 
 
 Please not - I googled for this and found everything above - I've 
 never tried it - so I have no clue if it actually works... :D
 
 
 
 --- In flexcoders@yahoogroups.com, wdsnapper wdsnapper@ wrote:
 
  Anyone out there understand how to get Flex working with a simple 
 Basic Auth protected 
  REST API?  If not is there a fundamental reason why this does not 
 work in Flex?  It seems 
  like such a core basic (no pun intended) piece of functionality for 
 a Flex app to hook up to 
  an existing XML based service to provide a new view.
  
  
  --- In flexcoders@yahoogroups.com, wdsnapper wdsnapper@ wrote:
  
   I'm trying to access a basic auth protected site from Flex and 
 not having any success.  I 
  see 
   that you can no longer add the Authorization header as you 
 could over a year ago.
   
   The setCredentials and setRemoteCredentials methods in the 
 HTTPService class seem 
  like 
   they should do the trick but I've had no luck with them.
   
   Does someone out there have a pointer to a functional example 
 showing how to use 
  Basic 
   Auth from Flex?  I've seen a lot of posts in this forum but have 
 been unable to find a 
  solution.
   
   Thanks in advance.
  
 






[flexcoders] Accessing a Basic Auth protected site from flex.

2008-11-14 Thread wdsnapper
I'm trying to access a basic auth protected site from Flex and not having any 
success.  I see 
that you can no longer add the Authorization header as you could over a year 
ago.

The setCredentials and setRemoteCredentials methods in the HTTPService class 
seem like 
they should do the trick but I've had no luck with them.

Does someone out there have a pointer to a functional example showing how to 
use Basic 
Auth from Flex?  I've seen a lot of posts in this forum but have been unable to 
find a solution.

Thanks in advance.



[flexcoders] Re: Accessing a Basic Auth protected site from flex.

2008-11-14 Thread wdsnapper
Anyone out there understand how to get Flex working with a simple Basic Auth 
protected 
REST API?  If not is there a fundamental reason why this does not work in Flex? 
 It seems 
like such a core basic (no pun intended) piece of functionality for a Flex app 
to hook up to 
an existing XML based service to provide a new view.


--- In flexcoders@yahoogroups.com, wdsnapper [EMAIL PROTECTED] wrote:

 I'm trying to access a basic auth protected site from Flex and not having any 
 success.  I 
see 
 that you can no longer add the Authorization header as you could over a 
 year ago.
 
 The setCredentials and setRemoteCredentials methods in the HTTPService class 
 seem 
like 
 they should do the trick but I've had no luck with them.
 
 Does someone out there have a pointer to a functional example showing how to 
 use 
Basic 
 Auth from Flex?  I've seen a lot of posts in this forum but have been unable 
 to find a 
solution.
 
 Thanks in advance.






[flexcoders] mx:Image loading swf from URL not working consistently on OS X.

2007-12-27 Thread wdsnapper
Hello,

I have an application that runs on every Windows based browser I've
tested so far and even on Mac OS X up to version 9.0.47 of the flash
player plugin.  Recently a security update to 9.0.115 on Mac has
caused an app to break.  I broke it down to a simple test case.

mx:Application . . .
  mx:Canvas . . .
mx:Image source=swfUrl /
  /mx:Canvas . . .
/mx:Application . . .

The first time the main app loads the SWF loaded by the mx:Image tag
does the right thing.  The swf is pulled from the web, it runs and
works as desired.  Subsequent refresh of the web page will not show
the swf.  The SWF being loaded by the mx:Image tag is only a simple
short flash movie.  The main application does in fact run but this
loading swf doesn't show on subsequent loads of the page on OS X.

I have a timer in the main application that governs the time the Image
SWF is shown and then runs the main logic.  The main logic always runs
and works fine.

Have any of you seen any behavior like this?

One more note is that the source for the Image can be a SWF that is
embedded in the main application.  This ALWAYS works fine when
specified.  The only issue is loading the SWF over http and only after
the first load following a cache clear (Safari and Firefox on Max OS X
show the same behavior).  The external swf is specified with a url
parameter passed into the main app.  If this parameter is not present
the app loads the embedded swf for the splash.

I run the app on Windows on IE, FF, and Safari and no problem.

Any hints?

Thanks in advance.




[flexcoders] Re: mx:Image loading swf from URL not working consistently on OS X.

2007-12-27 Thread wdsnapper
I found a solution.  This seemed to be caused by either the browser or
flash player caching the movie being loaded.  Why it wouldn't just run
is beyond me.

The solution I put in place is to append a query string with the date
to the movie being loaded into the Image.  This worked.  Why did this
pop up with the current release of the flash player?  No idea.


--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 Strip out your logic so it really is just an Image in an App and see if
 it does load.  It might just take longer after a cache clear
 
  
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of wdsnapper
 Sent: Thursday, December 27, 2007 10:11 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] mx:Image loading swf from URL not working
 consistently on OS X.
 
  
 
 Hello,
 
 I have an application that runs on every Windows based browser I've
 tested so far and even on Mac OS X up to version 9.0.47 of the flash
 player plugin. Recently a security update to 9.0.115 on Mac has
 caused an app to break. I broke it down to a simple test case.
 
 mx:Application . . .
 mx:Canvas . . .
 mx:Image source=swfUrl /
 /mx:Canvas . . .
 /mx:Application . . .
 
 The first time the main app loads the SWF loaded by the mx:Image tag
 does the right thing. The swf is pulled from the web, it runs and
 works as desired. Subsequent refresh of the web page will not show
 the swf. The SWF being loaded by the mx:Image tag is only a simple
 short flash movie. The main application does in fact run but this
 loading swf doesn't show on subsequent loads of the page on OS X.
 
 I have a timer in the main application that governs the time the Image
 SWF is shown and then runs the main logic. The main logic always runs
 and works fine.
 
 Have any of you seen any behavior like this?
 
 One more note is that the source for the Image can be a SWF that is
 embedded in the main application. This ALWAYS works fine when
 specified. The only issue is loading the SWF over http and only after
 the first load following a cache clear (Safari and Firefox on Max OS X
 show the same behavior). The external swf is specified with a url
 parameter passed into the main app. If this parameter is not present
 the app loads the embedded swf for the splash.
 
 I run the app on Windows on IE, FF, and Safari and no problem.
 
 Any hints?
 
 Thanks in advance.





[flexcoders] Can I lookup a div in the html page and hide it from within my Flex app?

2007-04-27 Thread wdsnapper
Hello,

Can someone tell me if it is possible to lookup DOM elements within
the web page hosting a flex application?  If so, can I manipulate the
DOM element from within my application without relying on javascript
to do it?

The page I am placing my swf on does not allow you to add javascript.
 I want to show an item beneath my Flex app on pages that disallow
scripting and restrict networking to internal.  I want to hide the
element on pages that have allowNetworking set to all.

Can this be done and if so how?

Thanks in advance.



[flexcoders] Re: Correct way to determine MP3 length in ms and determine when sound starts pl

2007-04-16 Thread wdsnapper
Can anyone out there help out with this issue of determining
accurately the length of an MP3 file being played?


--- In flexcoders@yahoogroups.com, wdsnapper [EMAIL PROTECTED] wrote:

 Hello,
 
 The flash.media.Sound class has a length property that says it
 contains the length of the current sound in milliseconds.
 
 1) Is this the best, most accurate way to determine a sound length?
 2) If so, do i need to wait for a certain amount of the track to be
 loaded and playing before accessing it and getting a correct value?
 3) Is there an event to monitor that will tell me when a sound begins
 to play?  If so, what is the event?
 
 Thanks.





[flexcoders] Correct way to determine MP3 length in ms and determine when sound starts playi?

2007-04-14 Thread wdsnapper
Hello,

The flash.media.Sound class has a length property that says it
contains the length of the current sound in milliseconds.

1) Is this the best, most accurate way to determine a sound length?
2) If so, do i need to wait for a certain amount of the track to be
loaded and playing before accessing it and getting a correct value?
3) Is there an event to monitor that will tell me when a sound begins
to play?  If so, what is the event?

Thanks.




[flexcoders] Determining the max width of text in DataGridColumn?

2007-04-10 Thread wdsnapper
Hello,

Can someone tell me if there is a way to determine the maximum width
(in characters) that a DataGridColumn can fit based on a fixed width
layout?

I want to detect overrun and truncate the string, append ..., and have
the tooltip contain the full text.  I have not been able to figure out
how to correctly determine what the maximum string length a column can
fit.

Thanks in advance.




[flexcoders] Correct way to load Flex SWF IF correct player version?

2007-03-27 Thread wdsnapper
Hello,

I am about ready to deploy a Flex application that users can add to
web pages of their choice using an embed (or object) tag.  I want to
make sure that the client player version can play the Flex
application.  The following model is what I would like to use and I
want to know if this is a model that would be advocated as a correct
solution to this problem.

1) Client browser requests version check SWF.  Parameters are passed
to this SWF.
2) The SWF loads into the client's player and checks the version.  
3) If the version is correct the SWF would load the Flex application
into the player.
4) If the version is less than the required version I want to give the
client the option to upgrade to the correct Flash player version.

Is this an approach that can be made to work reliably assuming a base
flash player version of 6 or is assumed?

Thanks inadvance.




[flexcoders] Re: Correct way to load Flex SWF IF correct player version?

2007-03-27 Thread wdsnapper
The embed and object tags are the most common methods I've seen for
applications like the one I'm building which is one of the main
reasons I want to use that approach.  I intentionally built the
application to require one and only one parameter.  Any additional
parameters are loaded in via XML along with other dynamic content.

That said, is it possible to use a SWF built for a reasonably recent
version of the flash player (let's say 6 or 7 and up) to:
a) detect the correct version and load the intended Flex application.
b) detect that the player needs to be upgraded to 9+ and prompt the
user to update.

Thank you.

--- In flexcoders@yahoogroups.com, Tom Chiverton [EMAIL PROTECTED]
wrote:

 On Tuesday 27 Mar 2007, wdsnapper wrote:
  Is this an approach that can be made to work reliably assuming a base
  flash player version of 6 or is assumed?
 
 Why not provide a JavaScript file on your site that can be included 
 (javascript src=http://...;) that does the check and
document.write()'s 
 the required HTML ?
 This also means if you ever need to add additional parameters you
don't need 
 to get everyone to update all their tags.
 
 Also, last time I checked, object/embed tags weren't the best way to
embed 
 SWFs - you should use a JavaScript based method because of the Eolas 
 nonsense.
 
 -- 
 Tom Chiverton
 Helping to enthusiastically compete proactive materials
 on: http://thefalken.livejournal.com
 
 
 
 This email is sent for and on behalf of Halliwells LLP.
 
 Halliwells LLP is a limited liability partnership registered in
England and Wales under registered number OC307980 whose registered
office address is at St James's Court Brown Street Manchester M2 2JF.
 A list of members is available for inspection at the registered
office. Any reference to a partner in relation to Halliwells LLP means
a member of Halliwells LLP. Regulated by the Law Society.
 
 CONFIDENTIALITY
 
 This email is intended only for the use of the addressee named above
and may be confidential or legally privileged.  If you are not the
addressee you must not read it and must not use any information
contained in nor copy it nor inform any person other than Halliwells
LLP or the addressee of its existence or contents.  If you have
received this email in error please delete it and notify Halliwells
LLP IT Department on 0870 365 8008.
 
 For more information about Halliwells LLP visit www.halliwells.com.





[flexcoders] Re: Correct way to load Flex SWF IF correct player version?

2007-03-27 Thread wdsnapper
FYI, Javascript is a non-starter for us.  Sites like myspace block
script tags so the best tool we have would be an embed or object tag
and have a swf that can do what we need.

Have any of you deployed a Flex application that can be embedded in
other web pages that you do not own that do not allow anything but
embed or object tags (i.e. myspace for example)?

Believe me, I wish this were baked into the Flash player from day one
where there was a way to specify a minimum version number and the
player did the rest and prompted for the user to update.

Thanks again.



--- In flexcoders@yahoogroups.com, Tom Chiverton [EMAIL PROTECTED]
wrote:

 On Tuesday 27 Mar 2007, wdsnapper wrote:
  b) detect that the player needs to be upgraded to 9+ and prompt the
  user to update.
 
 I think you need 8 or 9 to do that.
 
 -- 
 Tom Chiverton
 Helping to simultaneously negotiate wireless convergence
 on: http://thefalken.livejournal.com
 
 
 
 This email is sent for and on behalf of Halliwells LLP.
 
 Halliwells LLP is a limited liability partnership registered in
England and Wales under registered number OC307980 whose registered
office address is at St James's Court Brown Street Manchester M2 2JF.
 A list of members is available for inspection at the registered
office. Any reference to a partner in relation to Halliwells LLP means
a member of Halliwells LLP. Regulated by the Law Society.
 
 CONFIDENTIALITY
 
 This email is intended only for the use of the addressee named above
and may be confidential or legally privileged.  If you are not the
addressee you must not read it and must not use any information
contained in nor copy it nor inform any person other than Halliwells
LLP or the addressee of its existence or contents.  If you have
received this email in error please delete it and notify Halliwells
LLP IT Department on 0870 365 8008.
 
 For more information about Halliwells LLP visit www.halliwells.com.





[flexcoders] Re: What is the correct way to detect activation of a Canvas in a ViewStack?

2007-03-26 Thread wdsnapper
Thanks Tim.  I initially tried using the show event on the
component's canvas but it never got invoked.  Then I realized that I
had a canvas in the view stack that included my component:

mx:ViewStack
  mx:Canvas id=myComponent1
view:MyComponent/
  /mx:Canvas
  mx:Canvas id=myComponent2
view:MyComponent/
  /mx:Canvas
  mx:Canvas id=myComponent3
view:MyComponent/
  /mx:Canvas
  mx:Canvas id=myComponent4
view:MyComponent/
  /mx:Canvas
/mx:ViewStack


view:MyComponent
  mx:Script
![CDATA[
  private function myShowMethod1():void {
  }
  private function myShowMethod2():void {
  }
]]
/mx:Script

  mx:ViewStack
mx:Canvas id=myCanvas2 show=myShowMethod1()
  view:MyView1/
/mx:Canvas

mx:Canvas id=myCanvas2 show=myShowMethod2()
  view:MyView2/
/mx:Canvas
  /mx:ViewStack
/view:MyComponent

I was expecting the myShowMethod1() and myShowMethod2() to be invoked
when the view:MyComponent was brought into view and this was not the case.

I ended up hooking the show event in myComponent1 and had this
invoke a method in view:MyComponent and this worked.

Is there a way to make sure the show gets invoked on my component?

The problem is solved for now though just does not feel like the right
way.

Thanks.


--- In flexcoders@yahoogroups.com, Tim Walling [EMAIL PROTECTED] wrote:

 You could try setting up a show event listener to trigger your
 initialization code. Something like this:
 
 mx:ViewStack
 mx:Canvas show=handleShowEvent()/
 /mx:ViewStack
 
 
 Whenever the ViewStack makes the canvas the visible/active one, the show
 event would fire.
 
 or if your Canvas is an mxml component, it could handle the show event
 internally:
 
 mx:ViewStack
 view:MyCanvas/
 /mx:ViewStack
 
 MyCanvas.mxml
 mx:Canvas show=handleShowEvent()
 mx:Script
 private function handleShowEvent(event:FlexEvent):void
 {
 // call initialize code
 }
 /mx:Script
 /mx:Canvas
 
 Then each of your components in the ViewStack would manage their
respective
 show events.
 
 
 Tim
 
 
 On 23 Mar 2007 17:02:56 -0700, wdsnapper [EMAIL PROTECTED] wrote:
 
I am using a ViewStack to contain a set of Canvas'. I switch between
  items in the stack by clicking on buttons. I want to be able to
  detect when a Canvas gains focus and run a method to initialize
  content on that Canvas.
 
  What is the correct event to monitor to achieve this behavior?
 
  Thanks in advance.
 
   
 
 
 
 
 -- 
 Tim
 timwalling.com





[flexcoders] Re: What is the correct way to detect activation of a Canvas in a ViewStack?

2007-03-26 Thread wdsnapper
It does need to be run each time this Canvas gains focus.  The short
explanation is, one canvas has merchandise items available for sale. 
An item is marked as in cart when it is added do prevent a user from
adding an item multiple times that is only allowed to be in the cart
once.  The cart lives on another Canvas in the stack.  A user could
choose to remove an item from the cart and then select that
merchandise Canvas again and the button needs to be reactivated and
have its label and style changed.

Therefore the only way I knew to make this happen within the Flex
model is to use a show event that triggered and caused the Canvas to
update itself.


--- In flexcoders@yahoogroups.com, Tim Walling [EMAIL PROTECTED] wrote:

 If you need to run this code each time your view gains focus as
you put
 it, then I think using the show event is fine because that should be
 triggered each time the viewstack sets a new child to be visible. If
this
 code really only needs to run once, why don't you have your
component just
 listen to its own creationComplete or initialize event?
 
 view:MyComponent initialize=handleInit()
 mx:Script
 private function handleInit():void
 {
 
 }
 /mx:Script
 /view:MyComponent
 
 
 
 
 
 On 3/26/07, wdsnapper [EMAIL PROTECTED] wrote:
 
Thanks Tim. I initially tried using the show event on the
  component's canvas but it never got invoked. Then I realized that I
  had a canvas in the view stack that included my component:
 
  mx:ViewStack
  mx:Canvas id=myComponent1
  view:MyComponent/
  /mx:Canvas
  mx:Canvas id=myComponent2
  view:MyComponent/
  /mx:Canvas
  mx:Canvas id=myComponent3
  view:MyComponent/
  /mx:Canvas
  mx:Canvas id=myComponent4
  view:MyComponent/
  /mx:Canvas
  /mx:ViewStack
 
  view:MyComponent
  mx:Script
  ![CDATA[
  private function myShowMethod1():void {
  }
  private function myShowMethod2():void {
  }
  ]]
  /mx:Script
 
  mx:ViewStack
  mx:Canvas id=myCanvas2 show=myShowMethod1()
  view:MyView1/
  /mx:Canvas
 
  mx:Canvas id=myCanvas2 show=myShowMethod2()
  view:MyView2/
  /mx:Canvas
  /mx:ViewStack
  /view:MyComponent
 
  I was expecting the myShowMethod1() and myShowMethod2() to be invoked
  when the view:MyComponent was brought into view and this was not
the case.
 
  I ended up hooking the show event in myComponent1 and had this
  invoke a method in view:MyComponent and this worked.
 
  Is there a way to make sure the show gets invoked on my component?
 
  The problem is solved for now though just does not feel like the right
  way.
 
  Thanks.
 
  --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Tim
  Walling tim.walling@ wrote:
  
   You could try setting up a show event listener to trigger your
   initialization code. Something like this:
  
   mx:ViewStack
   mx:Canvas show=handleShowEvent()/
   /mx:ViewStack
  
  
   Whenever the ViewStack makes the canvas the visible/active one,
the show
   event would fire.
  
   or if your Canvas is an mxml component, it could handle the show
event
   internally:
  
   mx:ViewStack
   view:MyCanvas/
   /mx:ViewStack
  
   MyCanvas.mxml
   mx:Canvas show=handleShowEvent()
   mx:Script
   private function handleShowEvent(event:FlexEvent):void
   {
   // call initialize code
   }
   /mx:Script
   /mx:Canvas
  
   Then each of your components in the ViewStack would manage their
  respective
   show events.
  
  
   Tim
  
  
   On 23 Mar 2007 17:02:56 -0700, wdsnapper bill@ wrote:
   
I am using a ViewStack to contain a set of Canvas'. I switch
between
items in the stack by clicking on buttons. I want to be able to
detect when a Canvas gains focus and run a method to initialize
content on that Canvas.
   
What is the correct event to monitor to achieve this behavior?
   
Thanks in advance.
   
   
   
  
  
  
   --
   Tim
   timwalling.com
  
 
   
 
 
 
 
 -- 
 Tim
 timwalling.com





[flexcoders] What is the correct way to detect activation of a Canvas in a ViewStack?

2007-03-23 Thread wdsnapper
I am using a ViewStack to contain a set of Canvas'.  I switch between
items in the stack by clicking on buttons.  I want to be able to
detect when a Canvas gains focus and run a method to initialize
content on that Canvas.

What is the correct event to monitor to achieve this behavior?

Thanks in advance.



[flexcoders] DataGrid, itemRenderer, button with custom image resizing

2007-03-22 Thread wdsnapper
Hello,

I have a datagrid I use to represent a shopping cart.  One of the
columns will contain a button used for deleting an item from the cart.
 The button is skinned with a custom graphic.  I have been able to get
the button into the column.  I did this by subclassing Button in
ActionScript, assigning a style to it representing the up, down, and
over skin, and am able to process clicks and perform the required
functionality.

The problem I have is that the icon stretches to fill the column.  I
want the icon for the button to remain fixed size and not stretch.  I
have tried everything I can think of and am clearly missing something.

Does this sound like the correct implementation approach?  If so, can
someone give me a pointer for how to solve this issue?  If not, can
someone suggest a better implementation for the item renderer to
achieve the same functionality.

Thanks in advance.






[flexcoders] Re: DataGrid, itemRenderer, button with custom image resizing

2007-03-22 Thread wdsnapper
Thank you.  This solved my problem.  Specifically, I changed my remove
button renderer class from extending Button to a class that extended
Canvas and then create the button in there and add the Button as a
child as you suggested.  Very simple and works perfectly.



--- In flexcoders@yahoogroups.com, maury.sword [EMAIL PROTECTED] wrote:

 Is your button class the itemRenderer ?  Have you tried creating an 
 itemRenderer that extends a container and includes your button as a 
 child ?  I think I have seen checkBox itemRenderers implemented in 
 this manner.
 
 
 --- In flexcoders@yahoogroups.com, wdsnapper bill@ wrote:
 
  Hello,
  
  I have a datagrid I use to represent a shopping cart.  One of the
  columns will contain a button used for deleting an item from the 
 cart.
   The button is skinned with a custom graphic.  I have been able to 
 get
  the button into the column.  I did this by subclassing Button in
  ActionScript, assigning a style to it representing the up, down, and
  over skin, and am able to process clicks and perform the required
  functionality.
  
  The problem I have is that the icon stretches to fill the column.  I
  want the icon for the button to remain fixed size and not stretch.  
 I
  have tried everything I can think of and am clearly missing 
 something.
  
  Does this sound like the correct implementation approach?  If so, 
 can
  someone give me a pointer for how to solve this issue?  If not, can
  someone suggest a better implementation for the item renderer to
  achieve the same functionality.
  
  Thanks in advance.
 





[flexcoders] Flex Number addition math bug?

2007-03-22 Thread wdsnapper
I have an application that is showing me stange results from basic
addition.  In short, I have a cart full of items that are all $0.99. 
Each price is in a Number property of an object.  The math is simple.
 It is generating very odd results.  If I start with:

var total:Number = 0;
var price:Number = 0.99;

then do:

total += price;
total += price;
total += price;

You would expect total to be equal to 2.97.  I get 2.9699...
The next time I add price I get 3.96.

The following simple application illustrates the problem.  Try it.  Do
you see the same results?  Am I doing something wrong or is there a
math bug?  I can work around this but would REALLY like to understand
the root cause.


?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
layout=absolute initialize=initIt()
  mx:Script
![CDATA[
  private var theNumber:Number = 0;
  private var incrementAmount = 0.99;
  
  private function initIt() {
this.numberLbl.text = String(theNumber);
  }
  private function incrementIt():void {
theNumber += incrementAmount;
this.numberLbl.text = String(theNumber);
  }
]]
  /mx:Script
  mx:Panel x=121 y=113 width=250 height=200 layout=absolute
mx:Button x=125 y=44 label=Increment click=incrementIt()/
mx:Label id=numberLbl x=43 y=44 text=Label fontSize=12/
  /mx:Panel
  
/mx:Application