You could do this a few ways.
1. Create the border1 and char instances in reverse order and pass the border1 to the char instance to maintain a reference.
var border1:Border = new Border();
stage.addChild(border1);
var char:Char = new Char(stage, border1);
stage.addChildAt(char, 1);
// Char consructor
public function Char(target:DisplayObjectContainter, border:Border):void {
...
this._border = border;
}
// Now you have a reference to the border1 instance within your char instance.
You could also do this without passing the border1 instance to the constuctor, and instead just add a method that sets this property.
public function setBorder(border:Border):void {
this._border = border;
}
// OR
public function set border(border:Border):void {
this._border = border;
}
Another option would be to make the Engine instance maintain a reference to the border and allow communication through the Engine instance. For example,
public class Engine extends MovieClip {
public var char:Char;
public var border1:Border;
public function Engine():void {
char = new Char(stage);
stage.addChildAt(char, 1);
border1 = new Border();
stage.addChild(border1);
}
Now, if the char instance has a reference to the engine instance, then the border instance can be referenced by myEngineInstance.border1
.
Or you can make the border instance static. Making it static would allow for code inside of the Char instance like:
Engine.border1.<whatever>