A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: stopDrag not working..how come?

  1. #1
    victory is mine!
    Join Date
    Oct 2001
    Posts
    156

    stopDrag not working..how come?

    I've got a clip that runs a drag function when a 'zoom in' button is pressed. that all works well and when the image zooms in, i can click and drag it all around. Now, when i click the 'zoom out' button, i want to turn off the drag function but i can't seem to figure out how. The function is defined in a frame on the main timeline:
    Code:
    function dragMe(target_mc) {
      target_mc.onPress = function() {
        this.startDrag(false, -60, -40, 440, 400);
      };
      target_mc.onRelease = function() {
        this.stopDrag();
      }
      
    }
    and the 'zoom in' button initiates the function:
    Code:
    on (release) {
    	_root.map_mc.scaleTo(200,0.5);
    	_root.dragMe(_root.map_mc);
    }
    So, on the 'zoom out' button, i want to cancel the drag function. So I've got:
    Code:
    on (release) {
    	_root.map_mc.scaleTo(100,0.5);
    	_root.map_mc.slideTo(249,264, 0.5);
    	_root.map_mc.stopDrag();
    }
    but the stopDrag(); doesn't seem to affect the movieclip. i can still drag it all around after i press the button. what am i missing?
    i think i think too much, i think.

  2. #2
    Senior Member
    Join Date
    Feb 2001
    Location
    On the fifth floor.
    Posts
    1,202
    When you press on the "zoom out" button you defiantly stopDrag. BUT...! when you press on the "map_mc" you call the function dragMe again. So the code on the "zoom out" button should be:
    Code:
    on (release) {
    	_root.map_mc.scaleTo(100,0.5);
    	_root.map_mc.slideTo(249,264, 0.5);
    	delete _root.map_mc.onPress;
    }

  3. #3
    victory is mine!
    Join Date
    Oct 2001
    Posts
    156

    sweeeet.

    Doh! Why couldn't i think of that?? Thanks for the help...works like a charm!

    i do have another question if anyone cares to take a stab: i was thinking of changing my 'zoom in' button to zoom incrementally, as in...click once, zooms by 50%. click again, zooms in another 50%, etc... BUT, this throws my draggable boundries all to crap. Is there a way to have the draggable boundries change accordingly?

    thanks!
    i think i think too much, i think.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center