useful tips and resources

Editing buttons in flash templates

July 14th, 2008 · 16 Comments

This is a quick solution for those who wanted to assign some buttons to go to web pages or URLs in existing main menu of flashmo.com templates. Button action scripts are usually located on first frame of actions layer.

First, you need to use the separator | between button label and URL. e.g. “Services|service.html”, “Company|http://www.flashmo.com” for buttons which are pointing to other web pages.

Actionscript:
  1. var menu_label:Array = new Array(“Home”, “Services|service.html”, “Testimonials”,
  2. “Company|http://www.flashmo.com”, “Contact”);

Second, add a few lines of codes for splitting button label and URL.

Actionscript:
  1. var each_substring:String = menu_label[i].split(“|”);
  2. menu_item_group[“menu_item”+i].item_label = each_substring[0];
  3. menu_item_group[“menu_item”+i].item_url = each_substring[1];

Third, add if else statement to check the URL exists or not in button onRelease action.

Actionscript:
  1. if( this._parent.item_url != undefined )
  2. getURL(this._parent.item_url, “_parent”);
  3. else
  4. _root.change_page(this._parent.item_no);

Here is the complete source codes.

Actionscript:
  1. menu_item_group.menu_item._visible = false;
  2. var menu_label:Array = new Array(“Home”, “Services|service.html”, “Testimonials”,
  3. “Company|http://www.flashmo.com”, “Contact”);
  4. var total:Number = menu_label.length;
  5. var distance_x:Number = 124;
  6. var i:Number = 0;
  7.  
  8. for( ; i <total; i++ )
  9. {
  10. menu_item_group.menu_item.duplicateMovieClip(“menu_item”+i, i);
  11. menu_item_group[“menu_item”+i].over = true;
  12.  
  13. var each_substring:String = menu_label[i].split(“|”);
  14. menu_item_group[“menu_item”+i].item_label = each_substring[0];
  15. menu_item_group[“menu_item”+i].item_url = each_substring[1];
  16. menu_item_group[“menu_item”+i].item_no = i;
  17. menu_item_group[“menu_item”+i]._x = i * distance_x;
  18. }
  19. function change_page(no):Void
  20. {
  21. for( i = 0; i <total; i++ )
  22. {
  23. menu_item_group[“menu_item”+i].flashmo_button._visible = true;
  24. menu_item_group[“menu_item”+i].over = true;
  25. menu_item_group[“menu_item”+i].flashmo_button.onRollOver = function()
  26. {
  27. this._parent.over = false;
  28. }
  29. menu_item_group[“menu_item”+i].flashmo_button.onRollOut =
  30. menu_item_group[“menu_item”+i].flashmo_button.onDragOut = function()
  31. {
  32. this._parent.over = true;
  33. }
  34. menu_item_group[“menu_item”+i].flashmo_button.onRelease = function()
  35. {
  36. if( this._parent.item_url != undefined )
  37. getURL(this._parent.item_url, “_parent”);
  38. else
  39. _root.change_page(this._parent.item_no);
  40. }
  41. menu_item_group[“menu_item”+i].onEnterFrame = function()
  42. {
  43. if( this.over == true ) this.prevFrame();
  44. else this.nextFrame();
  45. }
  46. }
  47. delete menu_item_group[“menu_item”+no].flashmo_button.onRollOut;
  48. menu_item_group[“menu_item”+no].flashmo_button._visible = false;
  49. menu_item_group[“menu_item”+no].over = false;
  50. _root.page = no + 1;
  51. _root.play();
  52. }
  53. change_page(0); // the default page on load

Edit the timeline in menu item movie clip for rollover effect for modifying the button effect.
Edit menu item label movie clip for embedding characters in your language font. See the example below:

Embedding Font in Flash

Tags: Flash · Tutorials

16 responses so far ↓

  • 1 Editing Flash Templates // Jul 14, 2008 at 11:07 am

    […] Editing Buttons […]

  • 2 Richard // Jul 27, 2008 at 5:08 pm

    Thanks for the templates fantastic also the tips…..just 1 question i coppid the script and it worked perfect but how does it work for a vertical buttons bar ..thanks richard

  • 3 Jhay // Aug 12, 2008 at 10:17 am

    hi how can i edit the menu button on flashmo 081 design, i wanted to change the text into my own menu. For example “Our Clients” will become “Our members” PLEASE HELP.

  • 4 cangrejero // Aug 18, 2008 at 9:17 pm

    This tutorial helped me a lot and I was able to modify a vertical scroller template with little effort. My problem is that I have tried to add a button to send an email using the client’s email program, to no avail. I don’t want to use PHP for it. Could you point me in the right direction? Any help appreciated. Thanks!!!

  • 5 Bookmarks about Button // Sep 1, 2008 at 11:41 pm

    […] - bookmarked by 1 members originally found by tamberg on 2008-08-10 Editing buttons in flash templates http://www.webdesignmo.com/blog/2008/07/14/editing-buttons-in-flash-templates/ - bookmarked by 2 […]

  • 6 molped // Sep 4, 2008 at 12:35 pm

    Hello!

    Thanks for some great free templates!

    In template “104 cirkular” I tried assigning buttons to go to webpages/URL’s. I used this tutorial + your code for splitting button labels and URL’s. But I can’t get i to work.
    Where in the original template-code do I add this extra code?

    Best regards

  • 7 Chris // Sep 9, 2008 at 11:26 pm

    I was wondering on template 089 How do you change the spacing of the buttons. I changed the text and now their is a big gap between two buttons.

  • 8 admin // Sep 10, 2008 at 7:40 am

    Chris, you need to edit line 15 in first frame of actions layer.

    menu_item_group[”menu_item”+i]._x = i * 86;

    You can adjust the number 86 to lower value.

  • 9 Irene // Sep 14, 2008 at 9:18 am

    I can’t believe I found this string…I am working on exactly this and managed to manipulate it pretty good (http://www.piratesofthecapitalcity.com/pirate_flash.html) . I’m still working on it. My question is how do I add a string to open the external url on the menu with a “_blank” target.

    Thanks so much.

  • 10 Irene // Sep 14, 2008 at 10:00 am

    I found it! I should have looked at the code a little harder!
    _______________

    mi.flashmo_button.onRelease = function()
    {
    if( this._parent.item_url != undefined )
    getURL(this._parent.item_url, “_blank”); <<<<<<<

    else
    _root.change_page(this._parent.item_no);
    };

    _____________

    the original file had “parent” so I changed.

  • 11 admin // Sep 14, 2008 at 10:04 am

    Irene, I am really glad to know that you finally got it. :)

  • 12 Rix // Oct 15, 2008 at 11:54 am

    Hi,

    I am currently using template 081 and i am trying to get equal spacing between the letters of my menu.

    The space between most items is fine except between “What is Radiology” and “Practitioners”.

    Is this because more than one word is used? If so, is there a way around this?

    Also, is there a way to centre align the menu to the the page or do you just have to go by eye adjusting the x co-ordinate value?

    Code is:
    menu_item_group.menu_item._visible = false;
    var menu_label:Array = new Array(”About”, “What is Radiology”, “Practitioners”, “FAQ’s”, “Location”, “Contact”);
    var total:Number = menu_label.length;
    var distance_x:Number = 124;
    var i:Number = 0;

    Any help is appreciated.

  • 13 antony diamandopoylos // Oct 17, 2008 at 8:51 pm

    Hi to all,
    i am ussing the 079 classic template an i would like to add drop down menus on the exhisting menu.
    how is that possible through actionscript?

  • 14 the flash menu designer // Oct 23, 2008 at 3:25 pm

    Thanks you I’m alwasy learning!

  • 15 chris // Oct 31, 2008 at 7:48 am

    Hi,

    im totally new to this flash thing. i was looking at the portfolio template (135) and tried editing the menu (testimonials to about us) but cant seem to understand what im supposed to do or how to go about it…. please help

  • 16 Yan // Nov 6, 2008 at 11:20 am

    Hey,

    I’m currently trying to edit flashmo 120 artwork, and I can’t find any of these source codes. So needless to say I’m having massive difficulty changing the button menus. Everything else works great and was not hard to edit.

    Any advice? Please.

Leave a Comment