Why can't I see what is wrong with this code? onMouseDown

  • panzhuli
  • Graduate
  • Graduate
  • panzhuli
  • Posts: 135
  • Loc: Cleveland

Post 3+ Months Ago

anyone see why this won't work?

Code: [ Select ]
var start_x = 0;
var start_y = 0;

image_holder_mc.onMouseDown = function(){
  start_x = _root._xmouse;
  start_y = _root._ymouse;
  startDrag(this, false, -350, -350, 350, 350);
  trace ("start x::" + start_x + ", " + start_y);
}
image_holder_mc.onMouseUp = function(){
  if (_root._xmouse == start_x && _root._ymouse == start_y){
        //they didn't drag
       gotoAndPlay("second");
  }else{
           stopDrag ();
    }
}
  1. var start_x = 0;
  2. var start_y = 0;
  3. image_holder_mc.onMouseDown = function(){
  4.   start_x = _root._xmouse;
  5.   start_y = _root._ymouse;
  6.   startDrag(this, false, -350, -350, 350, 350);
  7.   trace ("start x::" + start_x + ", " + start_y);
  8. }
  9. image_holder_mc.onMouseUp = function(){
  10.   if (_root._xmouse == start_x && _root._ymouse == start_y){
  11.         //they didn't drag
  12.        gotoAndPlay("second");
  13.   }else{
  14.            stopDrag ();
  15.     }
  16. }


MC is definitely named image_holder_mc. When I trace out image_holder_mc._x it knows it...

What am I just not seeing?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • panzhuli
  • Graduate
  • Graduate
  • panzhuli
  • Posts: 135
  • Loc: Cleveland

Post 3+ Months Ago

by the way - it works if I put it in the action window of that mc. weird?
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

Not sure, the only "onMouse..." I ever use is "onMouseMove".

I use "onPress = " & "onRelease=onReleaseOutside = " in place of the events you've got there.

I seem to remember having similar strange issues when I tried the mouse[Down|Up] events a few years ago & stayed away from them ever since.
  • panzhuli
  • Graduate
  • Graduate
  • panzhuli
  • Posts: 135
  • Loc: Cleveland

Post 3+ Months Ago

i just tried your suggestion. still dead. so so weird!
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

this.startDrag(false, 1, 2, 3, 4) instead maybe ?
  • panzhuli
  • Graduate
  • Graduate
  • panzhuli
  • Posts: 135
  • Loc: Cleveland

Post 3+ Months Ago

could it be because the mc is behind a mask? is that possible?
  • zhaojany
  • Student
  • Student
  • User avatar
  • Posts: 79

Post 3+ Months Ago

it works well in my player.but " gotoAndPlay("second");" never work.

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 13 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.