You can't addChild to a material. You add the child to the movie the
moviematerial references. So in your case, add the child to
"mc" (you'll need a ref to mc in the initWorld function).

On Apr 15, 6:07 pm, juliancruz87 <[email protected]> wrote:
> I try to use addChild in my MovieClip but doesn't work
>
> private function material():MovieMaterial
>                 {
>                         var mc:MovieClip = new WorldMaterial();  //movieclip 
> inside the
> library flash.
>                         var objectMap:ObjectMap = new ObjectMap("newMap"); // 
> Class extends
> MovieClip
>                         objectMap.graphics.beginFill(0x000000);
>                         objectMap.graphics.drawCircle(0,0,500);
>                         objectMap.graphics.endFill();
>                         mc.addChild(objectMap);
>                         var sp:Sprite = new Sprite();
>                         sp.addChild(mc);
>                         worldMat = new MovieMaterial(sp);
>                         return worldMat
>                 }
>
> private function initWolrd():void
> {
> var div:int = 35;
> // this line create the world
> world = new Sphere({segmentsH:div,segmentsW:div,radius:
> 80,material:material()});
> scene.addChild(world);
>
> }
>
> I can't add child if the movieclip is inside the flash library ????

Reply via email to