A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [CS3] Outputing in a grid?

  1. #1
    Senior Member
    Join Date
    Feb 2008
    Posts
    126

    [CS3] Outputing in a grid?

    Hi,

    I have an MC that loads in images externally, the number of images are dynamic so its different every time. The images are square in shape, how can I get it so that it outputs 5 images in a row and then jumps 100 or so pixels down and outputs again....like a grid...

    Thansk for any help!

  2. #2
    Monkey Moderator Lexicon's Avatar
    Join Date
    Jul 2001
    Location
    UK
    Posts
    2,038
    Here's a basic loop to get the x/y coords in a grid. I'll leave you to declare the variables.

    Code:
    for(i=0; i<numOfImages; i++)
    {
    	x = startx + ((i%numInRow) * spacing);
    	y = starty + (Math.floor(i/numInRow) * spacing);
    }
    www.lexicon-design.co.uk
    If we aren't supposed to eat animals, then why are they made of meat?
    If Vegetarians like animals so much, why do they eat all their food?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center