February 2010
M T W T F S S
« Jan   Mar »
1234567
891011121314
15161718192021
22232425262728

Get value of variable from firstFunction to secondFunction

Problem
Need get value of variable in secondFunction.

Solution
Using return command.

Detailed explanation:

function firstFunction():Number{

var a:Number = 2;

return a;

}

function secondFunction():void {

var b = firstFunction();

trace(b);

}

secondFunction();

Source:
return

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>