I am trying to load MC's from an array but I need to make it so that after ever 2 MC's the Yposition changes down say 300px so that I have a new line. I have tried using if(see at the bottom of this script.) bellow but it doen't work. Can someone please help me out I need this urgently my dead line is in like 5hrs!
this is what I have atm.
Code:
Code:var selectedMensShirts:Array = loadShirts(); var itemX:Number = 500; // initial item x position var itemY:Number = 100; // initial item y position var item2X:Number = 500; // initial item x position var item2Y:Number = 0; // initial item y position for each( var shirtName:String in selectedMensShirts ) { var item:DisplayObject = null; if( shirtName == "mYellow" ) { item = new yellow(); item.addEventListener(MouseEvent.MOUSE_OVER, yellowOver); function yellowOver(e:MouseEvent):void { menshirt.gotoAndStop(3); } item.addEventListener(MouseEvent.MOUSE_OUT, yellowOut); function yellowOut(e:MouseEvent):void { menshirt.gotoAndStop(1); } } else if( shirtName == "mBlue" ) { item = new blue(); item.addEventListener(MouseEvent.MOUSE_OVER, blueOver); function blueOver(e:MouseEvent):void { menshirt.gotoAndStop(5); } item.addEventListener(MouseEvent.MOUSE_OUT, blueOut); function blueOut(e:MouseEvent):void { menshirt.gotoAndStop(1); } } else if( shirtName == "mBlack" ) { item = new black(); item.addEventListener(MouseEvent.MOUSE_OVER, blackOver); function blackOver(e:MouseEvent):void { menshirt.gotoAndStop(4); } item.addEventListener(MouseEvent.MOUSE_OUT, blackOut); function blackOut(e:MouseEvent):void { menshirt.gotoAndStop(1); } } else if( shirtName == "mWhite" ) { item = new white(); item.addEventListener(MouseEvent.MOUSE_OVER, whiteOver); function whiteOver(e:MouseEvent):void { menshirt.gotoAndStop(2); } item.addEventListener(MouseEvent.MOUSE_OUT, whiteOut); function whiteOut(e:MouseEvent):void { menshirt.gotoAndStop(1); } } if( item != null ) { addChild( item ); item.x = itemX; item.y = itemY; itemX += item.width + 20; // 20 = space between items } if( item.x >= 300 ) //If I could do something like this but working where if ItemX is greater than 300 px it will use Item 2. { addChild( item2 ); item2.x = item2X; item2.y = item2Y; item2X += item2.width + 20; // 20 = space between items } }


Reply With Quote