So, I’m building a website so that when you click on one of the menu items it runs the function below. What I’m essentially trying to do is have it check to see if the “card” is visible on the stage. If the card is visible then remove the current “card”, if not then create a new “card”. Currently the script is allowing me to create a card but when I press the button again, it creates another card. Any help would be greatly appreciated!
-Dan
function home_card_fly(evt:MouseEvent):void {
[INDENT] if (getChildByName("current_card") == null) {
[/INDENT][INDENT][INDENT] var current_card:MovieClip = new home_card();
[/INDENT][/INDENT][INDENT][INDENT] emptyMC_home.addChild(current_card);
[/INDENT][/INDENT][INDENT][INDENT] current_card.x = -stage.stageWidth / 2;
[/INDENT][/INDENT][INDENT][INDENT] current_card.y = 0;
[/INDENT][/INDENT][INDENT][INDENT] TweenLite.to(current_card, 2.75, {x:0, y:0 , ease:Elastic.easeOut});
[/INDENT]} else {
[INDENT]removeChild(getChildByName("current_card"));
[/INDENT]}
[/INDENT]}