-
[RESOLVED] where to insert setInterval
Hi,
I'm trying to have this gallery run by itself but eventhough it works, it doesn't load the pictures in the thumbnails when the trace gives me a right variable. Besides, I get more values than expected from it.
The images are on boxes attached dynamically and the onPress handler works perfectly tracing one value at a time:
Code:
this.onPress = function():Void {
temp = id;
this.id = _parent.box1.id;
_parent.box1.id = temp;
_parent.box1.targetBox.attachMovie("image - "+temp, "image - "+temp, getNextHighestDepth());
this.targetBox.attachMovie("image - "+id, "image - "+id, getNextHighestDepth());
_parent.box1.boxMask._width = _parent.box1.targetBox._width;
_parent.box1.boxMask._height = _parent.box1.targetBox._height;
_parent.box1.boxOutline._width = _parent.box1.targetBox._width;
_parent.box1.boxOutline._height = _parent.box1.targetBox._height;
_parent.box1.swapDepths(this);
}
but if I changge the code to:
Code:
function swapImages():Void {
id--;
temp = id;
trace("temp = "+temp);
id = _parent.box1.id;
trace("id = "+id);
_parent.box1.id = temp;
_parent.box1.targetBox.attachMovie("image - "+temp, "image - "+temp, getNextHighestDepth());
this.targetBox.attachMovie("image - "+id, "image - "+id, getNextHighestDepth());
_parent.box1.swapDepths(this);
_parent.box1.boxMask._width = _parent.box1.targetBox._width;
_parent.box1.boxMask._height = _parent.box1.targetBox._height;
_parent.box1.boxOutline._width = _parent.box1.targetBox._width;
_parent.box1.boxOutline._height = _parent.box1.targetBox._height;
if(id == 0){
clearInterval(interval_id);
trace("Interval cleared");
}
}
var interval_id:Number = setInterval(swapImages, 2000);
it will work but only on the main image tracing the values of all the clips.
Any ideas of how to face this? If you open up the attached fla, comment the first part of the code and uncomment the end part of it.
-
.
Hi,
Is this what you require ??
PHP Code:
var count:Number = 0;
function swapImages()
{
count++;
if (count > _parent.b)
{
clearInterval(interval_id);
trace("Interval cleared");
}
else
{
temp = id;
id = _parent.box1.id;
_parent.box1.id = temp;
_parent.box1.targetBox.attachMovie("image - " + temp,"image - " + temp,this.getNextHighestDepth());
targetBox.attachMovie("image - " + id,"image - " + id,this.getNextHighestDepth());
_parent.box1.swapDepths(this);
_parent.box1.boxMask._width = _parent.box1.targetBox._width;
_parent.box1.boxMask._height = _parent.box1.targetBox._height;
_parent.box1.boxOutline._width = _parent.box1.targetBox._width;
_parent.box1.boxOutline._height = _parent.box1.targetBox._height;
var bMxscale:Tween = new Tween(_parent.box1.boxMask, "_xscale", Regular.easeInOut, 50, _parent.box1.boxMask._xscale, 1, true);
var bMyscale:Tween = new Tween(_parent.box1.boxMask, "_yscale", Regular.easeInOut, 50, _parent.box1.boxMask._yscale, 1, true);
var bOxscale:Tween = new Tween(_parent.box1.boxOutline, "_xscale", Regular.easeInOut, 50, _parent.box1.boxOutline._xscale, 1, true);
var bOyscale:Tween = new Tween(_parent.box1.boxOutline, "_yscale", Regular.easeInOut, 50, _parent.box1.boxOutline._yscale, 1, true);
var xTween:Tween = new Tween(_parent.box1, "_x", Strong.easeInOut, this._x, 175, .2, true);
var yTween:Tween = new Tween(_parent.box1, "_y", Strong.easeInOut, 30, _parent.thumbscale * 6.5, .2, true);
}
yTween.onMotionFinished = function()
{
trace("temp = " + temp + " : id = " + id + " count = " + count);
trace("-------------------------------");
};
}
var interval_id = setInterval(swapImages, 2000);
-
thanks, FruitBeard,
Sure. It works and I'll take a better look at it later, but can you see why the thumbnail doesn't load the image? Id has a different value and ome thinks it should...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|