PDA

View Full Version : Starting attempt at a drawing app problem..


morefire
01-17-2003, 01:35 PM
Hi,

Im planning on creating a 'drawing app' mainly, it will just be able to have text and shapes, draggable and editable (size, color etc).

Now, as a start, ive created a box, which apparently does nothing. Im trying to make it draggable, for a start at least, But it doesnt seem to work..

Could anyone take a look at the attached code and maybe give me some advice? am I headed in the right path? Why wont it drag?

Thanks in advance,

Matt.

binkyboo
01-17-2003, 06:54 PM
I added this code to make your attached clip draggable.

_root.attachMovie("box", "mybox", 1);
_root.mybox.onMouseDown = function() {
checkX = _root._xmouse;
checkY = _root._ymouse;
if (_root.mybox.hitTest(checkX, checkY, true)) {
startDrag("_root.mybox");
}
};
_root.mybox.onMouseUp = function() {
stopDrag();
};

Hope this helps!

morefire
01-17-2003, 08:25 PM
Thanks binkyboo, thats great.

Is there anyway that I could do this in the 'class' though? so I can create multiple instances of the movieclip at runtime?

Thanks,

Matt.

morefire
01-17-2003, 08:28 PM
:) Forget that, I just put it in the class, and replaced _root.mybox with this. and it works,

Thanks again.

binkyboo
01-17-2003, 09:10 PM
Yeah as soon as I posted my reply I realized that it should target 'this'. Glad I could help!