Action Script 3 functions

Out of context: Reply #4

  • Started
  • Last post
  • 13 Responses
  • Pupsipu0

    to call countNow() from a different file, it has to be

    public function countNow(),

    and you have to say in that other file

    import Counter;

    var cnt:Counter = new Counter()
    cnt.countNow()

    if you want to run countNow() from inside that Counter class, you say

    public function Counter() {
    // NO CLUE
    countNow() //and keep countNow private.
    }

    it's not really AS3 vs AS2, it's OOP vs Procedural. People were doing the same crazy shit in AS2 with prototypes and classes and it was a big mess to make things OOP.

View thread