PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
multiple buttons on stage to action using forloop
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: multiple buttons on stage to action using forloop

  1. #1
    Flash Genie letschillout's Avatar
    Join Date
    Feb 2007
    Location
    31.52949, 74.347272
    Posts
    146

    multiple buttons on stage to action using forloop

    Hi, I want to multiple buttons on stage to capture switch action
    via for loop

    Actionscript Code:
    [CODE]import flash.events.MouseEvent;
    import flash.text.TextField;
    import flash.display.MovieClip;
    import flash.display.DisplayObject;


    for ( var i:int = 1 ; i < 13; i++ ){
        var curButton:DisplayObject = getChildByName("btn"+i);
        curButton.buttonMode = true;
        curButton.addEventListener ( MouseEvent.MOUSE_OVER, onMouseOver);
        curButton.addEventListener ( MouseEvent.MOUSE_OUT, onMouseOut);
        curButton.gotoAndStop(1);
        trace(curButton);
    }


    /*var clipArray:Array = [btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9, btn10, btn11, btn12];
    for(var i:int = 0; i < clipArray.length; i++) {
        clipArray[i].buttonMode = true;
        clipArray[i].addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
        clipArray[i].addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
    }
    */


    function onMouseOver(event:MouseEvent):void
    {

     txt.gotoAndPlay(1);
    }

    function onMouseOut(event:MouseEvent):void
    {


        txt.gotoAndStop(1);
        txt.s.text = "";
    }
    [/CODE]
    Charag - 3D, Flash Games, Animations,
    Website Development & More...


  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Did you have a question?

  3. #3
    Senior Member
    Join Date
    Jun 2008
    Posts
    549
    Have you adding the button on the stage?

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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center