Hi people!
I was creating a simple application that I thought it would not require a
preloader because it was very small at that time. I was writing it based on
a Main class, used as a Document class within Flash CS3 IDE.
At this time, the application becomes a little bigger and now it deserves a
preloader. I can't believe I'm not able to implement it. I'd tried to do it
in to ways with no success:
Tentative #1 - Implement the Loader Class, but first, going to the items on
my library and disabling the option, on Linkage, to enable items to have its
reference class to be imported at the first fame, and moving them to the
second frame. So, the following logic was applied:
a - at the Main method, stop the movie with "stop()" and start the loader
(ok, it goes fine)
b - at Event.Complete, gotoAndStop(2), where all the items was moved from
the first frame
c - calling an "startApp()" method to initialize
Problem: On a certain class method, called on a sequence after "startApp()",
where I set variables to be references to movieClips instantiated on the
Stage, I receive the following error:
Error #1009: Cannot access a property or method of a null object reference.
Debugging I could checkout the exact line of code and it's exactly what I
said. At that line I set a reference to a movieClip instance with a custom
class attached to it at the library, already disabled to have this class
imported at the first frame. Simple as "this.variableName =
instanceNameOnStage". "variableName" was correctly has his type already
defined to the imported custom class at the start section of the same. I
can't figure out what I'm doing wrong.
Tentative #2a - Create another movie and load it using Loader class, loading
the Main SWF into it. To do it, I reversed the Main movie class used as its
Document class to its original and self executing mode, without the loader
mentioned above, of course.
Problem: At the end of the load, I get the following error: Error #1009:
Cannot access a property or method of a null object reference.
at Main$iinit()
I believe it's trying to self execute the Document class constructor as it
does (expected) when standalone, but for some reason it can't.
Tentative #2b - Maybe, if I import the class I used as Document class at the
movie I'm trying to load, it could solve the problem?
Problem: NO, it doesn't work
Tentative #2c - What if I instantiate the loader content after its load with
a casting to set its correct class?
Problem: Same as tentative #1, now with more specific error message pointing
to the specific line where the error occured: 1120: Access of undefined
property menu. ("mymenu" is the movieClip instance name on the stage). Now
it seems to be trying to locate the instances at the same scope of my loader
class, because the reference "this" being executed on the main movie class
used as Document class.
If someone could help-me, I'll be very thankful.
As I try to find some help from you with this explanation, I'll try to write
some code to sample the problem.
Thanks a lot people!
Vicente Junior
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org