Hello,
I have a setup where a girl is holding a card on there are words on each card and as time goes by they fall to the ground. The problem I am running into is that the cards never go back into the loop of cards, once they are out I am just left with a blank card. How could I have it reset this?
I know my code isn’t the best so if you have any ideas on how to do anything better please feel free to offer your suggestion.
Thanks,
Saveth
//CLASS IMPORTS
import mx.utils.Delegate;
import mx.transitions.Tween;
import mx.transitions.easing.*;
//PLACE ARM ABOVE CARDS
arm_mc.swapDepths(100000);
//VARIABLES
var numOfItems:Number;
var home:MovieClip = this;
var delay:Number = 3000;
//POSITION INITIALIZATION
tagline_mc._x = 810;
tagline_mc._y = 114;
tagline2_mc._x = 382;
tagline2_mc._y = -200;
tagline3_mc._x = 382;
tagline3_mc._y = 500;
tagline4_mc._x = 382;
tagline4_mc._y = 114;
//ALPHA INITIALIZATION
tagline4_mc._alpha = 0;
//HUGE TWEEN
var twTaglineFirstIn:Tween = new Tween(tagline_mc, "_x", Strong.easeOut, tagline_mc._x, 382, 1, true);
twTaglineFirstIn.onMotionStopped = function()
{
var twTaglineFirstOut:Tween = new Tween(tagline_mc, "_x", Strong.easeIn, tagline_mc._x, 810, 1, true);
twTaglineFirstOut.onMotionStopped = function()
{
var twTaglineSecondIn:Tween = new Tween(tagline2_mc, "_y", Strong.easeOut, tagline2_mc._y, 114, 1, true);
twTaglineSecondIn.onMotionStopped = function()
{
var twTaglineSecondOut:Tween = new Tween(tagline2_mc, "_y", Strong.easeIn, tagline2_mc._y, -200, 1, true);
twTaglineSecondOut.onMotionStopped = function()
{
var twTaglineThirdIn:Tween = new Tween(tagline3_mc, "_y", Strong.easeOut, tagline3_mc._y, 114, 1, true);
twTaglineThirdIn.onMotionStopped = function()
{
var twTaglineThirdOut:Tween = new Tween(tagline3_mc, "_y", Strong.easeIn, tagline3_mc._y, 500, 1, true);
twTaglineThirdOut.onMotionStopped = function()
{
var twTaglineFourthAlpha:Tween = new Tween(tagline4_mc, "_alpha", Strong.easeOut, 0, 100, 1, true);
};
};
};
};
};
};
//PARSE AND LOAD XML
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function() {
var nodes = this.firstChild.childNodes;
numOfItems = nodes.length;
for (var i = 0; i<numOfItems; i++) {
var t = home.attachMovie("card_mc", "card_mc"+i, i+1);
t._x = 206;
t._y = 148;
t.words = nodes*.attributes.name;
t.cardText.text = t.words;
//DRAG OBJECTS
/*t.onPress = function() {
startDrag(this, false, 0+(this._width/2), 0+(this._height/2), Stage.width-(this._width/2), Stage.height-(this._height/2));
};
t.onRelease = things*.onReleaseOutside=function () {
stopDrag();
};*/
t.onRelease = released;
}
};
xml.load("names.xml");
//SET DROP INTERVAL
dropInterval = setInterval(drop, delay);
//INITIALIZE COUNTER
var counter:Number = 21;
//DROP CARDS FUNCTION
function drop() {
var t:MovieClip = home["card_mc"+counter];
var tw:Tween = new Tween(t, "_y", Strong.easeOut, t._y, 450, 1, true);
}
//DROP CARDS ON RELEASE FUNCTION
function released() {
delete this.onRelease;
clearInterval(dropInterval);
var t:MovieClip = this;
if (t == this) {
var tw:Tween = new Tween(t, "_y", Strong.easeOut, t._y, 450, 1, true);
}
}