Announcement

Collapse
No announcement yet.

Mouse "stamps" the background when returning to home screen.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Mouse "stamps" the background when returning to home screen.

    Hi all. I just created a level selection screen based loosely around Tessa Lee's Flash/Scaleform menu tutorial. I have everything functioning correctly, except that when I press the buttons that take me back to the main screen of the menu, the cursor places a stamped images of itself on the background. I have tried everything I could possibly think of and nothing has fixed it. Any help would be appreciated.


    MainMenu
    Code:
    import flash.events.MouseEvent;
    import flash.system.fscommand;
    import flash.display.MovieClip;
    
    level1_btn.addEventListener(MouseEvent.CLICK, level1Screen);
    level2_btn.addEventListener(MouseEvent.CLICK, level2Screen);
    level3_btn.addEventListener(MouseEvent.CLICK, level3Screen);
    level4_btn.addEventListener(MouseEvent.CLICK, level4Screen);
    exit_btn.addEventListener(MouseEvent.CLICK, exitGame);
    
    var cursor:cursor_mc = new cursor_mc();
    
    
    drawCursor();
    
    stop();
    
    
    
    function level1Screen(event:MouseEvent):void
    {
         gotoAndStop('Level1');
    }
    function level2Screen(event:MouseEvent):void
    {
         gotoAndStop('Level2');
    }
    function level3Screen(event:MouseEvent):void
    {
         gotoAndStop('Level3');
    }
    function level4Screen(event:MouseEvent):void
    {
         gotoAndStop('Level4');
    }
    function exitGame(event:MouseEvent):void
    {
    	fscommand ('ExitGame');
    }
    function fixCursor()
    {
         removeChild(cursor);
         addChild(cursor);
         cursor.x=mouseX;
         cursor.y=mouseY;
         cursor.startDrag();
    }
    function drawCursor()
    {
    addChild(cursor);
    cursor.x = mouseX;
    cursor.y = mouseY;
    cursor.startDrag();
    }
    Level1
    Code:
    back_btn.addEventListener(MouseEvent.CLICK, goBack);
    confirm_btn.addEventListener(MouseEvent.CLICK, selectLevel1);
    
    fixCursor();
    
    function goBack(event:MouseEvent):void
    {
         gotoAndStop('MainMenu');
    }
    function selectLevel1(event:MouseEvent):void
    {
         fscommand('SelectLevel1');
    }
    Each consecutive level is coded exactly the same, except for the different level calls, of course.


    Once again, thanks for any help.

    #2
    I hate when people beg for answers, however, I really stumped right now. I have been working on this constantly and cannot seem to find a fix for it. If anyone has any information that could be of some help, I would greatly appreciate it.

    Comment


      #3
      stamping is most likely caused by the movieclip no longer have any controls over it, or no longer have the references in the root. I would suggest you should take a look at your fixCursor() , since you have a removeChild() functions being called to start with.

      Comment


        #4
        I finally got this working. I can't believe how easy it was to fix it. The cursor was leaving the stamped image because the original drawCursor() function was being called in Frame1. So everytime you would go to Frame one, it would draw the cursor on top of itself. I created a blank Frame before my menu actually starts and added the drawCursor() call there. Works perfectly.

        Comment

        Working...
        X