I’m trying to make an image (mc) draggable so viewers can get a closer look, but having some minor problems.
- Image is moving out of the movie because it’s using ._y to drag
- Image needs to return to it’s original size when released
- Blows up to infinite size
Code I’m using:
NormHeight = mc1._y; // vertical position at which we are at 100%
VanishPoint = 60; // vertical position at which we vanish
doDrag = function()
{
r = (this._y - VanishPoint) / (NormHeight - VanishPoint);
r = Math.max(0, r);
this._xscale = this._yscale = 100*r;
}
mc1.onPress = function()
{
this.startDrag();
this.onEnterFrame = doDrag;
}
mc1.onRelease = function()
{
this.stopDrag();
delete this.onEnterFrame;
}
I’ve tried adding
mc1.width = 200; mc1.height = 200;
to the onRelease function, but it’s not working.
The image is also blowing up to infinity - anyone know how to constrain it to a specified size? And return it back to original size onRelease?
thnx in adv.