|
@@ -32,6 +32,8 @@ class Component extends Sprite {
|
|
|
public function getElementById(id:String) {
|
|
|
if( this.id == id )
|
|
|
return this;
|
|
|
+ if( !allocated )
|
|
|
+ return getElementByIdRec(this, id);
|
|
|
for( c in components ) {
|
|
|
var c = c.getElementById(id);
|
|
|
if( c != null )
|
|
@@ -40,6 +42,17 @@ class Component extends Sprite {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ function getElementByIdRec( s : h2d.Sprite, id : String ) : Component {
|
|
|
+ var c = flash.Lib.as(s, Component);
|
|
|
+ if( c != null && c.id == id )
|
|
|
+ return c;
|
|
|
+ for( s in s.childs ) {
|
|
|
+ var c = getElementByIdRec(s, id);
|
|
|
+ if( c != null ) return c;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
function set_needRebuild(v) {
|
|
|
needRebuild = v;
|
|
|
if( v && parentComponent != null && !parentComponent.needRebuild )
|