So I’m trying to call a function from the onLoad method of my sound object and something is wrong with my scope. I’m not sure how to solve this because I can’t assign it a listener and I’m not sure what else to do.
see my example…
class com.infect.SoundController{
private var soundObject:Sound
private var soundMC:MovieClip
public function SoundController(){
trace("SoundControl Initialized")
soundObject = new Sound()
//soundObject.owner = this
soundMC = _root.createEmptyMovieClip("soundMC",_root.getNextHighestDepth())
soundMC.soundObject = soundObject
loadNewSound("mysound.mp3")
}
private function loadNewSound(newSoundFile):Void{
soundObject.onLoad = function(success){
trace("SoundControl.Events.soundLoaded()" + this)
if(success){
//I want to call fadeSoundIn() from here but I can't due to scope, please help
fadeSoundIn()
}else{
trace("I hate sounds")
}
}
soundObject.loadSound(newSoundFile, true)
}
private function fadeSoundIn():Void{
trace("SoundControl.fadeSoundIn()")
}
}
I’m stumped…
:h: