Skip to main content
Inspiring
April 9, 2009
Answered

I think my code is poorly parsed?

  • April 9, 2009
  • 1 reply
  • 372 views

I'ts been a while and when I wrote this code, It worked, but something about it seems wrong:

onEnterFrame = function(){
bucket_mc.onPress = function(){startDrag(this);}
bucket_mc.onRelease = function(){stopDrag();}

}

like it's too bulky or something. Am I just imagining this?

This topic has been closed for replies.
Correct answer kglad

you don't want to defined your onPress and onRelease repeatedly.  try:

bucket_mc.onPress = function(){
this.startDrag();  // startDrag(this) is ok, but not preferred over this.startDrag();
}
bucket_mc.onRelease = function(){
stopDrag();
}

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
April 9, 2009

you don't want to defined your onPress and onRelease repeatedly.  try:

bucket_mc.onPress = function(){
this.startDrag();  // startDrag(this) is ok, but not preferred over this.startDrag();
}
bucket_mc.onRelease = function(){
stopDrag();
}