flash actionscript:
I have come across a bizarre bug. I put the code into a frame (originally in
an .as file), and then I put a component button (MX 2004 Pro) onto the stage.
I then run the program. I press a bunch of keys and nothing happens (no new
traces), which is completely to be expected. BUT!!! If I press the component
button, then all of a sudden I am getting the traces from this function if I
press any buttons. Am I overwriting an undocumented array function? I thought
checking if it was undefined would solve that. Any ideas
if (Array.prototype.sortEquals == undefined)
Array.prototype.sortEquals = function(passedArray:Array,
passedSortFunction:Function, passedORedOptions, bSameLength:Boolean)
var tempThisWorkingArray:Array = new Array()
var tempPassedArray:Array = new Array()
tempThisWorkingArray.copy(this)
tempPassedArray.copy(passedArray)
if (passedSortFunction)
tempThisWorkingArray.sort(passedSortFunction, passedORedOptions)
tempPassedArray.sort(passedSortFunction, passedORedOptions)
} else
tempThisWorkingArray.sort(passedORedOptions)
tempPassedArray.sort(passedORedOptions)
trace("~~~")
trace("from the fruit")
trace("tempThisWorkingArray = "+tempThisWorkingArray)
trace("tempPassedArray = "+tempPassedArray)
trace("~~~")
var isEqual:Boolean = tempThisWorkingArray.equals(tempPassedArray,
bSameLength)
return isEqual
}
trace("Array.prototype.sortEquals created")
} else
trace("Array.prototype.sortEquals already exhists")
--bb