PatchMe
02-20-2006, 06:02 PM
Hey,
Im currently working on a script which shows thumbnails that are covered with a transparent color. and this color has to fade away randomly at one thumbnail at once and then continue to the next one randomly.
the loading is complete and most of the script is complete .. i only need the movieclip loader which makes it go randomly instead of lineair but i cant get it to work .. please help me out:
this is the code:
function loadXML(succes)
{
if (succes)
{
var _loc4 = this.firstChild.childNodes;
for (i = 0; i < _loc4.length; i++)
{
var _loc2 = thumbnails.attachMovie("thumb", "thumb" + i, depth++);
_loc2._x = 20 + i % 6 * spacing;
_loc2._y = 20 + Math.floor(i / 6) * spacing;
var _loc3 = new Array();
_loc3.push(_loc4[i].attributes.file);
Count.push(_loc2);
loadMovie(_loc3, thumbnails["thumb" + i]);
}
firstContent();
}
}
function firstContent()
{
var _loc2 = random(Count.length);
for (i = 0; i < Count.length; i++)
{
var _loc1 = cnt.attachMovie("animate", "animate" + i, depth++);
_loc1._x = 20 + i % 6 * spacing;
_loc1._y = 20 + Math.floor(i / 6) * spacing;
animationClips.push(_loc1);
}
}
function doNext(goAnimate)
{
var _loc1 = new mx.transitions.Tween(goAnimate, "_alpha", mx.transitions.easing.Regular.easeOut, goAnimate._alpha, 0, 20);
_loc1.start();
_loc1.onMotionFinished = function ()
{
doNext(animationClips.pop());
};
}
function stageResize()
{
bg._x = Math.floor(Stage.width / 2 - 480);
bg._y = Math.floor(Stage.height / 2 - 170);
}
Stage.scaleMode = "noScale";
Stage.align = "TL";
var x = new XML();
x.ignoreWhite = true;
x.load("myXML.xml");
x.onLoad = loadXML;
var spacing = 157;
var root = this;
var Count = new Array();
var depth = 0;
var bg = this.attachMovie("bg", "bg", depth++);
var thumbnails = bg.createEmptyMovieClip("thumbnails", bg.getNextHighestDepth());
var cnt = bg.createEmptyMovieClip("cnt", bg.getNextHighestDepth());
var animationClips = new Array();
animationClips.shuffle();
Array.prototype.shuffle = function ()
{
for (i = 0; i < this.length; i++)
{
var _loc3 = this[i];
var _loc2 = random(this.length);
this[i] = this[_loc2];
this[_loc2] = _loc3;
}
};
this.onEnterFrame = function ()
{
var _loc1 = animationClips.pop();
doNext(_loc1);
};
stageResize();
var stageListener = new Object();
stageListener.onResize = function ()
{
stageResize();
};
Stage.addListener(stageListener);
and this is the result:
http://www.xs4all.nl/~shls0290/flash/images.swf
grtz
PatchMe
Im currently working on a script which shows thumbnails that are covered with a transparent color. and this color has to fade away randomly at one thumbnail at once and then continue to the next one randomly.
the loading is complete and most of the script is complete .. i only need the movieclip loader which makes it go randomly instead of lineair but i cant get it to work .. please help me out:
this is the code:
function loadXML(succes)
{
if (succes)
{
var _loc4 = this.firstChild.childNodes;
for (i = 0; i < _loc4.length; i++)
{
var _loc2 = thumbnails.attachMovie("thumb", "thumb" + i, depth++);
_loc2._x = 20 + i % 6 * spacing;
_loc2._y = 20 + Math.floor(i / 6) * spacing;
var _loc3 = new Array();
_loc3.push(_loc4[i].attributes.file);
Count.push(_loc2);
loadMovie(_loc3, thumbnails["thumb" + i]);
}
firstContent();
}
}
function firstContent()
{
var _loc2 = random(Count.length);
for (i = 0; i < Count.length; i++)
{
var _loc1 = cnt.attachMovie("animate", "animate" + i, depth++);
_loc1._x = 20 + i % 6 * spacing;
_loc1._y = 20 + Math.floor(i / 6) * spacing;
animationClips.push(_loc1);
}
}
function doNext(goAnimate)
{
var _loc1 = new mx.transitions.Tween(goAnimate, "_alpha", mx.transitions.easing.Regular.easeOut, goAnimate._alpha, 0, 20);
_loc1.start();
_loc1.onMotionFinished = function ()
{
doNext(animationClips.pop());
};
}
function stageResize()
{
bg._x = Math.floor(Stage.width / 2 - 480);
bg._y = Math.floor(Stage.height / 2 - 170);
}
Stage.scaleMode = "noScale";
Stage.align = "TL";
var x = new XML();
x.ignoreWhite = true;
x.load("myXML.xml");
x.onLoad = loadXML;
var spacing = 157;
var root = this;
var Count = new Array();
var depth = 0;
var bg = this.attachMovie("bg", "bg", depth++);
var thumbnails = bg.createEmptyMovieClip("thumbnails", bg.getNextHighestDepth());
var cnt = bg.createEmptyMovieClip("cnt", bg.getNextHighestDepth());
var animationClips = new Array();
animationClips.shuffle();
Array.prototype.shuffle = function ()
{
for (i = 0; i < this.length; i++)
{
var _loc3 = this[i];
var _loc2 = random(this.length);
this[i] = this[_loc2];
this[_loc2] = _loc3;
}
};
this.onEnterFrame = function ()
{
var _loc1 = animationClips.pop();
doNext(_loc1);
};
stageResize();
var stageListener = new Object();
stageListener.onResize = function ()
{
stageResize();
};
Stage.addListener(stageListener);
and this is the result:
http://www.xs4all.nl/~shls0290/flash/images.swf
grtz
PatchMe