Announcement

Collapse
No announcement yet.

[AS3] Mouse Gets drawn behind drop down menu

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

    [AS3] Mouse Gets drawn behind drop down menu

    I have a menu setup in scaleform using AS3 and whenever I use one of the drop down menus my custom mouse gets drawn behind the scrolling list. I haven't really modified anything in the drop down menu at all except a few properties. The property dropdown is set to DefaultScrollingList, itemRenderer is DefaultListItemRenderer, and scrollBar is DefaultScrollBar. Is there some property I need to change to get this working properly?

    #2
    Try right clicking on your cursor's MovieClip and choose 'Arrange'->'Bring to Front'.

    Comment


      #3
      The cursor is spawned through code. How would I do that in AS3?

      Comment


        #4
        Ok, add this to your code after it is spawned:

        addChild(MOUSENAME);

        Replace MOUSENAME with yours.

        Comment


          #5
          I generally have this floating in my script somewhere:

          Code:
          function FixCursor()
          {
               removeChild(myCursor);
               addChild(myCursor);
               myCursor.x = mouseX;
               myCursor.y = mouseY;
               myCursor.startDrag();
          }
          It just removes, adds, and tells it to follow the mouse. Since it is the most recent child to be added to the stage, it is on top of everything else. So whenever you need to fix your cursor, simply call that function.

          Comment


            #6
            Thanks again zikku, I'll try that out.

            Comment


              #7
              Oh, I didn't notice it was you in the other thread. Well if your cursor has a class that dictates it's location and mouse movements, then the FixCursor function would only need to remove and add the child, and not touch it's positioning like I suggested.

              Comment


                #8
                I still can't get it to work. I added this code to the DropdownMenu_MainDemo.fla that comes with the UDK in Development\Flash\AS3\CLIK\demos:

                Code:
                import flash.display.MovieClip;
                import flash.events.MouseEvent;
                
                function handleMouseMove( e:MouseEvent ):void 
                {
                	removeChild(cursor);
                	addChild(cursor);
                	cursor.visible = true;
                	cursor.x = stage.mouseX;
                	cursor.y = stage.mouseY;
                	cursor.startDrag();
                }
                function fixMouse(e:MouseEvent):void {
                
                }
                stage.addEventListener( MouseEvent.MOUSE_MOVE, handleMouseMove, false, 0, true );
                stage.addEventListener( MouseEvent.CLICK, fixMouse);
                
                Mouse.hide();
                var cursor:MovieClip;
                cursor.mouseEnabled = false;
                cursor.tabEnabled = false;
                I tried fixing the mouse on a mouse click event, which is why there is an empty fixMouse function. I then, tried just putting that code for a mouse_move event and it still shows up behind the dropdown list. Any ideas?

                Comment


                  #9
                  I would suggest this thread : [SOLVED] DropDownList Popup Layering Issue (AS3)
                  Using the setTopmostLevel() option worked for me.

                  Comment


                    #10
                    Are you using multiple GFxMoviePlayers? If so you may want to look into the "Priority" property in GFxMoviePlayer... setting to a higher priority sometimes brings stuff to the front.

                    Comment

                    Working...
                    X