Here is an example. Assuming that I have 2 classes: Main.as and Calculator.as
I want to import my Calculator.as into my Main.as so I could use its functions.
//Calculator.as
package {
public class Calculator {
public function Calculator(){}
public function tripleValue(a:int):int{
return a+a+a;
}
}
}
//Main.as
package {
public class Main {
public function Main(){
//tripleValue(8); //how to call the function "tripleValue" in Calculator.as
}
}
}
edit: I found the solution, but not sure whether its efficient or not.
//Main.as
package {
public class Main {
public function Main(){
var abc:Calculator = new Calculator();
var i = abc.tripleValue(8);
trace(i);
}
}
}