Finally, FAME!

I finally found some more time to play with FAME and got Flashout working (thanks to Alex's tip on using the -clean option to make Eclipse see the plugin on my Windows machine.) Skimming through Carlos Rovira's excellent introduction to FAME (Towards Open Source Flash Development) was very helpful but I did notice something in the test code that I would do differently.

In the article, the sample document class Test looks like this:

ActionScript:
  1. class Test {
  2.  
  3. private var scopeRef:MovieClip;
  4. function Test(scope:MovieClip) {
  5. scopeRef = scope;
  6. // --- Creates a 'tf' TextField size 100x600 at pos 100, 100
  7. scopeRef.createTextField("tf", 0, 100, 100, 800, 600);
  8. // --- Write some text into it
  9. scopeRef.tf.text = "Hello FlashWeek!!!!";
  10. }
  11. // --- Main Entry Point
  12. static function main() {
  13. var test:Test = new Test(_root);
  14. }
  15. }

The static main function (the entry point) instantiates the Test class' constructor and passes a reference to _root, which the Test instance uses when creating the text field. I would do this a little differently, like this:

ActionScript:
  1. class Test extends MovieClip
  2. {
  3. private var tf:TextField;
  4. function Test(scope:MovieClip)
  5. {
  6. // Redefine scope
  7. this = scope;
  8. // Creates a TextField sized 100x600 at pos 100, 100
  9. createTextField("tf", 0, 100, 100, 800, 600);
  10. // Write some text into it
  11. tf.text = "Hello FlashWeek!!!!";
  12. }
  13. // Main Entry Point
  14. static function main()
  15. {
  16. var test:Test = new Test(_root);
  17. }
  18. }

The nice thing about this doing things this way is that your Test class actually does extend MovieClip and you retain the ability to define your stage elements as members of your class and thus take advantage of compile-time error checking.

By the way, FAME *is* very cool indeed!

Comments