Copy link to clipboard
Copied
I have a Main.as which is asigned as my DocumnetClass
This Class Creates a MovieClip Called Childlike this
var c:Child = new Child ;
addChild(c);
I have a class also called Child.as
package {
import flash.display.MovieClip;
public class Child extends MovieClip
{
//This number will match the index of the details in the arrays which belong to that Child
var ChildNumber:Number;
public function Child() {
DeclareChildStats();
}
private function DeclareChildStats()
{
}
}
}
This class will set the stats for each indvidual child, But I can get it working when I run the swf I just get
TypeError: Error #1009: Cannot access a property or method of a null object reference.
Bacicly I am adding the child to the scene.
I want the child to use its class Child.as.
But It wont and I get errors. Why cant things be simple
that should be
var c:Child=new Child();
and, what line of code is triggering the error (file>publish settings>swf>tick "permit debugging")?
Copy link to clipboard
Copied
that should be
var c:Child=new Child();
and, what line of code is triggering the error (file>publish settings>swf>tick "permit debugging")?
Copy link to clipboard
Copied
Ah Its working
I had a line under this function
private function DeclareChildStats()
{
ChildNumber = MovieClip(root).ChildIndex;
}
And when I removed it and put a trace there it works
Thanks
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now