The Mouse X is the position of the mouse-pointer on the X axis (horizontal) of the Stage, in pixels of the normal stage size. The value gets higher or lower depending on how far right on the Stage it is. It cannot be off the Stage; in the project editor, it caps at ±240. If the mouse moves out of the Flash player frame in older versions of the software, this value is set to -240.

Related Block

The following block can be used in conjunction with this value:

Example Uses

Some common uses for the Mouse X value are below:

  • Sliders

In a project, if something needs to be adjustable, then a slider can be used that can be controlled using the mouse.

The slider button (the sprite that will slide back and forth) should have these scripts:

when this sprite clicked
repeat until <not<mouse down>>
    set [main value v] to (mouse x)
    go to x:(main value) y:(180)
end

The Y position can be any value, and the main value is the value that will be controlled by the slider.

  • Moving horizontally
  • Finding the mouse's X position
  • Mousing-over an area

See Also

Cookies help us deliver our services. By using our services, you agree to our use of cookies.