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 3632974
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:35:37+00:00 2026-05-19T00:35:37+00:00

I’m looking for an alternative way to position a bunch of objects. Here is

  • 0

I’m looking for an alternative way to position a bunch of objects.

Here is my code:

private var orderContainer:Sprite;
private var currentOrder:uint = 1;
private var orderArray:Array;
private var scroller:uint;
private var xPos:uint;
private var yPos:uint;
    .....

    xPos = 55;
    yPos = 30;

    if (currentOrder == 7){                      winkelwagenContent.TestBtn.addEventListener(MouseEvent.CLICK, clickHandler);
        scroller++;
        xPos = 700*scroller;
        yPos = 60;
        teller = 1;
        currentOrder = 1;
    }
        orderContainer.x = xPos;
        orderContainer.y = yPos;
                        xPos+=270;
                        if( teller % 2 == 0){
                            if(scroller >0){
                                xPos = (700+(teller*8))*scroller;   
                            }else{
                                xPos = 55+(teller*8);   
                            }
                            yPos+=100;
                        }
                    teller++;
                        currentOrder++;
                }

    private function clickHandler(e:MouseEvent):void{
                for each(var order:Object in orderArray){
                    TweenLite.to(order, .5,{x:order.x-60});
                }
            }

Basicly what i want is that the objects(ordercontainer) are added to my movieclip in 2 collumns, so 1 left, 1 right, move the y-position down to below the 2 i just added and repeat.
till i get 3 2-collumns under eachother, when it reaches this, the yPosition should get reset to the top and the xPosition should move to the right so i can create a 2-column again next to it, again to 3 2-collumns, reset the yPositon again and repeat till all my objects are added, the amount of objects is variable so the calculation should be flexible.
Its working with the code i have but i have a feeling that i am making it way to complicated again.

You will see that the xPosition adds (teller*8) this is just because my allignment should be slightly diagonal on the yPosition.

There is also a tween attached to a button wich makes all the objects move to the left so the next collumn is visible(this isnt working very well thou, no idea why).

so to summ it up it should go like this:

**(1)**     **(2)**    **(7)**     **(8)**
**(3)**     **(4)**    **(9)**     **(10)**
**(5)**     **(6)**    **(11)**     **(12)**

numbers are for the order the objects are added.

  • 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-19T00:35:38+00:00Added an answer on May 19, 2026 at 12:35 am

    Here’s one solution. Suppose you have an array of movieclips called objs.

    const colNum:int = 2;
    const rowNum:int = 3;
    var offset:int = 0;
    while (objs.length)
    {
        for (var j:int=0; j<rowNum; j++)
        {
            for (var i:int = 0; i<colNum; i++)
            {
                if (objs.length)
                {
                    var nextObj:MovieClip = objs.shift();
                    nextObj.x = (offset+i) * nextObj.width;
                    nextObj.y = j * nextObj.height;
                }
            }
        }
        offset+=colNum;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I'm parsing an XML file, the creators of it stuck in a bunch social
I have a bunch of posts stored in text files formatted in yaml/textile (from

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.