Can anyone tell me why the delegation in the following class is not working? i just don’t get it. i really hate scope.
/**
This code defines a custom class that all the stage elements and buttons
*/
// Import Built-In Classes
import mx.utils.Delegate;
import mx.transitions.Tween;
import mx.transitions.easing.*;
// Class to Load SubStages
class buildSite {
// Variable Definations
var Container:MovieClip;
var ContentLoader:MovieClipLoader;
var Listener:Object;
var Preloader:MovieClip;
var setSeasonVar:Object;
// Construction function to begin building of layout
public function buildSite() {
// Variable Definitions
setSeason();
}
// function to set the correct season and season navigation options
private function setSeason():Void {
// Declare Variables and correct scope
setSeasonVar = new LoadVars();
Listener = new Object();
setSeasonVar.addListener(Listener);
// Wait for data to be received then run handler function
Listener.onLoad = Delegate.create(this, onSeasonLoadInit);
// Begin loading the XML document.
setSeasonVar.load("http://localhost/script/setSeason.php");
}
private function onSeasonLoadInit():Void {
// Declare Variables and correct scope
var i:Number;
var numSeasons:Number;
var thisSeason:String;
// Set variables & display the data
numSeasons = this["numSeasons"];
thisSeason = this["Season"];
// Check
trace(numSeasons);
// Update text box
_root.txt_tempBox.text = thisSeason;
}
}