I've exhausted Google for answers, so I'm turning to the pros...
Basically I have a loader in Main.swf and I'm loading Index.swf into it then setting the loader width/height to the full size of the users stage.
Within Index.swf I am now trying to set items on the stage according to the width/height. I've written the code to do the positioning but when I run Main.swf it throws:
TypeError: Error #1009: Cannot access a property or method of a null object reference. at Index()
What I'm wondering is...how the heck can I pass the parents stage dimensions? Second of all, if the stage resizes, how am I going to fix the position of the elements in the child?
I was thinking of two ways, but don't quite know how to do it...the first is to pass data via the loader, but where would I pick that data up in the child? Second of all using LocalConnection...but I only know how to call functions...does that mean I have to create a function in the child to receive the new dims?
What makes you think it's a problem with resizing? Flash was nice enough to tell you what the actual problem is (which from the error message is not a resize issue) and I'm sure it also told you the line number at which the problem occurred. You should take a look at what's happening there.
Just as a rule try keeping the constructor empty except for the Doc class and make separate function, which you call once the movie is loaded. You should do traces to see what is null in the index movie. My guess is it may be stage in the constructor. Also you don't need to write "this" any more. In AS3 any property or function if not otherwise defined will automatically refer to the class. It makes coding easier and reduces code.
Since I cannot reproduce the movie I can only guess.
- The right of the People to create Flash movies shall not be infringed. -
The question is how the heck do I call it AFTER the constructor is called. My initial thoughts are...use an Event and somehow have it trigger it onComplete, but how do I add an event for the current swf?... lol