ActionScript Custom Class With Return Type?

Posted by TheDarkIn1978 on Stack Overflow See other posts from Stack Overflow or by TheDarkIn1978
Published on 2010-05-24T15:33:11Z Indexed on 2010/05/24 16:11 UTC
Read the original article Hit count: 128

i just know this is a dumb question, so excuse me in advance.

i want to essentially classify a simple function in it's own .as file. the function compares integers. but i don't know how to call the class and receive a boolean return.

here's my class

package
{
public class CompareInts
    {
    public function CompareInts(small:int, big:int)
        {
        compare(small, big);
        }

    private function compare(small:int, big:int):Boolean
        {
        if (small < big)
            return true;
            else
            return false;
        }
    }
}

so now i'd like to write something like this:

if (CompareInts(1, 5) == true). or output 'true' by writing trace(CompareInts(1, 5));

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about class