|
-
[RESOLVED] TypeError: Error #1009:
I am having a problem loading a swf into a movieclip inside another swf. I keep getting this error message:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at contact_fla::MainTimeline/frame1()
after googling the error, I have come to suspect that I am trying to load the swf before the stage is ready for it. Although, I load another swf and it loads fine. How can I verify which part of my movie is causing the problem?
-
Senior Member
Do trace statements of various objects:
trace(stage);
When you get null you found it.
When you get no trace then the error occurred earlier in the script.
When you get a value other than null the error is later in the script.
- The right of the People to create Flash movies shall not be infringed. -
-
thanks for replying, Cancer. I put a trace(stage) statement on the 1st line of my loader swf and the 1st line of my loaded swf. The loader swf traces "[Object Stage]" the loaded swf traces "null" then the 1009 error comes up. I moved the loader statement to the end of the calling script and still get the same error.
The stage has items on it from the original swf and the loaded swf works independently of the other swf. So, how could the stage be null if its already displaying text, buttons and graphics?
-
ahh..wait. it's not just stage tracing null. it's a lot of things. changing stuff now. Hang on for an updated post.
Thanks for the reply.
-
alright! Cancer you're the man! i have 2 statements that reference stage which were causing the problem.
var tfInit:int=stage.stageHeight/4; and another variable.x statement. both reference the stage. I have hard coded the #s in and it works.
Now, what can i do to correct it? is it because I am referencing "stage" and the stage in 1 swf is 900x600 and in the other is 600x600?
Thanks for your help. I appreciate it greatly.
-
Senior Member
When you say reference to stage do you mean from the loaded swf? I don't know your script or what you are exactly doing.
- The right of the People to create Flash movies shall not be infringed. -
-
i have 2 SWFs. (main and contact) main.swf loads the contact.swf. main.swf is 900x600 and contact.swf is 600x600. contact.swf loads into main.swf at x=300, y=0.
contact.swf then references it's own stage dimensions (600x600) stage.stageHeight and stage.stageWidth to place textFields and buttons. (i.e. myVar.x=(stage.stageWidth-myVar.width)/2
What I did to correct the error was to go in and instead of stage.stageWidth i used 600 and instead of stage.stageHeight I used 600. Basicly giving me the stage width and height hardcoded.
Is there a way in my calculations inside the contact.swf to reference the stage since this is what is causing the problems? it's not a big deal other than the fact the placement of my elements are based on the stage size of the contact.swf.
-
Senior Member
When you reference the stage from your child movie once it is loaded, it is the stage of the parent automatically.
- The right of the People to create Flash movies shall not be infringed. -
-
Makes sense after you experience it. Thanks again, Cancer. I always appreciate a good lesson.
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
|