|
-
Apr 21st, 2009, 01:49 PM
#1
Thread Starter
Member
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:
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.
-
Apr 27th, 2009, 07:28 PM
#2
Re: Flash: Functions for buttons
Which version of action script are you using?
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Apr 29th, 2009, 02:40 PM
#3
Thread Starter
Member
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.
-
Apr 30th, 2009, 04:16 AM
#4
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.
Last edited by Nightwalker83; Apr 30th, 2009 at 04:25 AM.
Reason: Adding more
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|