Re: [Flashcoders] Boolean question

2006-10-20 Thread Fumio Nonaka
Because a Boolean instance is evaluated as an object.  Boolean(object) 
should return true.


var myBool:Boolean = new Boolean(false);
var myObject:Object = new Object();
trace([myBool, Boolean(myBool), !myBool, typeof myBool]);
// Output: false,true,false,object
trace([myObject, Boolean(myObject), !myObject, typeof myObject]);
// Output: [object Object],true,false,object
_
David Buff wrote:
I think it's because q.zoomed = false create a memory space where the 
boolean value "flase" is stored, and q.zoomed is a pointer witch point 
to this memory space.
New Boolean(false) create also a memory space and a pointer, but with 
w.zoomed = new Boolean(false) , w.zoomed point to the pointer of the 
value and don't point to the value. So you can do !Boolean but not 
!Pointer(of boolean)...


w = new Object();
w.zoomed = new Boolean(false);
trace (w.zoomed);
//false
w.zoomed = !(w.zoomed);
trace (w.zoomed);
//false

test = !(w.zoomed);
trace(test);


Good luck,
--
Fumio Nonaka
mailto:[EMAIL PROTECTED]
http://www.FumioNonaka.com/
My books
Flash community

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Boolean question

2006-10-19 Thread David Buff
I think it's because q.zoomed = false create a memory space where the 
boolean value "flase" is stored, and q.zoomed is a pointer witch point to 
this memory space.
New Boolean(false) create also a memory space and a pointer, but with 
w.zoomed = new Boolean(false) , w.zoomed point to the pointer of the value 
and don't point to the value. So you can do !Boolean but not !Pointer(of 
boolean)...


w = new Object();
w.zoomed = new Boolean(false);
trace (w.zoomed);
//false
w.zoomed = !(w.zoomed);
trace (w.zoomed);
//false

test = !(w.zoomed);
trace(test);

test is a pointer to a bollean value but w.zoomed is a pointer to a pointer 
of a boolean value... I guess...


David Buff


- Original Message - 
From: "slangeberg" <[EMAIL PROTECTED]>

To: "Flashcoders mailing list" 
Sent: Thursday, October 19, 2006 4:32 PM
Subject: Re: [Flashcoders] Boolean question


Correct me if I'm wrong but I believe the Boolean type is still a 
primitive

and should not be instantiated with 'new'.

You could perform casting like this:

w = new Object();
w.zoomed = Boolean( false );

But I don't know what benefit it would give, as Flash doesn't support 
typing

on the parameters of an Object instance.

Scott

On 10/19/06, Mendelsohn, Michael <[EMAIL PROTECTED]> wrote:


Hi list...

Why does an object's parameter not change if it's instanced as a new
Boolean()?

w = new Object();
w.zoomed = new Boolean(false);
trace (w.zoomed);
//false
w.zoomed = !(w.zoomed);
trace (w.zoomed);
//false

q = new Object();
q.zoomed = false;
trace (q.zoomed);
//false
q.zoomed = !(q.zoomed);
trace (q.zoomed);
//true

Thanks,
- Michael M.

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com





--

: : ) Scott
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Boolean question

2006-10-19 Thread slangeberg

Correct me if I'm wrong but I believe the Boolean type is still a primitive
and should not be instantiated with 'new'.

You could perform casting like this:

w = new Object();
w.zoomed = Boolean( false );

But I don't know what benefit it would give, as Flash doesn't support typing
on the parameters of an Object instance.

Scott

On 10/19/06, Mendelsohn, Michael <[EMAIL PROTECTED]> wrote:


Hi list...

Why does an object's parameter not change if it's instanced as a new
Boolean()?

w = new Object();
w.zoomed = new Boolean(false);
trace (w.zoomed);
//false
w.zoomed = !(w.zoomed);
trace (w.zoomed);
//false

q = new Object();
q.zoomed = false;
trace (q.zoomed);
//false
q.zoomed = !(q.zoomed);
trace (q.zoomed);
//true

Thanks,
- Michael M.

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com





--

: : ) Scott
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] Boolean question

2006-10-19 Thread Mendelsohn, Michael
Hi list...

Why does an object's parameter not change if it's instanced as a new
Boolean()?

w = new Object();
w.zoomed = new Boolean(false);
trace (w.zoomed);
//false
w.zoomed = !(w.zoomed);
trace (w.zoomed);
//false

q = new Object();
q.zoomed = false;
trace (q.zoomed);
//false
q.zoomed = !(q.zoomed);
trace (q.zoomed);
//true

Thanks,
- Michael M.

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com