I have been playing with dragging as I know nothing about it.
I have my stage 500 x 500.
and following on from a tutorial I saw here on kirupa, I am loading a picture dynamically into flash, into a new movie clip which gets created, then making it draggable.
Here is the code I am using:
_root.createEmptyMovieClip("container", 1);
container.loadMovie("photo.jpg");
container._x = 0;
container._y = 0;
h = 500 - (container._height);
w = 500 - (conatiner._width);
_root.onMouseDown = function() {
startDrag("container", false, 0, 0, w, h);
};
_root.onMouseUp = function() {
stopDrag();
};
ok What I am trying to do is keep the ENTIRE picture within the stage at ALL times. However currently if you grab the edge you can drag the picture off the stage until just the edge of the picture is showing.
I thought (in my mind) this code would do this because “conatiner” would take the proportions of the picture… does it not?
I am obviously doing something wrong, what would be the code to do this?
thanks.