If you do parseInt(011, 10), I'm pretty sure what happens is this:

1. The octal literal 011 is compiled as the decimal Number 9.
2. It is converted at runtime to the string "9", because parseInt expects to 
parse a string.
3. parseInt parses "9" to produce 9.

Obviously, this is a waste of time. 011 already *is* 9 at compile time. It is 
just a different way of writing it, just like 0x09 is a different way of 
writing it. For example, try this:

trace(011 - 1);

The output is 8.

- Gordon


-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Abdul 
Qabiz
Sent: Tuesday, October 04, 2005 10:29 AM
To: [email protected]
Subject: RE: [flexcoders] Re: Number("011") = 9 ????

Hi,

What do you want to do?

Convert 011 to decimal 11

Or convert octal(11) to decimal(9)

parseInt(..) is a global function and first argument is an expression, so you 
can pass number also:

parseInt(011, 10) -> 9 (decimal)

You can look at Flash Player ActionScript on:

http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/js/html/wwhelp.htm?href=Part_ASLR.html


-abdul
 

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of 
Christoph Diefenthal
Sent: Tuesday, October 04, 2005 7:34 PM
To: '[email protected]'
Subject: AW: [flexcoders] Re: Number("011") = 9 ????

Ok thank you all, 

I workaround (or isn't it a workaround??) this problem by using
parseInt("011", 10) to get the decimal-system value.

How can I use the Number-class to convert the values?
Is there a 
Number.parseInt() function?

There is no such function mentioned in the "Flex ActionScript Language
Reference... can you provide me with a better API?


Cheers
Christoph



> -----Ursprüngliche Nachricht-----
> Von: [email protected] [mailto:[EMAIL PROTECTED] Im
> Auftrag von Philippe Maegerman
> Gesendet: Dienstag, 4. Oktober 2005 12:24
> An: [email protected]
> Betreff: RE: [flexcoders] Re: Number("011") = 9 ????
> 
> If they are all octal numbers, you can use
> mx.controls.Alert.show("" + Number("011").toString(8));
> 
> Philippe Maegerman
> 
> ________________________________
> 
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of jamiebadman
> Sent: mardi 4 octobre 2005 11:34
> To: [email protected]
> Subject: [flexcoders] Re: Number("011") = 9 ????
> 
> 
> It's performing an octal to decimal conversion. You can use the
> Number class to convert between various different number bases.
> 
> Jamie.
> 
> --- In [email protected], Christoph Diefenthal
> <[EMAIL PROTECTED]> wrote:
> > Does anyone know why this happens???
> >
> > Try it on your own server  :
> >
> >
> >
> >       <mx:Application
> xmlns:mx="http://www.macromedia.com/2003/mxml";>
> >         <mx:Button label="Value Of String" click="valueOfString
> ()" />
> >         <mx:Script>
> >           <![CDATA[
> >           import mx.controls.Button;
> >
> >           public function valueOfString():Void
> >           {
> >
> >             // the result is 9 ?????
> >            mx.controls.Alert.show("" + Number("011"));
> >
> >           }
> >           ]]>
> >         </mx:Script>
> >       </mx:Application>
> 
> 
> 
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
> 
> 
> 
> 
> SPONSORED LINKS
> Web site design development
> <http://groups.yahoo.com/gads?t=ms&k=Web+site+design+development&w1=Web+si
> te+design+development&w2=Computer+software+development&w3=Software+design+
> and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c
> =5&s=166&.sig=L-4QTvxB_quFDtMyhrQaHQ>         Computer software
development
> <http://groups.yahoo.com/gads?t=ms&k=Computer+software+development&w1=Web+
> site+design+development&w2=Computer+software+development&w3=Software+desig
> n+and+development&w4=Macromedia+flex&w5=Software+development+best+practice
> &c=5&s=166&.sig=lvQjSRfQDfWudJSe1lLjHw>       Software design and
development
> <http://groups.yahoo.com/gads?t=ms&k=Software+design+and+development&w1=We
> b+site+design+development&w2=Computer+software+development&w3=Software+des
> ign+and+development&w4=Macromedia+flex&w5=Software+development+best+practi
> ce&c=5&s=166&.sig=1pMBCdo3DsJbuU9AEmO1oQ>
> Macromedia flex
> <http://groups.yahoo.com/gads?t=ms&k=Macromedia+flex&w1=Web+site+design+de
> velopment&w2=Computer+software+development&w3=Software+design+and+developm
> ent&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.si
> g=OO6nPIrz7_EpZI36cYzBjw>     Software development best practice
> <http://groups.yahoo.com/gads?t=ms&k=Software+development+best+practice&w1
> =Web+site+design+development&w2=Computer+software+development&w3=Software+
> design+and+development&w4=Macromedia+flex&w5=Software+development+best+pra
> ctice&c=5&s=166&.sig=f89quyyulIDsnABLD6IXIw>
> 
> ________________________________
> 
> YAHOO! GROUPS LINKS
> 
> 
> 
> *      Visit your group "flexcoders
> <http://groups.yahoo.com/group/flexcoders> " on the web.
> 
> *      To unsubscribe from this group, send an email to:
>        [EMAIL PROTECTED] <mailto:flexcoders-
> [EMAIL PROTECTED]>
> 
> *      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
> <http://docs.yahoo.com/info/terms/> .
> 
> 
> ________________________________
> 
> ------------------------------------------------------------------
> **STATEMENT OF CONFIDENTIALITY**
> 
> This e-mail and any attached files are confidential and intended solely
> for the use of the individual to whom it is addressed. If you have
> received this email in error please send it back to the person that sent
> it to you. Any views or opinions presented are solely those of author and
> do not necessarily represent those the Emakina Company. Unauthorized
> publication, use, dissemination, forwarding, printing or copying of this
> email and its associated attachments is strictly prohibited.
> 
> We also inform you that we have checked that this message does not contain
> any virus but we decline any responsability in case of any damage caused
> by an a non detected virus.
> ------------------------------------------------------------------




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



 





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



 




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to