|
-
[CS3] [Question] Elements on scene not loaded before constructor is called
Hi,
This not totally related to games development, but I think will likely be a common Game Dev problem. I am fairly new to Flash, but have not found through google searching any concrete answers.
I have written a game that runs in a single frame. The frame contains some elements (a button, some score textfields etc) and the rest of the game is built up using AS3.
Now I have completed the game engine, I wanted to put in a loader, a start game frame (so that the game doesn't start immediately) and a frame at the end to show their final score.
So, I did the following...
- Converted all the elements on the stage to be a movie clip
- renamed the AS3 class to the name of the movie clip rather than using the document class (so the ActionScript was not called immediately on startup)
- created a new keyframe and placed the Game movieclip on the frame
This all seems to have had the desired effect (the script is called when frame 2 starts), but I get AS run time errors saying that the button and text fields are null or cannot be found. Reading around the internet, it appears that this is because the items on the stage have not loaded by time the actionscript is called.
I would rather not have to build up the stage programmatically in AS3 (otherwise what is the point in using Flash, I may as well just use Java to write games!).
Any help would be greatfully received.
Thanks
Codemwnci
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|