| S | M | T | W | T | F | S |
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
I know I’m a little late to the party on this one but I finally cracked Flash Classes last weekend - yay!
To be honest there wasn’t really a whole lot to crack, just the definitions of private and public functions.
Essentially a public function will execute when the class is initialised, and a private function will wait to be called, and that’s all there is to it .
Try this out:
In a text editor create a file and name it TestClass.as
Type the following:
class TestClass{
public function foo(){
trace(“Hello from Foo”);
}
private function baa(){
trace(“Hello from Baa”);
}
}
Now create a new Flash document and save it in the same folder as TestClass.as
On frame one (or any other) type:
var myTestClass = new TestClass();
now publish your movie and you should get the output “Hello from Foo”
If you now add the following line:
myTestClass.baa();
publish your movie and you should get the output “Hello from Foo”, “Hello from Baa”
Yes, it really is that easy.