To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Actionscript 3.0

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 11-07-2009, 02:41 AM   #1
Raging Tempist
Senior Member
 
Join Date: Jan 2004
Location: NZ
Posts: 100
resolved [RESOLVED] limit items on a row

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 
    }
}

Last edited by Raging Tempist; 11-07-2009 at 07:25 AM.
Raging Tempist is offline   Reply With Quote
Old 11-07-2009, 02:11 PM   #2
neznein9
Ө_ө sleepy mod
 
Join Date: Mar 2003
Location: Oregon, USA
Posts: 2,117
http://www.calypso88.com/?p=453
__________________
Please use [php] or [code] tags, and mark your threads resolved 8)
neznein9 is offline   Reply With Quote
Old 11-08-2009, 08:13 PM   #3
Raging Tempist
Senior Member
 
Join Date: Jan 2004
Location: NZ
Posts: 100
thanx man
Raging Tempist is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Actionscript 3.0

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:14 AM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.