Flash startDrag()
- Started
- Last post
- 11 Responses
- mase
mucks up all my rollover functions.
I have something like:
target..onPress = function () {
startDrag(this);
}etc etc
and then I have rollover functions within that target mc that stop working when I use the startDrag
what's the work around for this?
ta!!!
- WeLoveNoise0
there is 2 dots after the target - maybe
- mase0
oh - up there? yes typo - but not the problem
- slappy0
Because your whole movieclip is becoming the button. Put another movieclip with drag area inside your draggable movieclip and use that to initiate the startDrag?
target.dragTargetMC.onPress = function () {
startDrag(_parent);
}
or something to that effect, I cant be arsed opening flash.
- mase0
nope.
I've now used hit test to get my rollOvers working - this is good, all pretty rollOvers again now - BUT my little rollovers are buttons/ links which just instigate the startDrag if you press them.
i suppose in AS3 one doesnt get this problem?
- fyoucher10
Didn't really think ur problem thru but...did you try resetting the rollover functions on release? might be a quick fix...i.e make a function that sets the rollovers for those clips. Another possible fix would maybe to try and NOT to start drag but use onEnterFrame to attach ur clip to the mouse position...
- slappy0
I'm sure I have had this issue, just cant remember what the fix was (Im at home so cant see my work files)
You could always use a setInterval and then set the mc position to mouse position instead of using startDrag.
- fyoucher10
function attachClip(clip:MovieClip):Void {
clip.onEnterFrame = function():Void {
clip._x = _xmouse;
clip._y = _ymouse;
}}
function detachClip..etc etc..myButton.onPress = function(){ attachClip(myClipToAttach_mc); }
myButton.onRelease = function() detachClip(etc etc)...- updateAfterEvent this, or it can be displeasing to the eye..mikotondria3
- mase0
F**K YEAH!
Mouse listeners saved my day. Im not really sure why but it all works again now:
var someListener:Object = new Object();
someListener.onMouseDown = function () {
startDrag(target.targetCenter)
};
Mouse.addListener(someListener);var someListener:Object = new Object();
someListener.onMouseUp = function () {
stopDrag();
};
Mouse.addListener(someListener);
- marcellos0
Mase!
Your the man! I was just about to pull out the last hair on my head and then I stumbled upon this post which totally saved the day!
I registered just to say F**K YEAH!
- mathswizard0
F**K YEAH!! i spend like 3 hours trying to solve this problem THANKS!!!
- cramdesign0
What slappy said was right in theory if not practice. I am on a machine without flash at the moment but that code should work. If not, it is just targeting that's the problem...
target.dragTargetMC.onPress = function () {
startDrag(this._parent);
}