Today I got a problem with the bitmap data depth display in my project that runs in ActionScript 2. I was expecting for the bitmap data to display in the
_loader
container This is how these containers are build here:
this.windowContainer = _root.attachMovie("window", "container", _root.getNextHighestDepth());
this.windowContainer._x = 199.95;
this.windowContainer._y = 60.6;
this.backgroundType = this.windowContainer.createEmptyMovieClip("backgroundContainer", this.windowContainer.getNextHighestDepth());
this.backgroundType.beginFill(0xFFFFFF,100);
this.backgroundType.moveTo(0,0);
this.backgroundType.lineTo(580.3,0);
this.backgroundType.lineTo(580.3,439.2);
this.backgroundType.lineTo(0,439.2);
this.backgroundType.lineTo(0,0);
this.backgroundType.endFill();
this.backgroundType._x = -60.35;
this.backgroundType._y = -53.45;
this._loader = this.windowContainer.createEmptyMovieClip("__imageLoader", this.windowContainer.getNextHighestDepth());
this._loader._x = 50.75;
this._loader._y = 49.55;
Here what's I'm trying to do here, loading an image in the
_loader
container:
function loadImage(pSource, pWidth, pHeight)
{
if (typeof (pSource) == "movieclip")
{
this._loader = pSource;
this._loader._width = pWidth;
this._loader._height = pHeight;
}
else if (pSource instanceof flash.display.BitmapData)
{
this._loader.attachBitmap(pSource,this._loader.getNextHighestDepth(),"auto",true); //for some reason, the bitmap's depth is somewhere behind every other container on where i cannot see the bitmap at all, such as the background, exitType, minimizeType, etc. Which means, again. The bitmap is literally behind every other containers [Please note that what I mean a container, is a movie clip. Sorry for the confusion.]
this._loader._width = pWidth;
this._loader._height = pHeight;
}
else
{
this._loader.loadMovie(pSource);
this._loader._width = pWidth;
this._loader._height = pHeight;
}
}
Only this type of swaping depth works:
this._loader.swapDepths(_root.getNextHighestDepth());
function loadImage(pSource, pWidth, pHeight)
{
if (typeof (pSource) == "movieclip")
{
this._loader = pSource;
this._loader._width = pWidth;
this._loader._height = pHeight;
}
else if (pSource instanceof flash.display.BitmapData)
{
this._loader.attachBitmap(pSource,this._loader.getNextHighestDepth(),"auto",true);
this._loader._width = pWidth;
this._loader._height = pHeight;
}
else
{
this._loader.loadMovie(pSource);
this._loader._width = pWidth;
this._loader._height = pHeight;
}
this._loader.swapDepths(_root.getNextHighestDepth());
}
I tried this:
this._loader.swapDepths(this.windowContainer.getNextHighestDepth());
or this:
this._loader.attachBitmap(pSource,this.windowContainer.getNextHighestDepth(),"auto",true);
but guess what? I STILL CANNOT SEE THE BITMAP DISPLAY. It's still behind everything.
What the correction should be here in this code is this. The bitmap data should display in front of every other containers such as [backgroundType]. Not be all the way behind.