How to make a row of 5 objects in the center of the stage

Im trying to add 5 objects in the scene and the entire line of 5 items to be centered on the stage. The objects will be with the same position of Y and a gap of 10px between them.

the object have a Center, enrollment Center poin

Follow it so far, I have this, but it makes the 1st element go in the Center and the rest

for(var k:uint=0;k<5;k++){
                                        var gap = 10
                                var box:Box= new Box()
                                addChild(box);
                                box.x=stage.stageWidth/2 +  ( k*(gap+box.width));
}


the simplest without prior knowledge of widths of the objects is to reposition after initial positioning.  that could require a loop in all objects again, but it is easier to simply add objects to a parent and focus the parent:


var p:Sprite = new Sprite();

var distance = 10;

for (var k: uint = 0; k<>

box: box var = new Box();

p.addChild (box);

Box.x = k *(gap+box.width);

}

p.x =(stage.stageWidth-p.Width) /2+box.width/2;

Tags: Adobe Animate

Similar Questions

  • When you open a new tab, how to make images of recently viewed pages underneath the toolbars?

    When you open a new tab, how to make images of recently viewed pages underneath the toolbars?

    See what-
    http://www.Google.com/support/toolbar/bin/answer.py?answer=115561

  • How to make a stationary State (or equivalent) for the form to change color and reveal some hidden above text...? is there a widget I could use?

    How to make a stationary State (or equivalent) for the form to change color and reveal some hidden above text...? is there a widget I could use?

    There are many solutions. A more simple: put the text and the items colored in the back and put the 'shape' on it. Configuration of the 'shape' become transparent in a stationary state.

  • Hello. Editor of newbie here. If I split a video file into two clips in Premiere Pro and you want then save each one as a different file while exporting to the encoder, how to make sure that they are registered in the form of two different with different

    Hello. Editor of newbie here. If I split a video file into two clips in Premiere Pro and you want then save each one as a different file while exporting to the encoder, how to make sure that they are registered in the form of two different files with different after encoding names?

    Located in and out on a section and that export brands.

    .. .Rinse and repeat for the other section.

    Name each section and where it is exported to separately... and as you wish

  • Can someone tell me how to make my brush confetti white print on the color paper and have no bottom?

    Can someone tell me how to make my brush confetti white print on the color paper and have no bottom?

    Your printer there really white? (This is not a common feature.)

  • Adding objects to the stage &amp; amp; Properties of the acceessing Stadium - I'm a bit confused...

    Hello

    I'm a bit confused about the programming of the display's two-pronged:

    A. What are the best way to add objects to the stage?
    B. how to access the properties of the step.

    I can make these two when the project is a 'Action Script Project', but I have a problem when it is a "Flex project" (for example a MXML file). See the attached files two questions included in the commentary to see exactly what I mean.


    A. What are the best way to add objects to the stage?
    =====================================

    In a project of action script which extends Sprite I can call him addChild()

    In a project MXML I add objects to the scene first, adding them to a UIComponent, then adding that the step.

    1 - is the best way to do it?

    In this doc: http://livedocs.adobe.com/flex/3/html/help.html?content=05_Display_Programming_02.html he says this quote from
    :
    Each SWF file has an ActionScript class associated with it, called the main class of the SWF file. When Flash Player opens a SWF file in an HTML page, Flash Player calls the constructor function for that class and the instance that is created (which is always a type of display object) is added as a child of the Stage object. The main class of a SWF file always extends the Sprite class
  • Flash CC: access a specific object on the stage

    I'm writing the javaScript code to execute with Flash CC.

    How can I access a specific object on the stage? It has a name (square_sym), but I can not read the code. What should I do?

    TIA

    He needs an instance name.

    If there is not a button or a movieclip, right click on the object > click on convert to symbol > select movieclip > ok > in the properties panel, enter an instance name, for example square_mc.

    then on the timeline that contains the button or movieclip you can use:

    This.square_mc to reference the movieclip.  other chronologies, there are also pointers to reference the movieclip

  • dropTarget pronounced of all objects on the stage

    Hey all,.

    Not sure what the best way to do it.  I have a class we will call DropActivity, here is the code

    package com.activitycontrol

    {

    import com.activitycontrol.DropCheck;

    public class DropActivity

         {

    / / Constants:

    / / Public properties:

    / / Private property:

    _selectedClip:object private var;

    / / Initialization:

    public void DropActivity(/*selectedClip:Object*/)

              {

                   

              }

    / / Public methods:

    public public function set selectedClip(selectedClip:Object):void

              {

    _selectedClip = selectedClip;

              }

    public function stopDraggingMe (): void

              {

    var dropCheck:DropCheck = new DropCheck();

    dropCheck.checkAgainst = dropTarget.name; ///***********

    If (dropCheck.canBeDropped is true)

                   {

    _selectedClip.stopDrag ();     

                   }

              }

    / / Protected methods:

         }

    }

    When the stopDraggingMe() method is called by another object (code below), I need to see all the objects on the stage to see the objects on the stage my currently selected movie clip is completed and assign it to the method dropCheck.checkAgainst (which will be checked against a table to see if it indeed can be moved, if so the value canBeDropped to true and therefor (, run it. stopDrag()).  I read using root is not a good practice of coding in AS 3.

    the call to the reproductive stopDraggingme().

    private void setDown(event:MouseEvent):void

              {

    var droppedItem:DropActivity = new DropActivity();

    droppedItem.selectedClip =;

    droppedItem.stopDraggingMe ();

              }

    You cannot use dropTarget, correct?  and you will need to loop through all displayobjects to see who have a positive hitTest to your object has fallen, correct?

  • Positioning and temporarily hide objects on the stage

    (Flash beginner here - bear with me...)

    I have two graphic objects on the stage that overlap between them. The first, I managed to place limits of the document very well. When you add the second object, however, the first object covers the limits so I can't see to align the second object.

    The question: is it possible to temporarily hide an object on the stage so I can see the limits of the scene to the other position? I don't see any option that will allow me to do.

    THX!

    Good looking! Who did. Thank you!

  • How to decide if a selected Flash object is the object of the right

    Hello

    I do a point-and-click Flash game and the objective of the game is to click on the right objects in a room. Say that if the main character says 'find my chair', and the player clicks on the Chair, it's the right object and an audio file is read. If the player clicks on a spoon, it's the bad object and an audio file is read. My question is: How can I do this in Flash (in ActionScript, right)? I did a different layer for each object.

    First you need something that identifies the object that you click and store this information for the purpose of comparison.  Then, you need to have something assigned to each element that has the same exact information are entrusted to him.  If you are using AS3 then you can use a listener of events like MouseEvent.CLICK to clicks and then make use of the MouseEvent currentTarget property to isolate the object that was clicked.

    Suppose you have a movieclip with an instance name of Chair.  You can check for the name of this object against the current name of the object that should be clicked...

    var correctObject:String = "Chair";  You EF it dynamically sort

    chair.addEventListener (MouseEvent.CLICK, testObjectClicked);

    spoon.addEventListener (MouseEvent.CLICK, testObjectClicked);

    function testObjectClicked(evt:MouseEvent):void {}

    if(evt.currentTarget.Name == correctObject) {}

    correct response process

    } else {}

    incorrect process

    }

    }

  • How to make in my user profile? Said the profile cannot be loaded

    HOW TO MAKE IN MY USER PROFILE? WHENEVER I HAVE TO CHECK ON MY PROFILE IT ME GIVES A MESSAGE THAT THE PROFILE CANNOT BE LOADED. IT IS ALSO THE ADMINISTRATOR ACCOUNT.

    Hello

    Please do not post in all capitals

    It makes it very difficult to read

    1st thing to try is the system in safe mode restore to before the problem

    http://www.windowsvistauserguide.com/system_restore.htm

    Windows Vista

    Using the F8 method:

    1. Restart your computer.
    2. When the computer starts, you will see your computer hardware are listed. When you see this information begins to tap theF8 key repeatedly until you are presented with theBoot Options Advanced Windows Vista.
    3. Select the Safe Mode option with the arrow keys.
    4. Then press enter on your keyboard to start mode without failure of Vista.
    5. To start Windows, you'll be a typical logon screen. Connect to your computer and Vista goes into safe mode.
    6. Do whatever tasks you need and when you are done, reboot to return to normal mode.

    If that does not solve it read more

    read the tutorial below

    http://www.Vistax64.com/tutorials/130095-user-profile-service-failed-logon-user-profile-cannot-loaded.html

    When you log on a Windows Vista-based or a Windows 7 computer by using a temporary profile, you receive the following error message:

    The user profile Service has not logon. User profile cannot be loaded.

    http://support.Microsoft.com/kb/947215#letmefixit

    Your user profile was not loaded correctly! You have been logged on with a temporary profile.

    http://support.Microsoft.com/kb/947242

    If you tried to log on to Windows and received an error message telling you that your user profile is damaged, you can try to fix it. You will need to create a new profile and then copy the files from the existing to the new profile. You must have at least three user accounts on the computer to perform these operations, including the new account that you created.

    http://Windows.Microsoft.com/en-us/Windows-Vista/fix-a-corrupted-user-profile

  • How to make a very short page any longer the footer appears so under screen

    I am new to Dreamweaver and having a problem to find how to make a page (contact) very short longer so that the footer appears below the screen.  Currently the footer shows Mid-screen because the page is so short.  Thank you!

    Since you haven't posted any code, I guess that you have a CSS rule in your style sheet main governing the footer.

    You cannot add a margin-top to this rule because it would affect the footers on ALL your pages.

    I suggested a styleblock only on the contact page which would negate the main style sheet on the contact page

    This would be thesection of the contact page.

  • How to make a list of question field with the data type DATE?

    I have a column with the DATE data type. Using forms 6i I want to generate a poplist field of list item with this column while the value of the items in the list of names of days like SATURDAY, SUNDAY, MONDAY. If we change the date to a char data type, it won't work properly, but now with the data type DATE behind him, it gives the following error message

    "FRM-32082: invalid value for given the type of element."
    List WEEKREST
    Article: WEEKREST
    Block: EMPRESTS
    Form: module 3
    FRM-30085: unable to adapt to the shape for the release. »


    Using forms 6i how a list item field type DATE data which may contain names of days?

    Set your date as a hidden field (not shown) column. Create your item list with the names of day of varchar2. Create the list item as a base table field that accepts the values of text in the names of the days. On this area, create a when-validate-item trigger that translated the text into an actual date that it then uses to set the value of the real object of the base table.

  • How to make a video layer in front of the other?

    I'm trying to find how to make a smaller video running at the front of the actual video (for example when players play their game and we see them in the video in the top corner to comment), but I can't find a thing that brings to the front of a sequence or send a return and my smaller video guard staying in the back of all the layers. Please guide me, I'm sorry to ask such a basic question, but I'm looking for hours now.

    Hi Tuztanc,

    You can try to put it on a higher video track in the Timeline?

    Thank you
    Kevin

  • How to make a black &amp; white photo while keeping the subject of the photo in color?

    I'm new to PS photography

    I would like to know how I can make my scene in my black and white photo, while keeping the money reserve changes the color of the picture.

    any help much appreciated.

    Baba HT

    Hi Baba,

    Here are some step by step instructions that show you how to achieve this effect very easily thanks to the quick selection tool and a white adjustment layer to black & white.

    1. open your image in Photoshop. In the toolbar, click the Quick Selection tool and select your topic.

    2 go to Select > refine edge and use the dialog box to clean up your selection - I activated the option Smart Radius and increases the radius of the selection. When you are finished, click OK.

    3 go to Select > Inverse.

    4. locate the Control Panel settings - default, it must be located above the layers (in CS6) Panel, but if you don't, go to window > adjustments. Click the black & white setting icon, as shown below. Your subject will remain in color, but the parameter should turn black and white, as you can see below.

    For more information on the use of adjustment layers, here's a little video happening on the basics:

    If you have any other questions, feel free to post a reply!

    See you soon,.

    Kendall

Maybe you are looking for