dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: PLEASE HELP - Array Buttons and movieclip change

  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    1

    PLEASE HELP - Array Buttons and movieclip change

    How can I make that when I press one of the button arrays then a movie clip loads in the frame where it sends me? for example on the company. And then the movie clip unloads and another loads when I click on tutorials? forexample.
    i just want that clicking a specific array button triggers the appearance of my movieclip in only the frame where the button sends me.
    Sorry my english is not so good

    Here's the code for the menu:

    Caurina.Transitions.Tweener import;

    var menu_label: Array = new Array ("Home", "The Company", "Online Store"
    "Service Center", "tutorials", "Contact");

    var total: Number = menu_label.length;
    var i: Number = 0;
    var page: Number;
    var MAIN_MENU: MovieClip = new MovieClip ();
    stage.addChild (MAIN_MENU);

    fm_button.visible = false;
    stop ();

    for (i = 0; i <total; i + +)
    {
    var btn = new apple_button ();
    btn.name = "btn" + i;
    btn.x fm_button.x + = i * (fm_button.width + 12);
    btn.y = -50;
    btn.buttonMode = true;
    btn.item_no = i;
    btn.apple_click_area.addEventListener (Event.ENTER_FRAME, btn_enter);

    var each_substring. menu_label = array [i] split ("|");
    btn.apple_button_label.fm_label.text each_substring = [0];
    btn.item_url each_substring = [1];
    main_menu.addChild (btn);

    Tweener.addTween btn (, {y: fm_button.y, time: 0.6,
    delay: 0.2 * i transition, "easeOutQuart"
    onComplete: goto_page, onCompleteParams: [i]});
    }

    goto_page function (no: Number): void
    {
    if (no == main_menu.numChildren - 1)
    change_page (0) / / default page on load
    }

    btn_over function (e: MouseEvent): void
    {
    e.target.parent.over = true;
    }

    btn_out function (e: MouseEvent): void
    {
    e.target.parent.over = false;
    }

    btn_click function (e: MouseEvent): void
    {
    var mc = e.target.parent;
    if (mc.item_url! = undefined)
    navigateToURL (new URLRequest (mc.item_url), "_parent");
    else
    change_page (mc.item_no);
    }

    btn_enter function (e: Event): void
    {
    var mc = e.target.parent;
    if (mc.over == true)
    mc.nextFrame ();
    else
    mc.prevFrame ();
    }

    change_page function (no: Number): void
    {
    for (var i: Number = 0; i <main_menu.numChildren; i + +)
    {
    var mc = MovieClip (main_menu.getChildAt (i));
    mc.over = false;
    mc.apple_click_area.visible = true;
    mc.apple_click_area.addEventListener (MouseEvent.ROLL_OVER, btn_over);
    mc.apple_click_area.addEventListener (MouseEvent.ROLL_OUT btn_out);
    mc.apple_click_area.addEventListener (MouseEvent.CLICK, btn_click);
    }
    mc_selected var = MovieClip (main_menu.getChildAt (no));
    mc_selected.over = true;
    mc_selected.apple_click_area.visible = false;
    mc_selected.apple_click_area.removeEventListener (MouseEvent.ROLL_OVER, btn_over);
    mc_selected.apple_click_area.removeEventListener (MouseEvent.ROLL_OUT btn_out);
    mc_selected.apple_click_area.removeEventListener (MouseEvent.CLICK, btn_click);

    page = no + 11;
    play ();
    }

    obsolete.addEventListener (MouseEvent.CLICK, goto_fm);

    goto_fm function (e: MouseEvent): void
    {
    navigateToURL (new URLRequest ("http://www.flashmo.com"), "_parent");
    }
    Demorus is offline Report Edit Post Delete Post /

  2. #2
    flash grasshopper
    Join Date
    Feb 2005
    Posts
    156
    And what is happening with the code that you have here? Can you explain more about which part is not working?

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