A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Error #1009 - mouse over, mouse out and click

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

    Error #1009 - mouse over, mouse out and click

    am using CS5 - as3
    am getting error

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at index_nutro_fla::MainTimeline/manageMouseOut()

    ---------------------------------
    my mouser over is a moveclip use to work fine but giving this error
    here is the code
    ---------------------------------

    Actionscript Code:
    stop();
    import  flash.display.MovieClip;
    import  flash.events.MouseEvent;

    bk_btn.buttonMode=true;
    bk_btn.useHandCursor = true;

    bk_btn.addEventListener(MouseEvent.MOUSE_DOWN, managePlay,false, 0, true);

    function managePlay(event:MouseEvent):void {
        bk_btn.removeEventListener(MouseEvent.ROLL_OUT, manageMouseOver);
        bk_btn.removeEventListener(MouseEvent.ROLL_OVER, manageMouseOver);
        gotoAndPlay("begin","book_animation");
    }



    /*bk_btn.addEventListener(MouseEvent.ROLL_OVER, manageMouseOver);
    bk_btn.addEventListener(MouseEvent.ROLL_OUT, manageMouseOver);*/

    //bk_btn.addEventListener(MouseEvent.CLICK, managePlay);

    /*
    function manageMouseOver(event:MouseEvent):void{
      bk_btn.play();
    }

    function managePlay(event:MouseEvent):void{
      bk_btn.play();
    }
    */


    //function onPressHandler(myEvent:MouseEvent){


    rcard_btn.buttonMode=true;
    rcard_btn.useHandCursor = true;
    rcard_btn.addEventListener(MouseEvent.ROLL_OVER, rcardOver);
    rcard_btn.addEventListener(MouseEvent.ROLL_OUT, rcardOver);
    function rcardOver(event:MouseEvent):void{
      rcard_btn.play();
    }

    pcard_btn.buttonMode=true;
    pcard_btn.useHandCursor = true;
    pcard_btn.addEventListener(MouseEvent.ROLL_OVER,pcardOver);
    pcard_btn.addEventListener(MouseEvent.ROLL_OUT, pcardOver);
    function pcardOver(event:MouseEvent):void{
      pcard_btn.play();
    }

    ycard_btn.buttonMode=true;
    ycard_btn.useHandCursor = true;
    ycard_btn.addEventListener(MouseEvent.ROLL_OVER, ycardOver);
    ycard_btn.addEventListener(MouseEvent.ROLL_OUT, ycardOver);
    function ycardOver(event:MouseEvent):void{
      ycard_btn.play();
    }


    bk_btn.addEventListener(MouseEvent.ROLL_OVER, manageMouseOver, false, 0, true);
     
    function manageMouseOver(event:MouseEvent):void{
      bk_btn.removeEventListener(MouseEvent.ROLL_OVER, manageMouseOver);
      bk_btn.addEventListener(MouseEvent.ROLL_OUT, manageMouseOut, false, 0, true);
      bk_btn.play();
      //your over code here
    }
     
    function manageMouseOut(event:MouseEvent):void{
     bk_btn.removeEventListener(MouseEvent.ROLL_OUT, manageMouseOver);
     bk_btn.addEventListener(MouseEvent.ROLL_OVER, manageMouseOut, false, 0, true);
      //your out code here
      bk_btn.play();
    }
    Charag - 3D, Flash Games, Animations,
    Website Development & More...


  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    In managePlay, you go to another scene and frame. If bk_btn is not present there, then the bk_btn reference will be null when manageMouseOut fires.

  3. #3
    Flash Genie letschillout's Avatar
    Join Date
    Feb 2007
    Location
    31.52949, 74.347272
    Posts
    146
    Thanks ....
    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