Yo Bjorn, ;-) I was referring to the original post where its said:

>>this simple code dont work.
> >
> > var btest:Boolean = new Boolean();
> > btest = "true";
> > trace("btest = "+btest);


so here my suggestion was:

var btest:Boolean = true;    // without quotes

and if you want to "string" it you can probably do

trace("btest:" + btest.toString());

yo...


--- In [email protected], Bjorn Schultheiss
<[EMAIL PROTECTED]> wrote:
>
> Yo Iko, how do you strip the quotes?
>
> how about a helper
>
> static function convertStringToBoolean( val:String ):Boolean
> {
> return ( val == "true" );
> }
>
>
> Bjorn
>
> On 19/04/2007, at 10:25 AM, iko_knyphausen wrote:
>
> >
> > Just leave the quotes away:
> >
> > var btest:Boolean = true;
> >
> > --- In [email protected], "Hilary Bridel" hblists@
> > wrote:
> > >
> > > try:
> > > var btest:Boolean;
> > > var testValue:String = "true";
> > > btest = testValue == "true" ? true : false;
> > > trace("btest = "+btest);
> > >
> > > Hilary
> > >
> > > --
> > >
> > > On 4/19/07, Luis Eduardo illogic_code@ wrote:
> > > >
> > > >
> > > > hi,
> > > >
> > > > this simple code dont work.
> > > >
> > > > var btest:Boolean = new Boolean();
> > > > btest = "true";
> > > > trace("btest = "+btest);
> > > >
> > > > btest = "false";
> > > > trace("btest = : "+btest);
> > > >
> > > > there are a compile warning telling me that: "3590: String used
> > were
> > a
> > > > Boolean value was expected. The expression will be type coerced
to
> > > > Boolean"
> > > > but it is not.
> > > >
> > > > even if i do typecast it wont work:
> > > >
> > > > btest = Boolean("true");
> > > > trace("btest = : "+btest);
> > > >
> > > > or if i typecast with "as".
> > > > btest = ("true" as Boolean);
> > > > btest = ("false" as Boolean);
> > > >
> > > > so i ask: how to cast String "true" to Boolean true ?
> > > > what am i missing???
> > > >
> > > > Luís Eduardo.
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Hilary
> > >
> > > --
> > >
> >
> >
> >
>
> Regards,
>
> Bjorn Schultheiss
> Senior Developer
>
> Personalised Communication Power
>
> Level 2, 31 Coventry St.
> South Melbourne 3205,
> VIC Australia
>
> T: +61 3 9674 7400
> F: +61 3 9645 9160
> W: http://www.qdc.net.au
>
> ((------------This transmission is confidential and intended solely
> for the person or organization to whom it is addressed. It may
> contain privileged and confidential information. If you are not the
> intended recipient, you should not copy, distribute or take any
> action in reliance on it. If you believe you received this
> transmission in error, please notify the sender.---------------))
>


Reply via email to