Skip to main content
Inspiring
April 19, 2006
Question

using the same actionscript on many items?

  • April 19, 2006
  • 1 reply
  • 267 views
I am a very very big noob when it comes to actionscript. I have designed a few things adding behaviors to items and screens, but just dont understand actionscript.

What I am wanting to do is use the same action script on many items. I have many 'buttons' on a page that I want to all act the same on rollOver and onPress, etc. Now I could just use a button for this, but the problem is that I also want the items to be able to be like a 'disjointed rollover'.

Is there a way to asign the same actionscipt to all the movieclips so each object doesn't need to have multiple behaviors? And I'm sorry to say this, you may need to explain a solution to me in very simple terms.

Here are my files

swf - btnTest.swf
fla - btnTest.fla
This topic has been closed for replies.

1 reply

Participating Frequently
April 19, 2006
if you want a certain script to attach to every instance you place on stage. then you need to have the script inside with the object (in the library, that is)

that way, every instance of the object to drag out from the library will have the script already attached to it.
Inspiring
April 19, 2006
Thank you for the reply.
I'm sure I am missing something basic, but that does not seem to work for me here.
For instance, If I turn one of the 'buttons' on the right (in my example file above) into a symbol with the actionscript attached to it then I drag it onto the stage; everything works fine. However if I then add behaviors to get the 'disjointed rollover' onto another button that works, but the original button has lost it's rollover effect.
Thanks for the help - anymore suggestions for me?