hi guys

i'm having real bit of trouble here and i'm not sure what the way out is

i need to store a reference to a clip and an loop var (i) so that an
onLoadInit can read them - i've tried storing it in the listener object but
it gets overwritten on each iteration

here is my method

private function setupLoadArray():Void
{
for (var i:Number = 0; i < aPathArray.length; i++)
{
var ref:Object = this; // handy reference to AnimationLoader instance
var mcTempLoaderClip:MovieClip =
mcTarget._parent.createEmptyMovieClip("tempClip",
mcTarget._parent.getNextHighestDepth());

var sItemPath:String = LOAD_PATH + aPathArray[i];

var mcTargetClip:MovieClip = mcTarget.createEmptyMovieClip("clip"+i, i);
var nTargetClipX:Number = (nIconWidth + nIconSpacing) * i;
with(mcTargetClip)
{
_x = nTargetClipX;
}
// this is the bit that is not playing ball - all moviecliplisteners save
the last i so it's being overwritten
var mclItem:MovieClipLoader = new MovieClipLoader();
var mclItemListener:Object = new Object();
mclItemListener.ID = i;
mclItemListener.clip = mcTargetClip;
mclItemListener.onLoadInit = function():Void
{
// pass to bitmap data object
var myMatrix:Matrix = new Matrix();
myMatrix.scale(55, 55);

var tempBitmap:BitmapData = new BitmapData(110, 110, true);
tempBitmap.draw(this, myMatrix);

this.clip.attachBitmap(tempBitmap, this.clip.getNextHighestDepth(), "auto",
true);

ref.aLoadArray[this.ID] = true; // always last loop iteration is passed to
this
};
mclItemListener.onLoadError = function():Void
{
trace(this+" had a load error");
};

mclItem.addListener(mclItemListener);
mclItem.loadClip(sItemPath, mcTempLoaderClip);

}
}

Please help as this is making my brain ache

alz


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to