Or even:
var doStuff:Function=function (){
// code...
}
myButton_btn.onRelease = doStuff;
myButton_btn.onPress = doStuff;
myButton_btn.onRollOver = doStuff;
or
import mx.utils.Delegate;
function doStuff(){
// code...
}
var delDoStuff:Function=Delegate.create(this,doStuff);
myButton_btn.onRelease = delDoStuff;
myButton_btn.onPress = delDoStuff;
myButton_btn.onRollOver = delDoStuff;
Ian
On 5/2/06, ryanm <[EMAIL PROTECTED]> wrote:
> You can do this:
>
> myButton_btn.onRelease = myButton_btn.onPress = myButton_btn.onRollOver =
> function(){
> doStuff();
> }
>
In my experience that doesn't work. It *should*, but for some reason,
the function never gets assigned to most or all of the events. Better is to
use Delegate.
import mx.utils.Delegate;
function doStuff(){
// code...
}
myButton_btn.onRelease = Delegate.create(this,doStuff);
myButton_btn.onPress = Delegate.create(this,doStuff);
myButton_btn.onRollOver = Delegate.create(this,doStuff);
_______________________________________________
[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