I found that calling this.createEmptyMovieClip() several times within
a class that inherits from mx.core.View causes problems. In my case
the following code seems to produce only five red rectangles, and not
7 as I would expect.
// NBSLOTS == 7
this.areasMask = new Array(NBSLOTS);
for (var k:Number = 0; k < NBSLOTS; k++){
this.areasMask[k] = this.createEmptyMovieClip("myMask"+k,
this.getNextHighestDepth());
MovieClip(this.areasMask[k]).moveTo(0,0);
MovieClip(this.areasMask[k]).beginFill(0xFF0000, 100);
MovieClip(this.areasMask[k]).lineTo(SLOTWIDTH, 0);
MovieClip(this.areasMask[k]).lineTo(SLOTWIDTH, Brick.HEIGHT);
MovieClip(this.areasMask[k]).lineTo(0, Brick.HEIGHT);
MovieClip(this.areasMask[k]).lineTo(0, 0);
MovieClip(this.areasMask[k]).endFill();
MovieClip(this.areasMask[k])._height = Brick.HEIGHT;
MovieClip(this.areasMask[k])._width = SLOTWIDTH;
MovieClip(this.areasMask[k])._x = k * SLOTWIDTH;
MovieClip(this.areasMask[k])._y = BOTTOM_Y - (SLOTHEIGHT-Brick.HEIGHT);
MovieClip(this.areasMask[k]).setDepthBelow(this.myBateau);
}
Am I missing something basic here?
My workaround consists in doing
var maskCreationGround:MovieClip =
this.createEmptyMovieClip("maskCreationGround",
this.getNextHighestDepth());
before the for loop. Then, instead of creating the MovieClip instances
on 'this.', I create them on maskCreationGround. The corresponding
line thus becomes:
this.areasMask[k] =
maskCreationGround.createEmptyMovieClip("myMask"+k,
maskCreationGround.getNextHighestDepth());
Maybe the above workaround will save someone some time-consuming
trials-and-errors in the future...
stefan.
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com