A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Many buttons and same actionscript

  1. #1

    I have lots of different buttons with the same actionscript on each of them. I think that this is stupid to assign the same script all over again. I would love to use the "call" method but i can't. In this actionscript there are 3 segments. On rollover, on rollout and on release. That's why I can't copy>paste this script to a different frame to "call" it than from all my buttons.

    Should I copy>paste the script to all buttons or there is a better way?

    10x alot 4 help
    Damir Secki

  2. #2
    Here is what you can do. Place your action script for your buttons in a text file and name it something like "buttonActions.as"

    Now on each of you buttons add this code and this code only:
    #include "buttonActions.as"
    Now when you want to edit the actions just edit the text file.

  3. #3

    I didn't know I can do this! #include!!!

    10x alot man!


  4. #4


    This is not helping!

    first of all I can't call directly in the button action #include, I need to do "on rollover" or "on released" first. and anyway the file size stil increased becouse this script are included in the swf file.

    But the problem stil remains. The "call" method is the best, but how to use it:

    I would love to have this script in the separated frame(called "action") and than "call" it in my buttons:

    on (rollOver) {
    _level0/:eCountry = "Russia, Europe";
    on (rollOut) {
    if ((ca eq "") or (ca eq "Europe")) {
    _level0/:eCountry = "Europe";
    } else {
    _level0/:eCountry = ca;

    on (release) {
    ca = "Russia, Europe";
    _level0/:eCountry = ca;

    In my button would be:

    But I can't enter the script in "action" neither I can't enter the exact code (withoud on release) in my button.
    I have more than 40 buttons and If I enter the script all over again the file size increses dramaticly!


    I would really appresciate

    Damir Secki

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center