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 ? :)
Thanks for the pointers!
One thing I need to clarify...
I want to write the methods INSIDE the class. Would that work?
For example:
class TheMenu {
function TheMenu() {
}
function buildMenu() {
for (var i:Number = 0; i < 10; i++) {
this._targetMc.createObject("menuMc", "menuMc" + i,
this._targetMc[this._currCat].getNextHighestDepth());
this._targetMc["menuMc" + i].menuBtn.onPress = Delegate.create(this,
["onHit" + i]);
function ["onHit" + i]() {
trace("the button hit was hit");
}
}
}
}
_______________________________________________
[email protected]
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