Create an alpha rectangle with mousedrag

e.g.

  1. You make a rectangle and it sits on the stage.
  2. You then convert it to a mc and set it to alpha 0%.
  3. You want the mc to follow anywhere your mouse pointer goes but you also want it to only move inside the fla doc’s size (ie. the mc cannot disappear if you mouse your mouse outside the fla document area).

How can you create step 3? (see http://www.hollyvalance.com for visual representation)

Just give it boundries…

If you wnat the rectanbgle to follow your mouse… Just do this…

[AS]
_root.onEnterFrame = function()
{
alphaBox._x = _root._xmouse;
alphaBox._y = _root._ymouse;
}
[/AS]

That is without boundaries… And it follows your mouse right away… if you want easing… It’s an easy upgrade you could probbaly figure out…

Here is with the boundaries.

[AS]
_root.onEnterFrame = function()
{
if(_root._xmouse > 0 && _root._xmouse < 500)
{
alphaBox._x = _root._xmouse;
alphaBox._y = _root._ymouse;
}
}
[/AS]

Change around that 500 value to the width of your .fla file.

hey thanks very much :slight_smile:
I finally get this question answered! :slight_smile: :slight_smile: