A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: arrow keys right and left in different scenes

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

    Post arrow keys right and left in different scenes

    Hi

    i have different scenes once clicked it goes to next
    similarly want to have right and left keys want to work with
    but its only working in the 1st Scene, once user clicks and goes to next
    scene then arrow keys stop working,

    can anyone tell me how key can work in all scenes

    Actionscript Code:
    import flash.system.fscommand;
    import flash.ui.Keyboard;
    import flash.events.Event;
    import flash.events.KeyboardEvent;


    btn_next.addEventListener(MouseEvent.CLICK,next_Slide);
    btn_prev.addEventListener(MouseEvent.CLICK,prev_Slide);
    btn_exit.addEventListener(MouseEvent.MOUSE_DOWN, closeApp);

    stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);


    btn_no1.addEventListener(MouseEvent.CLICK,setContent);
    btn_no2.addEventListener(MouseEvent.CLICK,setContent);
    btn_no3.addEventListener(MouseEvent.CLICK,setContent);
    btn_no4.addEventListener(MouseEvent.CLICK,setContent);
    btn_no5.addEventListener(MouseEvent.CLICK,setContent);
    btn_no6.addEventListener(MouseEvent.CLICK,setContent);
    btn_no7.addEventListener(MouseEvent.CLICK,setContent);
    btn_no8.addEventListener(MouseEvent.CLICK,setContent);
    btn_no9.addEventListener(MouseEvent.CLICK,setContent);
    btn_no10.addEventListener(MouseEvent.CLICK,setContent);
    btn_no11.addEventListener(MouseEvent.CLICK,setContent);
    btn_no12.addEventListener(MouseEvent.CLICK,setContent);



    function closeApp(event:MouseEvent):void
    {
        fscommand("quit");
    }

    function next_Slide(event:MouseEvent):void
    {
        prevScene();
    }

    function prev_Slide(event:MouseEvent):void
    {
        nextScene();
    }

    function keyDownHandler(event : KeyboardEvent):void
    {
    /*  if (event.keyCode == Keyboard.RIGHT)
        {

            nextScene();
        }

        if (event.keyCode == Keyboard.LEFT)
        {

            prevScene();
        }*/

    }




    function setContent(event:MouseEvent):void
    {

        switch (event.target.name)
        {

            case "btn_no1" :
                gotoAndPlay("1","Scene 1");
                break;

            case "btn_no2" :
                gotoAndPlay("1","Scene 2");
                break;

            case "btn_no3" :
                gotoAndPlay("1","Scene 3");
                break;

            case "btn_no4" :
                gotoAndPlay("1","Scene 4");
                break;

            case "btn_no5" :
                gotoAndPlay("1","Scene 5");
                break;

            case "btn_no6" :
                gotoAndPlay("1","Scene 6");
                break;

            case "btn_no7" :
                gotoAndPlay("1","Scene 7");
                break;

            case "btn_no8" :
                gotoAndPlay("1","Scene 8");
                break;

            case "btn_no9" :
                gotoAndPlay("1","Scene 9");
                break;

            case "btn_no10" :
                gotoAndPlay("1","Scene 10");
                break;

            case "btn_no11" :
                gotoAndPlay("1","Scene 11");
                break;

            case "btn_no12" :
                gotoAndPlay("1","Scene 12");
                break;

            case "btn_reply" :
                gotoAndPlay("1","Scene 1");
                break;
        }




    }
    Charag - 3D, Flash Games, Animations,
    Website Development & More...


  2. #2
    Flash Genie letschillout's Avatar
    Join Date
    Feb 2007
    Location
    31.52949, 74.347272
    Posts
    146
    no reply by anyone
    Charag - 3D, Flash Games, Animations,
    Website Development & More...


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