Hi There,

I'm trying to retrieve a score from a database, hold it in a variable and then use it within other action script functions.

I have managed to retrieve the score froom the database just fine, however I am having a problem passing the result from the user_score variable to the score variable so that I can reuse the value throughout the rest of the action script.

Can anyone shed some light on what I'm doing wrong?

Please see the snippet below:

Code:
//Get The Score from the database
var variables:URLVariables = new URLVariables();
var request:URLRequest = new URLRequest();
request.method = URLRequestMethod.POST;
var loader:URLLoader = new URLLoader();
request.url = "http://www.operationclimatechange.com.au/layer/ws/xFlashScore.php";
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, completeHandler);
loader.load(request);


			
//Function to Get  Score of the logged in user and store it in a variable called "score"
function completeHandler(event:Event):void{
var user_score=event.target.data.score;
user_score=score;
trace(user_score);



// Score Scale //
//score user earns in missions
var score=0;
var total_balloons=1400;//total balloons available 1200
var balloons=0;// balloons earnt or lost in the game for each object
var user_balloons=score+balloons;//total ballons won or lost during game
var getPercentage=user_balloons/total_balloons;
this.balloonBar.height=getPercentage*100;
trace(score);
}