Hope the title isn't too cryptic!

I need to load a dynamic number of images and temporarily set visible to false on them.

Simple huh?

well...

I assume I am missing something fairly simple in my process but here goes:

[code]
createEmptyMovieClip("_cancelOrder", getNextHighestDepth());
loader.loadClip("buttonCancelOrder.gif", this["_cancelOrder"]);
var currentClip = this["_cancelOrder"];
loadListener.onLoadComplete = function(currentClip ):Void {
currentClip ._visible = false;
}
[/code]

Now... in this instance, I could have passed _cancelOrder through to the onLoadComplete (instead of passing currentClip)- since it is a top level and predefined var. But seperately in the same script I dynamically create movieclips with names like "button"+i - so since there is a number in the title (and an indeterminate number of them), i need to refer to them in a for loop as this["button"+i]

and you can't pass that through to onLoadComplete - hence I have been assigning the dynamic movie to a temporary variable

so far so good.

but when I have a number of these loading, often the next clip is assigned to 'currentClip' before the first one has finished loading - this means that the currentClip doesn't refer to the movieclip it should when the first onLoadComplete is triggered.

how do i get by this?

I basically want to load in X images, and then be able to set different properties / onReleases for each of them - but using the above, I can't see how to.

It all falls down because the movie clips don't have 'real' names - but can only be refered to as this["button"+i] and you can't pass that to the movie loader because of the inline function style.

The only thing I can think of is to do a check to see if EVERYTHING has loaded, then I could just have a big chunk of code that loops round everything and sets all the vars - but that's a bit crap!

Anyway, any advice would be appreciated.

Thanks

David
_______________________________________________
Flashcoders@chattyfig.figleaf.com
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

Reply via email to