PDA

View Full Version : Help with my function


gsinibaldi
07-27-2008, 05:57 PM
I have a number of draggable movieclips that get dropped into particular containers. I'm trying to track when the user has finished dropping all the movieclips then send the user to a different frame.

incrementVar is a number that gets incremented each time the user drops a mc. allDone is my function testing to see what incrementVar is. There are 24 buttons in all so when incrementVar is equal to 24 i want the playhead to advance to a new frame.

my code:

//variable for knowing when all buttons have been dropped
incrementVar = 0

//function to test if allDone
function allDone(){
if(incrementVar == 24){
gotoAndPlay("end")
trace("alldone has fired")
}
}
//first button-----------------------------------

ath_pt_mc.onPress=function(){
this.startDrag();
this._rotation += 90;
}
ath_pt_mc.onRelease=function(){
stopDrag();
if(this.hitTest(ath_part_target_mc)){
this._visible = false;
bar_ath_pt_increment_mc._height = bar_ath_pt_increment_mc._height+12;
incrementVar++
trace(incrementVar)

}else{
this._x = 40;
this._y = 91;
this._rotation -= 90;
}allDone()
}

ath_pt_mc.onReleaseOutside = ath_pt_mc.onRelease;

//2nd but-----------------------------------------------------------------------------------
non_ath_pt_mc.onPress=function(){
this.startDrag();
this._rotation += 90;
}

non_ath_pt_mc.onRelease=function(){
stopDrag();
if(this.hitTest(non_ath_part_target_mc)){
this._visible = false;
bar_non_ath_pt_increment_mc._height = bar_non_ath_pt_increment_mc._height+12;
incrementVar++
trace(incrementVar)
}else{
this._x = 40;
this._y = 111;
this._rotation -= 90;
}allDone()
}
non_ath_pt_mc.onReleaseOutside = non_ath_pt_mc.onRelease

What am i doing wrong?

Thanks

gsinibaldi
07-28-2008, 06:14 PM
Any ideas?