-
Senior Member
startDrag();
I want to create a movieclip that can be dragged. I am using the startDrag function but can't seem to get it to work the way I want it to. I have a mc called "bio" that is inside another mc called "mask". The mask mc is of course a mask layer that uses a box that is 195px in width and 309px in height as the mask to display the bio mc. I want the bio mc to be able to be dragged up and down but not side to side. This is what I'm using for the actionscript:
PHP Code:
onClipEvent (mouseDown) {
startDrag(this, true, _x = 0, _y = -442.5, _x = 0, _y = -162);
}onClipEvent (mouseUp) {
stopDrag();
}
The mc I want to be dragged (bio) is positioned in the y axis at -442.5. When clicked I want it to be able to be dragged no more than -162.5 in they y axis and then back up to -442.5 y axis position. For some reason, this doesn't work. When it is clicked it is automatically repositioned to show about half of the mc "bio" and then can be dragged all the way up and can no longer be seen. You can see what I mean by visiting www.round-tree.com/index2.html and click the scroll at the top of the wood frame on the main page.
Can somebody please help? If you would like to see the source code you can download the .fla at www.round-tree.com/bio.zip
Thanks
-
the start drag syntax is:
startDrag(target,[lock ,left ,top ,right,bottom])
just get rid of your x= and y=
instead of:
startDrag(this, true, _x = 0, _y = -442.5, _x = 0, _y = -162);
try:
startDrag(this, true, 0,-442.5, 0,-162);
-
Senior Member
Thanks miscellaneum.
I actually just got it figured out. My code looks like this:
onClipEvent(load) {
left = (_root.jeffBio.bio._x) - 0;
top = (_root.jeffBio.bio._y) - 0;
right = (_root.jeffBio.bio._x) - 0;
bottom = (_root.jeffBio.bio._y) + 355;
}
on(press) {
startDrag(this, false, left , top , right, bottom)
}
on(release) {
stopDrag();
}
It seems to work pretty good.
www.round-tree.com/index2.html to check it out.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|