0 Replies Latest reply on Jul 22, 2010 1:45 PM by danwize

    duplicating Movie clips:  Can't access duplicate's children

    danwize Level 1


      This code had been working when I was using flex 3, but now with framework 4.1 I can't get this to work:


      var TargetClass:Class;

      var instance:MovieClip;

      var rv:TextField;


      TargetClass =  Object(baseSwf_mc.getChildByName(instanceName)).constructor;

      instance = new TargetClass();


      instance.x = baseSwf_mc.getChildByName(instanceName).x;

      instance.y = baseSwf_mc.getChildByName(instanceName).y;

      rv = TextField(instance.getChildByName("word"));

      rv.autoSize = TextFieldAutoSize.LEFT;  //on this line I get a null object reference error.  rv is undefined.

      when I debug, instance has 0 children, though the movieClip referred to by "baseSwf_mc.getChildByName(instanceName)" definatly has a child TextField with the instance name "word".  Any ideas why this wouldn't be working any more?