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 dorkie dork from dorktown <dorkiedorkfromdorkt...@gmail.com>:
> 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 = obj.hasOwnProperty("apple.color"); // returns false
> var b2:Boolean = obj.hasOwnProperty("banana.color"); // returns false
> var b3:* = typeof(obj.apple.color); // returns string
> var b4:* = typeof(obj.banana.color); // Error #1010: A term is undefined and
> has no properties.
>
>
>
> On Mon, Jan 19, 2009 at 10:20 AM, Sam Lai <samuel....@gmail.com> wrote:
>>
>> 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 night... thanks
>> >
>> > On Sun, Jan 18, 2009 at 10:05 AM, Ralf Bokelberg
>> > <ralf.bokelb...@gmail.com>
>> > wrote:
>> >>
>> >> 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 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 exist yet and it generates a
>> >> > // TypeError: Error #1010: A term is undefined and has no properties.
>> >> > if (isset(this.language_data['STYLES']['BRACKETS'][0])) {
>> >> >
>> >> > ddfd
>> >> >
>> >> >
>> >
>> >
>
> 

Reply via email to