PAGE2GO2 HOME | INTERNET NEWS

LeighExchange - Free Advertising Network Stock Research at Internet Speed

Re: Inner object problem property undefined error

 List
Subject: Re: Inner object problem property undefined error
Poster: RobG
Date: 23 Mar 2007 07:24:39 -0700
Related Postings: 1 2 3
On Mar 22, 8:42 pm, "00steve" wrote:
> Hi, I am attempting to create a script in which object A contains an
> array of "objectb" objects. An overview of the code is posted below.
> When I attempt to access "myObjArr" array like this:
>
> alert(test1.myObjArr[0].a);
>
> I get the error "myObjArr is undefined". I was wondering if anyone
> could help.
> Thanks.
>
> test1 = new objectA(x,y);
> test1.addObj(a,b,c);
>
> alert(test1.myObjArr[0].a); //generates error
>
> function objectA(x,y) {
>
> this.addObj = addObj;
> this.myObjArr = new Array();
>
> function objectB(a,b,c) {
> this.a =a;
> }
>
> function addObj() {
> myObjArr[myObjArr.length] = new objectB(a,b,c);
>
> }
> }

That looks a bit confused. Try:

-- Rob

 

Page2Go2.com is not responsible for content of this message.