Also, look into __resolve. The Flash docs have excellent examples.
Jim Kremens On 8/11/06, Jeroen Beckers <[EMAIL PROTECTED]> wrote:
Just to be complete: Yes, it is possible! Example: var myFoo = new Foo(); myFoo["test"+5] = function() { trace("hello world!"); } myFoo.test5(); //Foo.as dynamic class Foo { } And to your second question: Delegate returns a function. Setting the onRelease to 'Delegate.create()' is nothing more than setting the onRelease to an ordinary function like this: btn.onRelease = function() { trace("Hello World"); } the only thing Delegate do, is modifie the scope of the function. So, yes, you CAN overwrite 'delegate instances'. Ps: "Delegate instances" isn't even the right term since you don't create an instance of the Delegate class. The 'create' method is a static method that just takes some arguments and returns a function. Got it ? :) Bbt Lists wrote: > Hi there.... > > Can you write dynamic methods in a class? > > > for example > > for (var i:Number = 0; i < 11; i++) > { > function onBtnPress + i() > { > trace("Button number: " + i + "was pressed"); > } > } > > So then that would essentially create 10 methods (onBtnPress0 to > onBtnPress9) to be used by various onPress events. > > Is this possible? Then at the same time you could write the delegate > and create the buttons and so one as well. > > Then continuing on my thought - could you then over-write the > onBtnPress functions with new values (say for example the trace would be: > > trace("Button number: " + i + "was pressed with the currValue of " + > externalVariable); > > instead of the original: > > trace("Button number: " + i + "was pressed"); > > > I am a hobby AS coder, and I am probably way off here. All I am trying > to do is build a thumbnail nav for a gallery. > > Thanks in advance! > _______________________________________________ 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
-- Jim Kremens _______________________________________________ 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