Sounds like a timing problem to me.
Couldn't you let the loaded movie call a method on its parent first,
to make sure it is completely loaded?
Cheers
Ralf.
On Fri, Jun 27, 2008 at 9:43 AM, Trevor Rundell <
kneebraces22@...> wrote:
> I'm a beginner to MTASC, but I've been programming Flash and Actionscript
> for many years years now. I've been trying to convert a few projects to
> MTASC as of late, but have encountered a few road blocks. Here's the gist
> of what I'm try to do.
>
> We have a swf that gets loaded into a client's application at runtime. When
> our swf finishes loading the client calls a certain method in it that allows
> us to access some of their apis. When I build this using the Flash IDE it's
> really easy. We have a movie with a single frame. The action on the frame
> is something like this...
>
> function setInterface(o:Object):Void {
> // do some stuff in here
> }
>
> My problem is that using MTASC I can't replicate this functionalty. I wrote
> a Utility class which should boil down to the same thing as my fla when it's
> compiled. I'll outline the basic shell of my as file below...
>
> class Utility {
>
> private static var app:Utility;
>
> function Utility(mc:MovieClip) {
> mc.setInterface = Delegate.create(this, setInterface);
> // constructor stuff
> }
>
> public static function main(mc:MovieClip):Void {
> app = new Utility(mc);
> }
>
> public function setInterface(o:Object):Void {
> trace("THIS METHOD IS NEVER CALLED");
> // do some other stuff here
> }
>
> }
>
> No matter where I put the setInterface method it never seems to get called.
> I also tried defining it like mc.setInterface = function(o:Object) {
> trace("THIS DOESN'T GET CALLED EITHER") }; and there was no difference.
>
> I've confirmed that our contructor does run prior to when their call would
> be expected using traces, but I'm stumped as to why this wouldn't work.
> Debugging with trace(mc); confirms that mc is the correct movie clip in the
> clients application (loaded at _level0.utilities.u0 in both cases). Does
> anyone else have any suggestions as to why this might not work?
>
> Thanks.
>
> -t
>
> --
> MTASC : no more coffee break while compiling
>
--
MTASC : no more coffee break while compiling