If you want to have references to the elements just create an array
like:

var lyrref = new Array();
for (var i=0; i<o.items.length; i=i+2){
   lyrref[i] = o.menuItems.addChild( new DynLayer() );
   linkItem = "<a href='" + o.items[i] + "'>" + o.items[i+1] + "</a>";
   lyrref[i].setHTML(linkItem);
   lyrref[i].setVisible(true);
}
}

-- 
Robert Rainwater


On 6/25/2001, 1:45:38 PM EST, Tom wrote about "[Dynapi-Help] create layers in a for 
loop?":

> I need to create a number of layers in a for loop. This is what I've
> been trying (with many variations):

>   for (i=0; i<o.items.length; i=i+2){
>    eval("i") = new DynLayer();
>    linkItem = "<a href='" + o.items[i] + "'>" + o.items[i+1] + "</a>";
>    eval("i").setHTML(linkItem);
>    eval("i").setVisible(true);
>    o.menuItems.addChild( eval("i") );
>    o.menuItems.eval("i").setVisible(true);
>   }

> I get the error: "can't assign to a function" from the second line
> above. I just want a group of layers created on the fly depending on
> how many items are in the "items" array. I think I must be missing
> something -- is this the wrong approach?

> Thanks!
> -Tom

> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/

> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-help


_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help

Reply via email to