Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Line Break in Menu Array

    I have a menu with 8 buttons. I need to add a line break after the 4th button (Contact Information) so that I will have 4 buttons across by 2 buttons high. Please help me with some options. Below is the action script:

    Code:
    var menu_label:Array = new Array("Welcome & What's New", "About Us & Why Us?", "Testimonials", "Contact Information", "Repair Services", "Upgrade Services", "Custom Built Systems", "Game Consoles");
    
    var total:Number = menu_label.length;
    var i:Number = 0;
    var page:Number;
    var main_menu:MovieClip = new MovieClip();
    stage.addChild(main_menu);
    
    for( i = 0; i < total; i++ )
    {
    	var btn = new flashmo_button();
    	btn.name = "btn" + i;
    	btn.x = fm_button.x + (fm_button.width + 10) * i;
    	btn.y = fm_button.y;
    	btn.item_no = i;
    	btn.addEventListener( Event.ENTER_FRAME, btn_enter );
    	
    	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.flashmo_button_icon.gotoAndStop( i+1 );
    	main_menu.addChild(btn);
    }
    
    function btn_over(e:MouseEvent):void
    {
    	e.target.over = true;
    }
    
    function btn_out(e:MouseEvent):void
    {
    	e.target.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;
    	if( mc.over == true )
    		mc.nextFrame();
    	else
    		mc.prevFrame();
    }
    
    function change_page(no:Number):void
    {
    	for( var i:Number = 0; i < main_menu.numChildren; i++ )
    	{
    		var mc = MovieClip( main_menu.getChildAt(i) );
    		mc.over = false;
    		mc.flashmo_click_area.visible = true;
    		mc.addEventListener( MouseEvent.ROLL_OVER, btn_over );
    		mc.addEventListener( MouseEvent.ROLL_OUT, btn_out );
    		mc.addEventListener( MouseEvent.CLICK, btn_click );
    	}
    	var mc_selected = MovieClip( main_menu.getChildAt(no) );
    		mc_selected.over = true;
    		mc_selected.flashmo_click_area.visible = false;
    		mc_selected.removeEventListener( MouseEvent.ROLL_OVER, btn_over );
    		mc_selected.removeEventListener( MouseEvent.ROLL_OUT, btn_out );
    		mc_selected.removeEventListener( MouseEvent.CLICK, btn_click );
    
    	page = no + 1;
    	play();
    }
    
    
    change_page(0);

  • #2
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Wow, this forum in no help at all....


  •  

    Tags for this Thread

    Posting Permissions

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