class com.ArrayExtension extends Array { public function ArrayExtension() { super() var argString = arguments[0].split(",");
for(var i=0; i< argString.length; i++) push(argString[i]); } } Usage: var arEx = new ArrayExtension("one,two,three"); trace(arEx.length); hth, Mike On 4/18/06, Robert Leisle <[EMAIL PROTECTED]> wrote: > You could also do: > > var myArray:ArrayExtension = new ArrayExtension(); > > myArray.push("Hello", "Goodbye", "World"); > > same result as doing them separately. > > > > [EMAIL PROTECTED] wrote: > > >Thanks, that will work. So there is no definitive way to add the values all > >at once, i.e. [1,4,5,76,3] when extending an Array? > > > >Thanks again. > > > > > > > >>Ian Thomasn wrote: > >>Hi there (whoever you are!) > >> > >>Your problem is that the [1,2,3] initialiser syntax is actually a > >>short cut for creating a new Array() object, not an ArrayExtension(). > >>So you're replacing the object you just created with new(). > >> > >>What you need to do is to _modify_ your ArrayExtension() object, not > >>replace it. > >> > >>If you try: > >> > >>var myArray:ArrayExtension = new ArrayExtension(); > >> > >>myArray.push("Hello"); > >>myArray.push("Goodbye"); > >>myArray.push("World"); > >> > >>That should sort your problem. > >> > >>HTH, > >> Ian > >> > >> > >_______________________________________________ > >Flashcoders@chattyfig.figleaf.com > >To change your subscription options or search the archive: > >http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > >Brought to you by Fig Leaf Software > >Premier Authorized Adobe Consulting and Training > >http://www.figleaf.com > >http://training.figleaf.com > > > > > > > > -- > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Bob Leisle > Headsprout Software & Engineering > http://www.headsprout.com > Where kids learn to read! > > > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > -- Mike ---------- http://www.mikebritton.com http://www.mikenkim.com _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com