class com.domain.RollWhileWithin extends MovieClip
{
public var rolled:Boolean;
function RollWhileWithin ()
{
rolled = false;
}
public function doRollOver():Void
{
if (!rolled) {
rolled = true;
gotoAndStop("over");
}
}
public function doRollOut():Void
{
if (rolled) {
rolled = false;
gotoAndStop("up");
}
}
}
One level above it, you can manage as many clips as there are.
var checkMouseInterval:Number;
clearInterval(checkMouseInterval);
checkMouseInterval = setInterval(this, "checkMouse", 100);
private function checkMouse():Void
{
var i:Number = 5;
while (i--) {
var clip:MovieClip = this["MC_RollClip" + i];
if (_xmouse > clip._x && _xmouse < clip._x + clip._width
&& _ymouse > clip._y && _ymouse < clip._y + clip._height) {
clip.doRollOver();
} else {
clip.doRollOut();
}
}
}
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com