Re: [flexcoders]How would you rewrite this isset PHP condition in AS3?

2009-01-19 Thread Sam Lai
The hasOwnProperty method available in all objects does exactly this. http://livedocs.adobe.com/flex/3/langref/Object.html#hasOwnProperty() Why it is called hasOwnProperty rather than hasProperty I have no idea. 2009/1/19 dorkie dork from dorktown dorkiedorkfromdorkt...@gmail.com: late

Re: [flexcoders]How would you rewrite this isset PHP condition in AS3?

2009-01-19 Thread dorkie dork from dorktown
i use hasOwnProperty in the function i posted but i can only use it to check immediate properties. it doesn't support nested properties, for example var obj:Object = new Object(); obj.apple = new Object(); obj.apple.color = red; // hasOwnProperty doesn't support nested properties var b1:Boolean

Re: [flexcoders]How would you rewrite this isset PHP condition in AS3?

2009-01-19 Thread Sam Lai
Oh. My bad - should read the entire thread first before posting. I had a similar need, and ended up doing it in a loop like you did, mainly because from the languages I've used before, exceptions tend to be 'expensive' in terms of computation time. Not sure what the case is with AS3. 2009/1/20

[flexcoders]How would you rewrite this isset PHP condition in AS3?

2009-01-18 Thread dorkie dork from dorktown
I have a PHP statement that I am trying to write in AS3. So far it errors out because the properties do not exist on it yet. How would/should I rewrite this for AS3? Here is the statement: // at the time this is run this.language_data is an object with 2 properties // the STYLES property does not

Re: [flexcoders]How would you rewrite this isset PHP condition in AS3?

2009-01-18 Thread dorkie dork from dorktown
I don't like to know if there is an easier way to do this so I wrote this function to check if a object or the requested properties exist on the object. // call it like this isset_drilldown(this.language_data,'STYLES','BRACKETS',0); // Determine whether a variable set via a drill down through

Re: [flexcoders]How would you rewrite this isset PHP condition in AS3?

2009-01-18 Thread dorkie dork from dorktown
er sorry for the php references. i am knee deep in translating php code. :P On Sun, Jan 18, 2009 at 7:39 AM, dorkie dork from dorktown dorkiedorkfromdorkt...@gmail.com wrote: I don't like to know if there is an easier way to do this so I wrote this function to check if a object or the

Re: [flexcoders]How would you rewrite this isset PHP condition in AS3?

2009-01-18 Thread Ralf Bokelberg
doesn't try catch help here? If no error is thrown, isset returns true ralf On Sun, Jan 18, 2009 at 1:46 PM, dorkie dork from dorktown dorkiedorkfromdorkt...@gmail.com wrote: I have a PHP statement that I am trying to write in AS3. So far it errors out because the properties do not exist on it

Re: [flexcoders]How would you rewrite this isset PHP condition in AS3?

2009-01-18 Thread dorkie dork from dorktown
late night... thanks On Sun, Jan 18, 2009 at 10:05 AM, Ralf Bokelberg ralf.bokelb...@gmail.comwrote: doesn't try catch help here? If no error is thrown, isset returns true ralf On Sun, Jan 18, 2009 at 1:46 PM, dorkie dork from dorktown dorkiedorkfromdorkt...@gmail.com