Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6332317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:14:27+00:00 2026-05-24T18:14:27+00:00

I am trying to create a grid for a flash game to use with

  • 0

I am trying to create a grid for a flash game to use with a pathfinder class(will build once this is done)

I have the code

var rows:int = 4;
var cols:int = 4;
for (var py:int = 0; py <rows; py++) {
    for (var px:int = 0; px <cols; px++) {
        var box:Box = new Box();
        box.x = 50 + box.width * px;
        box.y = 50 + box.height * py;
        addChild(box);
    }
}

this adds a movieclip to the stage for the number of needed cols and rows, however, I need the grid to be:
17×21 with the cell sizes to be 20px however every other cell needs to be 36px
ie. . .

| 36px | 20px | 36px | 20px | 36px | 20px | (all at 20px height)
| 36px | 20px | 36px | 20px | 36px | 20px | (all at 36px height)
| 36px | 20px | 36px | 20px | 36px | 20px | (all at 20px height)
| 36px | 20px | 36px | 20px | 36px | 20px | (all at 36px height)

Anyone have any ideas?

cheers

Andrew

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T18:14:29+00:00Added an answer on May 24, 2026 at 6:14 pm

    If I understand correctly, you need to check the modulo of px and py and set the width and height according to it. Something like that should work:

    var rows:int = 4;
    var cols:int = 4;
    for (var py:int = 0; py <rows; py++) {
        for (var px:int = 0; px <cols; px++) {
            var box:Box = new Box();
            box.x = 50 + box.width * px;
            box.y = 50 + box.height * py;
            if (px % 2 == 0) {
                box.width = 36;
            } else {
                box.width = 20;
            }
    
            if (py % 2 == 0) {
                box.height = 20;
            } else {
                box.height = 36;
            }
            addChild(box);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to create a mixing for Ext.grid.Panel components. This is how I have
I am trying to create a grid that will show more details (with possibility
I am relatively new to flash. I am trying to create a square grid
I am currently trying to create a sudoku grid in javascript, to do this
I'm trying to create a game. I have a list. I want to take
I am trying to create a silverlight imagebutton control. the xaml and code-behind will
I am trying to create facet grid with the following code p <- ggplot(melted,aes(factor(country)))
So I'm trying to create an 8X8 grid of textboxes. I want to have
I am trying to create a grid like system with div's with content floated
I'm trying to create a dynamic grid using ExtJS. The grid is built and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.