]
To: [EMAIL PROTECTED]
Sent: Sunday, May 06, 2007 4:09 AM
Subject: RE: [Flashcoders] Syntax for dynamically calling a function
Any details as to why?
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Muzak
Sent: Friday, May 04, 2007 11:41 PM
To: flashcoders
- Original Message -
From: Jesse Graupmann [EMAIL PROTECTED]
To: flashcoders@chattyfig.figleaf.com
Sent: Friday, May 04, 2007 10:05 PM
Subject: RE: [Flashcoders] Syntax for dynamically calling a function
My personal favorite is the use of the Delegate loaded with arguments.
Happens
Wow, thanks for all your suggestions guys, Lists, I really appreciate
the time you took to write your detailed response, I like your third
option the best. David thanks for your suggestion I am going to do
some further experimentation. I'll also have a look into the Event
Dispatcher class
www.jessegraupmann.com
www.justgooddesign.com/blog/
_
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Alistair
Colling
Sent: Friday, May 04, 2007 8:59 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Syntax
You could do something like this:
class Something
{
method1();
method2(a_number:Number);
}
Somewhere else:
var method_str:String = method1;
var sm:Something = new Something();
sm[method_str](); // Will call method1 class method
sm[method2](0x09F911029D74E35BD84156C5635688C0); // Also
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf
Of Alistair Colling
Sent: 03 May 2007 15:27
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Syntax for dynamically calling a function
Hi there, I want to call a function but want to
AC Hi there, I want to call a function but want to able to call it
AC dynamically so a string that is passed will determine which function
AC is called.
AC My reason for this is I have an interface with a number of buttons
AC that have different labels but that look the same and need to call
Thanks Robert, I didn't know you could do that. It's a shame you
can't use the same square bracket syntax in the FLA without creating
a custom class, still this is a neat solution :)
Cheers!
Ali
On 3 May 2007, at 16:04, Robert Brisita wrote:
You could do something like this:
class
: [Flashcoders] Syntax for dynamically calling a function
You could do something like this:
class Something
{
method1();
method2(a_number:Number);
}
Somewhere else:
var method_str:String = method1;
var sm:Something = new Something();
sm[method_str](); // Will call method1 class method
sm[method2
The short answer is, you can invoke the function directly by writing:
this.onPress = function () {
_parent[this._name]();
}
or, if this looks clearer, you can use the call() method
this.onPress = function () {
_parent[this._name].call();
}
However, there are a few issues with this
That¹s good to know. Thanks, Steven.
IIRC, instanceof is faster than typeof.
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you
11 matches
Mail list logo