Flash: Functions for buttons
I have 20 buttons, eahc a different color. I want to perform the same actions on each button when I mouseover and then out, so I assumed a function would be the best choice in case some things needed changing later. When I try the same code that works just fine within a button:
Code:
on(rollOver) {
varColorName = "Orange"; }
on(rollOut){
varColorName = ""; }
placed inside of a function in the scene-frame instead of the button, though, (where I thought functions had to be created) I get this error:
Quote:
Mouse events are permitted only for button instances
Can someone at least point me in the right direction? I am not new to Flash but I am obviously new to scripting in Flash. The scripting feels so different from VB for me.
Re: Flash: Functions for buttons
Which version of action script are you using?
Re: Flash: Functions for buttons
2.0
I basically want to be able to create a new (global) function so that I can just use the function name and the single parameter that changes for each button instead of the same code being placed over and over for each button with only the one element changed.
Re: Flash: Functions for buttons
Hi,
In AS2 this is how the code works:
Code:
myButton.onRelease = function() {
//Place code here
};
Apart from that I can't be of much help unless you want to create the function in AS3?
Edit:
I started learning Flash last year using CS2 and objects! However, this year we are coding using CS3.