Variables in a function

Hello, i think this might be a really dumb question , but anywausss. how do i get one function to recognize some of the variables that are created or modified inside another function

Just make sure that the variables that you need consistency in both functions are not local to any of them (you can easily point out a local variable by searching for the keyword ***var ***before its name, inside the body of the function; or if it’s a parameter of the function). I’m also assuming you have both function defined in the same scope.


function sum(a:Number,b:Number):Void{
	total = a + b;
}
function showResult():Void{
	trace(total);
}
//
sum(2,5);
showResult();