The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 3 of 3

Thread: I'm stuck! Please help... Its those pesky button arrays

  1. #1

    I'm stuck! Please help... Its those pesky button arrays

    Hello, I have been trying to solve this for a week now, sadly to no avail. I need to change the box format that this code puts my buttons into. I would like it just to be one line of buttons.


    //////// Code:


    fm_button.visible = false;


    import caurina.transitions.Tweener;


    var menu_label:Array = new Array("Media", "Shop", "Team", "Events", "News", "Contact" );


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


    for( i = 0; i < total; i++ )
    {
    var btn = new flashmo_button();
    btn.name = "flashmo_btn" + i;
    btn.x = -400; //Have tried to change to: btn.x = i * 100 + 15;

    btn.flashmo_click_area.addEventListener( Event.ENTER_FRAME, btn_enter );
    btn.flashmo_click_area.addEventListener( MouseEvent.ROLL_OVER, btn_over );
    btn.flashmo_click_area.addEventListener( MouseEvent.ROLL_OUT, btn_out );
    btn.flashmo_click_area.addEventListener( MouseEvent.CLICK, btn_click );

    var each_substring:Array = menu_label[i].split("|");
    btn.flashmo_button_label.fm_label.text = each_substring[0];
    btn.item_url = each_substring[1];
    btn.item_no = i;
    btn.flashmo_icon.gotoAndStop( i + 1 );

    main_menu.addChild(btn);
    }


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


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


    function btn_click(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);
    }


    function btn_enter(e:Event):void
    {
    var mc = e.target.parent;

    if( mc.over == true )
    mc.nextFrame();
    else
    mc.prevFrame();
    }


    function change_page(no:Number):void
    {
    page = no + 1;
    play();
    }


    for( i = 0; i < 40; i++ )
    {
    var box = new flashmo_box();
    box.name = "flashmo_box" + i;
    box.alpha = 0;
    box_group.addChild(box);
    }

    ///////// End Code


    I have tried to change the btn.x to btn.x = i * 100 + 15; which put a second menu up for 1 sec before it disappears and leaves me with the original. Any help would be greatly appreciated, Thanks for your time.

  2. #2
    rimacy's Avatar
    309
    posts
    Registered Schmoozer
    what happens when you remove the code in the enter frame handler when you have the progressive btn.x code?
    Last edited by rimacy; April 14th, 2012 at 08:28 PM.

  3. #3
    Quote Originally Posted by rimacy View Post
    what happens when you remove the code in the enter frame handler when you have the progressive btn.x code?
    If I remove btn.flashmo_click_area.addEventListener( Event.ENTER_FRAME, btn_enter ); it does the same thing and the hole menu shakes. Is this what you meant? I am fairly new to as3. Thanks!
    Last edited by seth42; April 14th, 2012 at 10:08 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012