[TxMt] AS2- How do I target my root MC when using MTASC?

Alistair Colling alistair.colling at fpp.net
Wed May 28 14:54:53 UTC 2008


Thanks for your reply Ale, I've got this working by placing this code  
in my fla then publishing the swf:

import Foo;
var myF = new Foo(this);

I now can publish from Textmate, debug in XTrace and add graphic  
elements to my FLA, its great ! :)
Thanks,
Ali




On 23 May 2008, at 22:46, Ale Muñoz wrote:

> If you are using the -main flag in MTASC (if you are using the AS2
> bundle it's on by default) your main() method will be called with a
> parameter, like this:
>
> class YourApp {
>   static function main(mc:MovieClip){
>     // mc is the Stage, equivalent to _root most of the time.
>   }
> }
>
> Thus, you can target _root by setting a variable in your class when it
> is initialized.
>
> Here's the skeleton for 99% of my AS2 projects:
>
> class Foo {
>   var _timeline:MovieClip;
>   function Foo(timeline){
>     _timeline = timeline;
>   }
>   static function main(tl:MovieClip){
>     var app:Foo = new Foo(tl);
>   }
> }
>
> For more info, I'd suggest checking the MTASC list:
> http://lists.motion-twin.com/mailman/listinfo/mtasc
>
> About MTASC not being developed anymore... the project is alive, and
> the maintainer is rather active on the mailing list. The thing is
> MTASC is pretty much finished (it's solid as a rock, fast, and no
> known bugs exist on the code) and AS2 is not going to change, so
> there's no reason for development to "happen" : )
>
> If you already know AS2 or need to mantain "old" code, there is no
> reason not to use MTASC.
>
>
> --
> Ale Muñoz
> http://sofanaranja.com
> http://bomberstudios.com<ATT00001>


--------------------------------------------------------------------------
Alistair Colling
Interactive Developer

FPP Brand Communications (Newcastle upon Tyne)
The Courtyard
Dinsdale Place
Sandyford
Newcastle upon Tyne NE2 1BD
Telephone: +44 (0)191 261 6662
Fax: +44 (0)191 233 2511

This transmission is confidential and intended solely for the person or organisation to whom it is addressed.
It may contain privileged and confidential information. If you are not the intended recipient, you should not
copy, distribute or take any action in reliance on it. If you have received this transmission in error, please
notify the sender at the e-mail address above. 
FPP Design Limited. Reg. Office: The Courtyard, Dinsdale Place, Sandyford, Newcastle upon Tyne NE2 1BD. 
Registered Number 3775564. Registered in England and Wales. Visit our website at http://www.fpp.net/



More information about the textmate mailing list