I’ve put together this code in AS2.
import mx.transitions.Tween;
import mx.transitions.easing.*;
_global.tRef = this;
var iXML:XML = new XML();
iXML.ignoreWhite = true;
iXML.onLoad = init;
iXML.load("xml/images.xml");
var lastpos = 0;
var lastpos2 = 0;
// axis is a string: _x or _y, speed is a number between 1 and 2: if undefined, default is 1.5
var my_tweens:Array = [];
var i = 0;
var listenerObj:Object = new Object();
var movieClipLoader:MovieClipLoader = new MovieClipLoader();
movieClipLoader.addListener(listenerObj);
var listenerObj2:Object = new Object();
var movieClipLoader2:MovieClipLoader = new MovieClipLoader();
movieClipLoader2.addListener(listenerObj2);
function init():Void
{
var imgNum:Number = iXML.firstChild.childNodes[1].childNodes.length;
var holder_mc:MovieClip = _root.createEmptyMovieClip("holder_mc", 0);
var holder_mc2:MovieClip = _root.createEmptyMovieClip("holder_mc2", 1);
for (i = 0; i < imgNum; i++)
{
var movieClip:MovieClip = _root.holder_mc.createEmptyMovieClip(i, _root.holder_mc.getNextHighestDepth());
var url = iXML.firstChild.childNodes[0].childNodes*.attributes.src;
movieClipLoader.loadClip(url, movieClip);
var movieClip2:MovieClip = _root.holder_mc2.createEmptyMovieClip(i, _root.holder_mc2.getNextHighestDepth());
var url2 = iXML.firstChild.childNodes[1].childNodes*.attributes.src;
movieClipLoader2.loadClip(url2, movieClip2);
}
};
listenerObj.onLoadInit = function (image_object:MovieClip):Void {
image_object._x = lastpos;
lastpos = lastpos+image_object._width;
myTween = new Tween(image_object, "_alpha", mx.transitions.easing.Strong.easeOut, 100, 0, 2, true);
}
listenerObj2.onLoadInit = function (image_object2:MovieClip):Void {
image_object2._x = lastpos;
lastpos2 = lastpos2 +image_object2._width;
}
My problem is with the tween.
I just want to fade the top layer of movieclips in and out randomly to reveal the second layer (holder_mc2).
I’ve got the listerner and I can invoke an individual Tween - but how can I vary the tween for each individual clip when onLoadInit is called.
Also how could I put a random delay on each Tween?
Thanks for any help.