[mtasc] strict typing and the __Packages trick...

Michelangelo Capraro michelangelo at tinlion.com
Wed Sep 7 07:43:00 CEST 2005


Thanks for the response David,
Unfortunately, I am using the -strict option and I think mtasc will throw an error if I leave mc untyped.

Thanks again


== Tin Lion Creative ==
Michelangelo Capraro
tinlion.com 

skip-intro.org   hopbot.com   number-9.com 


-----Original Message-----
From: David Rorex [mailto:drorex at gmail.com] 
Sent: Tuesday, September 06, 2005 9:22 PM
To: MotionTwin ActionScript2 Compiler List
Cc: Michelangelo Capraro
Subject: Re: [mtasc] strict typing and the __Packages trick...

What about something like this:

var mainNav:com.blah.Nav;


var mc = movieRoot.attachMovie(com.blah.Nav.symbolName, "mainNav", 2);
manNav = mc;

That should work I think, as 'mc' is untyped, so it wont complain
about it on either of the two assignment statements.

-David R

On 9/6/05, Michelangelo Capraro <michelangelo at tinlion.com> wrote:
> Hello all,
> I have a class that I am using Peter Hall's __Packages hack so to not have to have library symbols for my MovieCLip-derived classes (http://swfoo.com/archives/000054.html). I am trying to instantiate a class using this and attachMovie. Usually to get passed MTASC (using -strict) I do this:
> 
> 
> var mainNav:MovieClip;
> 
> mainNav = movieRoot.attachMovie(com.tinlion.Nav.symbolName, "mainNav", 2);
> 
> 
> however, for a current project, I want the mainNav variable to be properly typed to the com.tinlion.Nav class so I can reap the benefits of code completion:
> 
> 
> var mainNav:com.tinlion.Nav;
> 
> mainNav = movieRoot.attachMovie(com.tinlion.Nav.symbolName, "mainNav", 2);
> 
> 
> What happens is I get an error because attachMovie returns a MovieClip and not a com.tinlion.Nav. my solution was to do this:
> 
> 
> var mainNav:com.tinlion.Nav;
> 
> mainNav = com.tinlion.Nav(movieRoot.attachMovie(com. tinlion.Nav.symbolName, "mainNav", 2));
> 
> 
> is there a better way and/or is this the right way to handle this? Can you please cc me off the list also so I don't miss the answer. Thanks in advance
> 
> 
> 
> 
> == Tin Lion Creative ==
> Michelangelo Capraro
> tinlion.com
> 
> skip-intro.org   hopbot.com   number-9.com
> 
> 
> 
> --
> MTASC : no more coffee break while compiling
>






More information about the mtasc mailing list