This is my problem: I have a Shared class which extends Main class. In my Shared class i am instancing other classes and adding them to this. class
package
{
import flash.display.Sprite;
public class Shared extends Main
{
public var m:Mirror = new Mirror(span, i*span+j, _x, _y, size, d);
public var g:Grid = new Grid(i*span+j,size, addl, span, _x, _y);
public var b:Ball = new Ball(30);
public var mc:MovieClips = new MovieClips(30, _x, _y, size, span);
public var l:Level = new Level(levelCount);
public function Shared(){
this.addChild(m);
this.addChild(g);
this.addChild(b);
this.addChild(mc);
this.addChild(l);
}
}
}
Now, in my main i also use an instance of Shared like so:
private function init(e:Event = null):void
{
var sh:Shared = new Shared();
stage.addChild(sh.b);
stage.addChild(sh.mc);
stage.addChild(sh.l);
for (i = 0; i < span; i++)
{
for (j = 0; j < span; j++)
{
stage.addChild(sh.g);
if(addl.indexOf(i*span+j)==true){
stage.addChild(sh.m);
}
}
}
}
I don't get any errors, but none of the objects appear on stage, i can't find the problem. I think my problem is Shared class is not extending Sprite, but then i would have to pass a huge amount of arguments to Shared, is there any way to bypass this? So i can still extend Main...