I’m just wondering about the difference between using an external .as file as a Document Class vs importing it via some timeline code like:
import Pixoid;
var pixMC:Sprite = new Pixoid();
pixMC.x = 0
pixMC.y = 0
addChild(pixMC);
one thing I have noticed is that altho the above timeline code works certain objects return the “null object” error.
for example if in my Pixoid.as file I have any references to the ‘stage’ object
ex:
pxRow = stage.stageWidth / 10;
it returns
"Error #1009 Cannot access a property or method of a null object reference."
so, is there any advantage to using the import strategy vs the Document Class one? should I not worry about it and continue on my happy way with the Document Class?
I’m asking because I first ran into this problem with Flex and had to do some kludges to get around it - defining UIContainer object etc - but now that I have found it to also exist in Flash, I’d love an explanation as to why it works like this. when I posted about this problem in the Flex forums kindly gurus gave me the workaround but I never really understood the explanations as to why it worked.
thanks in advance.
bvb