I don’t understand why I am getting this error…
package Classes {
public class HomePage extends Sprite {
public function HomePage():void
{
buildLogo();
}
public function buildXML():void
{
var xml:XML =
<navHolder>
<nav id=“Blog”/>
<nav id=“Store”/>
<nav id=“Projects”/>
<nav id=“Information”/>
</navHolder>;
}
public function buildLogo():void{
color.color = 0x000000;
LogoBg = drawSquare(200,150,0,0,color);
LogoBg.x = 200;
LogoBg.y = 200;
addChild(LogoBg);
}
}}
I have more functions but I am having trouble with nested classes.
Here is the code in the document class.
package Classes {
import Classes.HomePage;
private var c:Object = new HomePage();
public class BuildHome extends Sprite {
public function BuildHome():void
{
addChild(display);
fillTheBoard();
}
}
}
When I use the buildXML function in my constructor, everything works fine. but when I try to use buildLogo it gives me this error…
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Classes::HomePage/buildLogo()
at Classes::HomePage$iinit()
at Classes::BuildHome$iinit()
could it be addChild without a reference since I assume that this nested class couldn’t access the stage? Or something like that… gurus help please
and thanks in advance.
this is a great forum!