Re: [flexcoders] Re: isDynamic(obj) ?

2008-05-06 Thread Josh McDonald
Ah... in-browser pseudo-code follows for anybody who finds this thread in
future :)

Will of course NPE for null obj!

function isDynamic(obj) : Boolean {
  var result : Boolean = false;
  try {
obj["probablyDoesntExist"] = "blue";
delete obj.probablyDoesntExist;
result = true;
  } catch() {}
  return result;
}

-J

On Wed, May 7, 2008 at 4:24 PM, Gordon Smith <[EMAIL PROTECTED]> wrote:

>But calling describeType() is probably much slower than the try/catch
> approach.
>
>
>
> Gordon Smith
>
> Adobe Flex SDK Team
>
>
>  --
>
> *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
> Behalf Of *Bjorn Schultheiss
> *Sent:* Tuesday, May 06, 2008 11:19 PM
> *To:* flexcoders@yahoogroups.com
> *Subject:* [flexcoders] Re: isDynamic(obj) ?
>
>
>
> flash.utils.describeType() returns XML describing the object.
> The root node has an attribute "isDynamic"..
>
> --- In flexcoders@yahoogroups.com , "Josh
> McDonald" <[EMAIL PROTECTED]> wrote:
> >
> > Guys,
> >
> > Is there some easy way to tell if an object is dynamic without
> wrapping it
> > in a try-catch and just messing with it?
> >
> > Cheers,
> > -J
> >
> > --
> > "Therefore, send not to know For whom the bell tolls. It tolls for
> thee."
> >
> > :: Josh 'G-Funk' McDonald
> > :: 0437 221 380 :: [EMAIL PROTECTED]
> >
>
>  
>



-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]


RE: [flexcoders] Re: isDynamic(obj) ?

2008-05-06 Thread Gordon Smith
But calling describeType() is probably much slower than the try/catch
approach.

 

Gordon Smith

Adobe Flex SDK Team

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Bjorn Schultheiss
Sent: Tuesday, May 06, 2008 11:19 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: isDynamic(obj) ?

 

flash.utils.describeType() returns XML describing the object.
The root node has an attribute "isDynamic"..

--- In flexcoders@yahoogroups.com 
, "Josh McDonald" <[EMAIL PROTECTED]> wrote:
>
> Guys,
> 
> Is there some easy way to tell if an object is dynamic without
wrapping it
> in a try-catch and just messing with it?
> 
> Cheers,
> -J
> 
> -- 
> "Therefore, send not to know For whom the bell tolls. It tolls for
thee."
> 
> :: Josh 'G-Funk' McDonald
> :: 0437 221 380 :: [EMAIL PROTECTED]
>