RE: [Flashcoders] quick question about buttons

2006-05-02 Thread Ash Warren
You can do this:

myButton_btn.onRelease = myButton_btn.onPress = myButton_btn.onRollOver =
function(){
 doStuff();
}
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mark Burvill
Sent: Tuesday, May 02, 2006 11:17 AM
To: Flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] quick question about buttons

Hi list,

Is there a way to condense several button handler commands into one line?
ie instead of writing:

myButton_btn.onRelease = function(){
 doStuff();
}
myButton_btn.onPress = function(){
 doStuff();
}
myButton_btn.onRollOver = function(){
 doStuff();
}

Can I do something like:

myButton_btn.onRollOver.onPress.onRollOver = function(){
 doStuff();
}

?

Cheers.

___
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

___
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


RE: [Flashcoders] quick question about buttons

2006-05-02 Thread Ash Warren
I actually use that all the time in this way:

myButton.onRollOut = myButton.onDragOut = function ()...


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mark Burvill
Sent: Tuesday, May 02, 2006 11:35 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] quick question about buttons

That's what I'm after.

Thanks :o)

Ash Warren wrote:
 You can do this:

 myButton_btn.onRelease = myButton_btn.onPress = myButton_btn.onRollOver =
 function(){
  doStuff();
 }
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Mark
Burvill
 Sent: Tuesday, May 02, 2006 11:17 AM
 To: Flashcoders@chattyfig.figleaf.com
 Subject: [Flashcoders] quick question about buttons

 Hi list,

 Is there a way to condense several button handler commands into one line?
 ie instead of writing:

 myButton_btn.onRelease = function(){
  doStuff();
 }
 myButton_btn.onPress = function(){
  doStuff();
 }
 myButton_btn.onRollOver = function(){
  doStuff();
 }

 Can I do something like:

 myButton_btn.onRollOver.onPress.onRollOver = function(){
  doStuff();
 }

 ?

 Cheers.

 ___
 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

 ___
 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


   

___
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

___
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


Re: [Flashcoders] quick question about buttons

2006-05-02 Thread ryanm

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);

   What that does is assign the function doStuff to the event, and it 
will be executed within the scope specified (in the above example, this is 
the scope). It's still 3 lines, but at least it's not a new function 
defenition for each line, it's just an assignment.


ryanm 


___
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


Re: [Flashcoders] quick question about buttons

2006-05-02 Thread Ian Thomas

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);

___
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