Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I don't think you can do this. Your best bet is to pass in a string identifier (perhaps a whole dot-separated path if your clips are deeply nested), and then implement code inside your custom component to find that item by name. </p> <p>I've got a custom component which lays itself out relative to horizontal and vertical predecessor components, so I do this:</p> <pre><code>protected var horizontalPredecessor:String = ""; [Inspectable(name = "HorizontalPredecessor", type = String, defaultValue="")] public function set HorizontalPredecessor($value:String):void { horizontalPredecessor = $value; drawNow(); } override protected function draw():void { if (parent) { if (horizontalPredecessor != "") { var hp:DisplayObject = parent.getChildByName(horizontalPredecessor); if (hp) { x = hp.y + hp.height + horizontalSpacing; } } } } </code></pre> <p>... which is made easy because all these components share the same parent.</p> <p>Alternatively, if there's only one door, you could make it a singleton, and give it a static reference, like this:</p> <pre><code>public class Door { private static var _singleton:Door; public static function get Singleton():Door { if(!_door) _door = new Door(); return _door; } } </code></pre> <p>Then your handle can just refer to <code>Door.Singleton</code> and you don't have to worry about passing anything in. Alternatively, you could have a static array of Doors in the Door class, and give your handle an index number to link it to a specific Door.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload