Ok i am having a little issue.
I am making items that minimize onto the side of the screen as little icons, I have that figured out. What i am trying to accomplish is making them minimize to a dynamic spot if there is not already one there. There a bunch of posistions that they could minimize to, i would like them to choose the next highest avaliable spot. Heres some code that will make them do that:
Warning this might make your brain explode.
var minspots:Array = [60, 100, 140, 180, 220, 260];
var minspotstaken:Array = [false, false, false, false, false, false];
_global.sizedown = function(target:MovieClip) {
var spoty:Number = 0;
var i:Number = 0;
while (i<minspotstaken.length) {
if (minspotstaken* == false) {
spoty = minspots*;
minspotstaken* = true;
i = minspottaken.length;
}
i++;
}
target._xscale = target._yscale=10;
target._x = 10;
target._y = spoty;
target.onRelease = function() {
var i:Number = 0;
while (i<minspots.length) {
if (minspots* == spoty) {
minspotstaken* = false;
i = minspots.length;
}
i++;
}
sizeup(target);
};
}
This works great, they act nice, they go to where they should, really hawt.
However, when i get a tween into the action, It no longer works:
var minspots:Array = [60, 100, 140, 180, 220, 260];
var minspotstaken:Array = [false, false, false, false, false, false];
_global.sizedown = function(target:MovieClip) {
var spoty:Number = 0;
var i:Number = 0;
while (i<minspotstaken.length) {
if (minspotstaken* == false) {
spoty = minspots*;
minspotstaken* = true;
i = minspottaken.length;
}
i++;
}
trace (spoty)// <- this traces like a million dollars
new mx.transitions.Tween(target, "_x", mx.transitions.easing.Regular.easeOut, target.prex, 10, .5, true);
new mx.transitions.Tween(target, "_y", mx.transitions.easing.Regular.easeOut, target.prey, spoty, .5, true);
new mx.transitions.Tween(target, "_xscale", mx.transitions.easing.Regular.easeOut, 100, 10, .5, true);
new mx.transitions.Tween(target, "_yscale", mx.transitions.easing.Regular.easeOut, 100, 10, .5, true);
target.onRelease = function() {
var i:Number = 0;
while (i<minspots.length) {
if (minspots* == spoty) {
minspotstaken* = false;
i = minspots.length;
}
i++;
}
sizeup(target);
};
}
It almost appears as if the tween action for the “_y” is holding its first value, as it always goes back to where it went when the movie loads.
Any ideas?:cantlook: