Hello everybody. I'm having problems with the MovieClipLoader class. The onLoadInit is broadcasted before the target is indeed initialized. Searching about this, I founded at the macromedia documentation that other developers are having the same problem, but nobody sends a answer. Does anybody know how to resolve this?! Thanks. CT.
Hi, Kglad. As I said, the problem is that the MovieClipLoader broadcast the onLoadInit event before the loaded movie is completely initialized when this have many methods. For exemple, I created a movie with many methods called Movie1.swf Then I created de Main.swf At the Main.swf I load the Movie1.swf with MovieClipLoader. What is happening is that on the onLoadInit event I traced any of the methods and the return is undefined. But if I delay, it returns [type Function]. Was I clear? If not, I can upload a sample. Thanks, CT.
All the methods are in an AS file that is included in the first frame of Movie1.swf, but no methods are using _root.methodName What I tried is like the following sample: At the main.swf I have: var obList:Object = new Object(); obList.onLoadInit = function(ob) { trace (ob.anyMethod); } var mcLoader:MovieClipLoader = new MovieClipLoader() mcLoader.addListener(obList); this.createEmptyMovieClip("movie",this.getNextHighestDepth()); mcLoader.loadClip("Movie1.swf",movie); Doing that, the return is undefined, what means that the anyMethod at the Movie1.swf is not yet initialized. Obs.: Excuse me by the poor english, I'm not American, and learned English by myself.
if you have a function (anyMethod) defined on the main timeline of Movie1.swf, use: var obList:Object = new Object(); obList.onLoadInit = function(ob) { trace (ob.anyMethod());
The question is that the method don't exists yet. When I traced, I really tried to trace de object and the return should be [type Function] If I trace like trace(ob.anyMethod()); I will have the return of the function, but I traced the Function object and it return undefined, meaning that it not exists. Otherwise it return [type Function] As I said, if I delay with a setInterval, for exemple, it traces [type Function], meaning that at this moment the movie is completely initialized.
post a link to the flas that display the issue.
i dont believe there is a problem with onLoadInit(). i suspect you're trying to access something that isn't available when the first frame of the main timeline in your external swf loads. post a link to your flas if you think there is something that is defined in the first frame of the main timeline and not available onLoadInit().
As you mentioned this subject, at trust, the error occurs when I have a Shared Library at the external movie. I founded a solution by loading the same shared library at the main movie and using a textbox to force the load of the SL at the first frame of the main movie. It works, but that other solution is more inteligent and is the solution that the own Flash components uses. I will upload the files and contact here. CT.
Don't see what you're looking for? Try a search.
|