TwelvestoneFlash

startdrag/stopdrag weirdness....need help plz.


Sign in

  • Waiting for Godot ( 730 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 5.1 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.9 k posts )
    general front end design an...
  • Back End ( 9.7 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
azninvasion2000
 
2003-01-28

Hello,

Here what has been vexing me for a while, was wondering if you all ever encountered this problem:

Simple drag and drop code on a slider, it looks like this:

//left,top, etc.. be copnstraints for the slider

on (press) { startDrag("", false, left, top, right, bottom); _root.dragging = true; } on (release) { stopDrag(); _root.dragging = false }


Now here is the problem. 99% of the time, it will work fine, but if you click and drag the wrong way somehow, it will follow the x position of the mouse, and stay locked on it, (i constrained the movement to be only on the x axis) and the program fails to recognize it as a button, and you cannot click any other buttons in the movie during the "locked" period, resulting me in closing the window as my only escape to this shit.

Anyone else encountered this problem before? I can't figure it out. I am willing to post an open source example of what I'm talking about if you would like to see exactly what I'm struggling with here.. Possible mx bug?

Please reply with your thoughts, and possible solutions to this vexing issue.....

GGRRRRRR!!!!! lites a cig

-azn

garyalfred
 
2003-01-28

on (release,releaseOutside) { stopDrag(); _root.dragging = false }

The problem is that you drag out of the click area and it fires the releaseOutside event instead of the release event.

bit-101
 
2003-01-28

on(release, releaseOutside)

will solve it.

oop. beat me to the punch.

garyalfred
 
2003-01-28

see.. even bit-101 says so k

sakri
 
2003-01-28

nice one!

I've ran into that a few times, and I ended up coding my own version of the drag...

:trout:

azninvasion2000
 
2003-01-28

releaseOutside doesn't work, the bug is still there w/releaseOutside.... :(

sakri, would you be willing to share your stop/start code? No worries if not.. Thanks for the responses..

Any other possible solutions? Should I post the source? You will all probably get a good laugh at the way I code things... (messy)

Thanks again for the prompt responses, you guys roxor my boxor.

-azn

garyalfred
 
2003-01-28

yeah post the source.. maybe it is something else.

sakri
 
2003-01-28

I'll dig it up tomorrow morning, I'm heading home now...

later on

sakri
 
2003-01-29

so, that script turned out to be harder to extract than to rewrite a simplified version of it...

you can just cut and paste this into your flashMX and testmovie:

MovieClip.prototype.draw_square=function(x,y,w,h,col){ this.lineStyle(0,0xFFFFFF,0); this.beginFill(col,100); this.moveTo(x,y); this.lineTo(x,y); this.lineTo(x+w,y); this.lineTo(x+w,y+h); this.lineTo(x,y+h); this.lineTo(x,y); this.endFill(); }

//create scroll background and scroller clips createEmptyMovieClip("scroll_bg",1); scroll_bg.draw_square(0,0,20,200,0xCCCCCC); scroll_bg.createEmptyMovieClip("scroller",1); scroll_bg.scroller.draw_square(0,0,16,16,0x999999); scroll_bg.scroller._x=2; scroll_bg.scroller._y=2;

//use onMouseDown instead of "button" actions to avoid nested buttons problems //use MouseMove instead of enterFrame to avoid useless extra calculation... scroll_bg.onMouseDown=function(){ this.onMouseMove=function(){ if((_xmouse>this._x && _xmousethis._y && _ymouse<this._y+this._height)){ this.scroller._y=_ymouse-this.scroller._height/2; }else{ this.onMouseMove=null; } } }

scroll_bg.onMouseUp=function(){ this.onMouseMove=null; }

it's far from perfect, but you won't get a "never ending drag"... what you need to do is add a bunch of parameters or "limitations" to make it work like a normal scroller...

k

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneFlash

startdrag/stopdrag weirdness....need help plz.