Announcement

Collapse
No announcement yet.

Back to Scaleform mouse

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

    Back to Scaleform mouse

    Hi guys.
    Spent a lot of time searching for information but ...
    I have not found a solution.
    I came across a video which have completely done what I needed. And most important it is the mouse interface.

    there:
    http://www.youtube.com/watch?v=--qjZypZ6fQ

    That I have:
    https://www.youtube.com/watch?v=UeNDWpB3brM

    In the second video I did point on mistakes I've got.
    You can ask me any question, but i need to know what am I doing wrong.

    Code:
    import flash.external.ExternalInterface;
    
    Mouse.hide();
    
    var mouseListener:Object = new Object();
    
    mouseListener.onMouseMove = function ()
    {
    //    mouseCursor_mc._x = _root._xmouse;
    //    mouseCursor_mc._y = _root._ymouse;
    startDrag("mouseCursor_mc", true);
    	
        ExternalInterface.call("UpdateMousePosition", mouseCursor_mc._x, mouseCursor_mc._y);
       
        updateAfterEvent();
    };
    
    Mouse.addListener(mouseListener);

    #2
    No way..
    MouseCursor = MouseContainer.GetObject("mouseCursor_mc");
    MouseCursor.SetPosition(mx,my);

    //
    bad but this way I'll reference to the AS2 my own mouse.....

    Comment


      #3
      i solve this problem last year ...
      your swf movie has specific width and height
      when you resize the movie, the top left screen coordinate is not (0,0) !
      some of the points have negative x and y value ...
      your should add somthing to the mouseX and mouseY value to get real value
      use this code:
      Code:
      /**
       * swf width and height are set to 1024x768
       * */
      // update mouse position
      stage.addEventListener(MouseEvent.MOUSE_MOVE,function(evt:MouseEvent){
              ExternalInterface.call("setMousePosition",stage.mouseX+(stage.stageWidth-1024)/2,stage.mouseY+(stage.stageHeight-768)/2);
      });
      //

      Comment


        #4
        What are you trying to do? Set the scaleform mouse to mx,my (unreal pixels)?

        Then it is important to know that unreal_pixels are different from flash_pixels. If mx,my are unreal_pixels you need to convert it into flash_pixels, so flash can set it to flash_pixel mx2,my2 which looks like on the same screen position as unreal_pixel mx,my.

        for example unreal_pixel(0,0) can be at the same position as flash_pixel(-133,0)
        or flash_pixel(0,0) is on the same position as unreal_pixel(160,0)
        if flash is scaled to fit the unreal window

        Comment

        Working...
        X