Action Script Help

Posted on 2005-04-07
Last Modified: 2010-04-03
I want to display sort of a grid like feature placing my movie clip say 4 columns a cross and 4 rows down.

.  .  .  .
.  .  .  .
.  .  .  .
.  .  .  .

The script I wrote only does diagonal lines...Im not an ace but I think I need to set up constraints or something to that effect....

Can someone help me out?

i = 1;
column = 5; //column spacing location
row = 5; //rows spacing location
amount = 6; // how many times to duplicate
                while(amount>0) {
      duplicateMovieClip ("logo", "logo" add i, 900-i);
      setProperty("logo" add i, _x, Number(column*5));
      setProperty("logo" add i, _y, Number(row*5));
      i = i + 1;
      amount = amount - 1;
      column = column + 3;
      row = row + 3;

Thanks for your help in Advance.
Question by:etterjt
    LVL 27

    Accepted Solution

    var columns = 4; //column spacing location
    var rows = 4; //rows spacing location
    var count = 1;
    for(var row = 0; row < rows; row++){
          for(var col = 0; col < columns; col++){
                var id = "logo" + count;
                logo.duplicateMovieClip(id, 900 - count);
                this[id]._x = col * 5;
                this[id]._y = row * 5;

    Author Comment

    thanks.  I now understand the logic.  A+

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
    The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
    The goal of the tutorial is to teach the user how to how to record live broadcast.
    The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now