View Full Version : Drag and Drop from a Scrollpane...
Ledge
04-28-2003, 07:13 PM
Does anyone know if it is possible to do a drag and drop from a scrollpane? I have been trying for a little while now to get it to work, and I can't quite get it to work.
I have a menu that scrolls left to right with icons in it. The MC on its own outside of the scrollpane works just as it is supposed to, whenever I put it in the scrollpane I can't click on any of the items to drag them.
Here is some of the AS i am using:
myScrollPane.face_mc.alien1_mc.onPress = function (){
this.startDrag(true);
frame = 3;
Xcors = this._x;
Ycors = this._y;
};
myScrollPane.face_mc.alien1_mc.onRelease = function (){
stopDrag();
box_drop=this._droptarget.substr(0,8);
if(box_drop=="/body_mc"){
body_mc.head_mc.gotoAndStop(frame);
}
this._x = Xcors;
this._y = Ycors;
};
MyScrollPane is the ScrollPane, Face_MC is the MC that contains all of the different menu opitons and alien1_mc is the first menu option. I am sorry, but I can't post the FLA here for viewing.
Thanks in advance,
Ledge
Ledge
04-28-2003, 07:24 PM
By looking at some of the other posts on here I was able to figure out that this AS works, but it only lets me move items around in the ScrollPane, when I try to move them out of the ScrollPane they disappear, I am guessing this is because of the Mask. Does anyone know how to deal with the Mask on a Component?
This was the AS that partially worked:
myScrollPane.tmp_mc.alien1_mc.onPress = function (){
this.startDrag(true);
frame = 3;
Xcors = this._x;
Ycors = this._y;
};
CyanBlue
04-28-2003, 07:32 PM
Howdy...
I think that goes more to the existance of the movieclip that you are draggin from the scrollpane instance...
Maybe you can duplicate the movieclip that you are dragging as soon as the _xmouse and _ymouse goes out of the scrollpane aread and use that one???
I had similar one a while ago, and it wasn't successful to me... :(
You gotta let me know if you get yours working, right??? ;)
Maybe there is other way to do it... But I don't know...
Ledge
04-28-2003, 08:29 PM
I think I figured out a way to do it. What I am doing is attaching a MC to the mouse whenever you click on the stage, the first frame is blank so it can't be seen. When you click on an item in the scrollpane it jumps to a specific frame that is in the MC that is attached to the mouse. The MC that gets attached has all the same icons used in the scrollpane.
This is the code on the MC that gets attached to the mouse when the mouse button is pressed and when it is released:
onClipEvent (mouseDown) {
startDrag("", true);
}
onClipEvent (mouseUp) {
this.gotoAndStop(1);
box_drop=this._droptarget.substr(0,8);
if(box_drop=="/body_mc"){
_root.body_mc.head_mc.gotoAndStop(_root.frame);
}
}
This is the code on the main timeline that detects what button you are clicking in the scrollpane and tells it what frame to jump to:
face_mc.tmp_mc.alien1_mc.onPress = function (){
frame = 3;
_root.mousedrag1_mc.gotoAndStop(frame);
};
This all seems to work fine for me and it seems to do what I need it to do. I hope this helps with your problem as well. Thanks.
CyanBlue
04-28-2003, 08:52 PM
Yes... That'll do the same thing that I have mentioned with the duplicate movieclip stuff, I guess... ;)
What I wanted to do was to click on one of those many buttons in one scrollpane and drag it and drop in the specific place in another scrollpane... I tried it with the duplicateMovieClip() function, but somehow it didn't work right...
So, what I did was to attach a new movieclip on the destination scrollpane when one of those menu items in the scrollpane has been pressed...
One more step it was, but it kinda worked... I'll try what you have next time when I revise the program...
Thanks for letting me know... ;)
red penguin
04-28-2003, 11:16 PM
Check out this: DeluxTree V6.1 (http://www.flashcomponents.net/components.cfm?nav=2).
Not sure if it's what you are looking for but it's pretty damn nice...
CyanBlue
04-29-2003, 12:24 AM
Thanks for the link, red penguin...
Yeah... I remember that component... I think I have seen the prototype of this a while ago, and it is nice to see this again in the fully working form... ;)
zedtag
11-10-2004, 12:36 AM
Ledge,
Do you have a fla with the code you have developed. I would like to see it in action as I am having trouble getting it to work on my end.
Best,
zedTag
zedtag
11-10-2004, 09:22 PM
Problem:
I am duplicating a mc from a scrollpane to the _root level. This allows me to have drag and drop functionality outside of the scrollpane. The problem I have now is that I am not sure how to specify the current x, y coords of the original mc within the scrollpane.
note: I am duplicating a mc outside of the scrollpane, because the scrollpane does not allow me to drag and drop outside of the scrollpane.
How can I get x, y coords from a movie within a scrollpane? I need these coordinates to tell a duplicated mc where to land.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.