[mtasc] createClassObject() and object initialization.
Rafael G
contacto at rafaelguedez.com
Fri Aug 26 04:13:07 CEST 2005
This work for me:
public static function main(target)
{
target.onEnterFrame = function()
{
delete target.onEnterFrame;
var app = new Application(target);
}
}
But just now this arise another problem, I'm using an empty mc with a
MovieClipLoader to make a preload for my Application.swf with the UI
Components. Well, everything worked well until I add the DateField
and ComboBox component, some components don't work when come from a
loaded mc.
For that reason I had to comment all inside the main function and
create another static function with another name because "main" is
executed before the components have been loaded. In the .fla side you
must add all your components to the stage in a diferent frame from 1,
uncheck "Import in the first frame" in each one and set in Publish
Settings/Flash/ActionScript/Settings to a previous frame where you
put the components.
This is the best way to do a preload for the components and make it
work?
Thanks and sorry for my english ;)
Rafael
On Aug 25, 2005, at 4:57 PM, Chris Hill wrote:
> I've noticed that there are a few posts regarding createClassObject
> not working in Mtasc but working in MMC. The components are in the
> library, the flags are correct, etc. but it just won't work. I ran
> into this problem myself and couldn't seem to find a good answer to
> my problem. All I was getting was a rectangle for my ComboBox. As
> it turns out, the problem was that the movie clip(i'm guessing
> _level0) was not fully initialized before mtasc ran the
> createClassObject() call. When you put the same function in the
> first frame of the movie and run it from MX2004 it initializes
> correctly. The reason this hasn't happened to me earlier is because
> I am usually loading some xml or something before initializing.
>
> So how does this work? Is mtasc putting the main function call
> before the first frame is initialized, and mx2004 is putting the
> function call inside the _root's first frame? Why not put the main
> () call in the first frame of _root?
>
> Secondly, what's a good workaround? Currently I'm using setInterval
> to wait 100ms before initializing, but this is sort of hackish.
>
> Thanks
> Chris
>
> --
> _________________________________________
> < __ __ ____ >
> < | | \/ ___\ Chris Hill >
> < | | / /_/ > ubergeek at ubergeek.tv >
> < |____/\___ / http://ubergeek.tv >
> < /_____/ The Smell of Geek! >
> <----------------------------------------->
>
> --
> MTASC : no more coffee break while compiling
>
>
>
More information about the mtasc
mailing list