Space evenly movieclips with different heights?

I have the following code, which works well when all the boxes have the same height. The fundamental point is that I have three boxes on the stage, 10 pixels apart. If you click and drag the boxes above or below the other, they reorganize.

// based off Dynamic Stacking AS3 @ http://blog.soulwire.co.uk/code/open-source/dynamic-stacking

var mcArray:Array = [mcA, mcB, mcC];
var mcSpacing:int = 10;

goStart();

function goStart() {
     for (var i:int = 0; i < mcArray.length; i++) {
          mcArray[i].y = (mcArray[i].height + mcSpacing) * i;
          mcArray[i].addEventListener( MouseEvent.MOUSE_DOWN, boxPress );
          mcArray[i].addEventListener( MouseEvent.MOUSE_UP, boxRelease );
     }
}

function boxPress(e:MouseEvent):void{
     e.currentTarget.startDrag();
     e.currentTarget.parent.addChild(e.currentTarget);
}
          
function boxRelease(e:MouseEvent):void {
     e.currentTarget.stopDrag();
     moveBoxes();
}

function moveBoxes():void {
     mcArray.sortOn( 'y', Array.NUMERIC );
     
     for (var i:int = 0; i < mcArray.length; i++) {
          mcArray[i].x = 350;
          mcArray[i].y = (mcArray[i].height + mcSpacing) * i;
     }
}

How to do it if the boxes are different heights, while keeping the same functionality? I know that magic is in this line:

mcArray[i].height + mcSpacing

But I'm not strong enough math skills to understand.

This line contains the problem, but you can call it magic if you're a glass - half-full type.  If you have different heights, you have to stack things starting with 0 and adding to the height of each object (plus 10) each time.  This line as expected assumes that the height never varies, so it's just multiplying the same height for each new position.

Try...

function moveBoxes (): void {}
mcArray.sortOn ("y", Array.NUMERIC);

var YCourant: Number = 0;

for (var i: int = 0; i< mcarray.length;="" i++)="">
mcArray [i] .x = 350;
mcArray [i] there = currentY;

currentY += mcArray [i] .height + mcSpacing;
}
}

Tags: Adobe Animate

Similar Questions

  • Tables of Images with different heights, causing the removal of Menu

    OK, I posted this issue in the Council of LabVIEW before I realized that it was associated with Vision.  I made some progress, narrowing of the cause, so I thought it would be best to start a new post here.  Here is the original post:

    http://forums.NI.com/T5/LabVIEW/blank-pop-up-menus/m-p/3281194#M958610

    I'm running into a problem with all of my menus of LabVIEW to shutter when I create arrays of images where the heights do not match.  I have attached a vi I created to illustrate the issue.  In this document, I take a starting image and then extract subsets of it.  Because I don't know how much I'll have to check out until the moment of execution, I'm subpictures in an array.  What I've discovered, is that if the heights of subpictures don't match, I get a weird bug that causes all the menus in LabVIEW empty.  This includes all right click pop up in the façade, block, or Project Explorer diagram and drop-down selections as for enums and ring controls.  It also includes the file menu at the top of the window.

    Rerun this vi with subpictures equivalent height or no subpictures corrects hidden menus.  In addition, running IMAQ Dispose (with Boolean true of images) corrects the problem.

    I'm relatively new to the Vision, so I don't know if I'm missing something basic, but please let me know what you think.  Is there a better way to do this?

    Thank you

    Tim

    Hi Tim,.

    Thanks for reporting this problem. I have reported as a bug.

    I recommend using a Cluster or the KING for manual zoom toolbar. If you want to use an array, each element of the array must maintain the same amount of zoom. (Similar to each LED in a table must have the same color.)

    Sorry you came across this bug.

    Kind regards

  • Whenever I connect to my HDTV using vga, I get a BSOD, even tried with different pc tv/cable

    Hello

    Thank you for taking the time to read this! Yesterday that I tried to connect to an HDTV using VGA instead of someone else, worked well. Buy a vga cable today and connected to my 1080 p full hd Phillips and got a BSOD almost instantly. I tried some things and managed to do the work! Played skyrim for a little and left the laptop in sleep mode. Came, open upward and the screen stayed black, nothing I could do to get a Visual.
    Now, whenever I connect the cable I get a BSOD, it works with any other laptop, excludes the cable and television.
    I have updated all drivers in the list, checked my drive for errors using the good chkdsk, smart status on the disk is good, all withdrew. I know for a fact that my laptop works fine with extra monitors, we use all the time on my internship and as stated, it worked yesterday on another TV.
    Features of the laptop:

    ASUS n73jn

    processor Intel i5 460 m
    NVIDIA geforce 335 m
    Windows 7 64 bit
    4 GB ddr3 RAM
    the HDMI port is dysfunctional, just a few flickering screens filled with black lines, that's why I try vga. My guess is the hdmi port is DOA, but did not have a hd tv up to 2 years after purchase.

    News of the capture of blue screen:
    ==================================================
    Dump file: 093012-44382 - 01.dmp
    Crash time: 30/09/2012-18:57:22
    Bug Check String: SYSTEM_SERVICE_EXCEPTION
    Bug check code: 0x0000003b
    Parameter 1: 00000000' c0000005
    Parameter 2: fffff880'074259 cd
    Parameter 3: fffff880'029f90a0
    Parameter 4: 00000000'00000000
    Caused by the driver: igdkmd64.sys
    Caused by the address: igdkmd64.sys + 1e29cd
    Description of the file:
    Product name:
    Company:
    Version of the file:
    CPU: x 64
    Plant address: ntoskrnl.exe + 7f1c0
    Stack address 1:
    The stack address 2:
    Address 3 the battery:
    Computer name:
    Full path: C:\Windows\Minidump\093012-44382-01.dmp
    Number of processors: 4
    Main version: 15
    Minor Version: 7601
    The dump file size: 262,144
    ==================================================
    Thanks for your time!

    Greetings,

    Joachim

    Sorry, I was a little confused with the HDMI and VGA - continues to be the same advice.

    Looks like you have isolated to a hardware problem.  With the Intel graphics card is not posted, I have to wonder if the hardware problem is with the graphics card Intel

    FWIW - we have seen a number of overheating problems with the graphics from nVidia on your model.  Make sure the laptop is on a hard surface - and I would also use a filling of cooling (if possible) to ensure that the system is not overheating.

    Install a new copy of Intel video drivers is probably the most important thing to do now - and ensure that this card appears in Device Manager (and check in the nVidia PhysX tab to see if it appears here - even though I'm not familiar with this program).

    Try the video stress tests here: http://www.carrona.org/addldiag.html
    They can show that there is a hardware problem - but a lot of this will involve what video card works at the time of the test (even once, I don't have a lot of experience to make systems to change video card).

    Good luck!

  • Call taskflow even twice with different parameters - as two regions in JSFF

    Hi all

    I need to reuse a taskflow in two regions of a page JSFF fragment. I will be of different settings for this workflow based on the region. What I see is that the taskflow makes twic, but both the taskflows show the same State (the State for the second set of parameters). Is there a way by which I can assure that the taskflows can be reused for different context on the same page JSFF dynamically.

    Ex. JSFF has 2 regions based on the same taskflow - but the taskflow settings are different for the two regions. Now, when the page runs, the two regions show the same user interface as the second region. It looks like the AM, your were interviewed again and the first run of time VO got overloaded.

    Attempted parameters of transaction taskflow by changing it to "Always start a new Transaction" and it does not work.

    Any suggestions?

    Thank you
    Srini

    Try to select * 'No controller Transaction' * and
    Uncheck the options
    (1) share data with calling taskflow controls
    (2) no savapoint on the entry of work flow

    Thank you
    Nini

  • Master of different heights to match the corresponding page?

    In my site, I have several pages with different heights. Should I create a lot of masters with different heights to match the corresponding page?

    Hello

    You have one create one page of Mater.

    As you add content to pages, the foot moves downwards and will increase the height of the page. So it is not necessary to create multiple master pages.

    Kind regards

    Sachin

  • NATting even address public ip with two periods of internal investigation with different ports

    Hi people,

    Can I use the same public IP for two internal investigation periods different with different ports and I can even user public IP for two periods of different internal investigation with the same ports

    static (inside, outside) tcp 115.248.153.252 192.168.22.19 6303 6303 netmask 255.255.255.255

    static (inside, outside) tcp 115.248.153.252 http 192.168.22.19 http netmask 255.255.255.255

    static (inside, outside) tcp 115.248.153.252 http 192.168.22.20 http netmask 255.255.255.255

    static (inside, outside) 115.248.153.252 tcp https 192.168.22.20 https netmask 255.255.255.255

    static (inside, outside) tcp 115.248.153.252 192.168.22.21 6303 6303 netmask 255.255.255.255

    static (inside, outside) tcp 115.248.153.252 http 192.168.22.22 http netmask 255.255.255.255

    Concerning
    Vesta
    "Everybody is genius." But if you judge a fish by its ability to climb on a tree, he will live his entire life, believing that this is stupid. "

    No, you cannot use the same public ip address NAT on two internal IP address different using the same port.

    static (inside, outside) tcp 115.248.153.252 192.168.22.19 6303 6303 netmask 255.255.255.255

    static (inside, outside) tcp 115.248.153.252 192.168.22.21 6303 6303 netmask 255.255.255.255

    For the static PAT 2 above for example, when traffic is coming to 115.248.153.252 IDE oucederomsurlesecondport 6303, ASA would not know if NAT it back to 192.168.22.19 or 192.168.22.21, because both use the same port.

  • How sensitive divs that are the same height, but with different amounts of content in them?

    I try to use a square twice side by side on my site, and they are sensitive, but as they have a different amount of content in them, they are different height. How do I make them the same height so they dimensionnera always evenly?

    Here is an example of what I want to do.Screen Shot 2015-07-07 at 13.46.58.png

    Here is the css and html I use;

    . Half-width {} content

    Width: 50%;

    Float: left;

    Max-width: 675px;

    Max-height: 338px;

    }

    . {Texthalf}

    Width: 80%;

    height: 80%;

    margin: 10% 10%;

    }

    < div class = "Half-width-Content" style = "" background-color: # 2793 3; ">"

    < div class = "Texthalf" >

    < h1 > < font color = "White" > did you know? < / police > < / h1 >

    < hr > < / h >

    < h6 > < font color = "White" > Hacel has combined 100 years of experience in the lighting industry < / police > < / h6 >

    < hr > < / h >

    < / div >

    < / div >

    And this is what I get now;

    Screen Shot 2015-07-07 at 13.49.42.png

    Thank you

    First - make sure you include a link to the jquery library in your page head tags:

    And then paste the code I provided after him.

  • Find the space between the word with different endings and figures

    Hello

    I am trying to find a way to find spaces between the words and numbers.

    Screen Shot 2014-02-11 at 13.12.34.png

    I'm limited to only use the word "WORD" (capital or small capitals) with different endings like - ing s y and more (using \S+).

    I wrote something like (? i) (? < = WORD\S +) \s(?=\d+) but this does not work due to some limitations of advanced search, I think?

    Any suggestions?

    Peter

    On the other hand, I think that.

  • How to align objects in a path while scattering objects in space even with a decrease in size?

    Hello

    I am facing following problems:

    I'm suppose to draw a spiral, and on this path I want to align a symbol to her (in my case a circle).

    Now, I've found two ways how to him.

    First of all, I can use the brush palette and then apply my symbol to it. but the problem is the size circles are the same, but I need the circle to get the smaller toward the center of the spiral

    Second approach I took, I have used the merge options between two objects that I attach also a path. So I could solve the problem on the reduction of the size but has now another problem appear: the gaps between the circles are not same. I would like to have the same spaces.

    So now my question is: How can I fix this my problem?

    To better visualize my problem, you can consult this screenshot here: http://goo.GL/PEvZI

    If anyone can give me a tip or a trick, I would be very appreciation there.

    Thanks in advance...

    Kind regards

    Natla

    You're welcome, Natla.

    As in many cases, it makes a big difference what is the exact task, and the responses reflect the understanding of it.

    As I understand the images and explanations, it would take a linear growth of the circles, distributed with a constant, possibly no zero distance between them.

    From the I proposed a way to get a linear growth of the circles, with a constant distance (zero or not zero) between them, which would operate independently the proportions, so things could be adjusted.

    The effect of transforming, as suggested by James, gives a more simple solution to the simpler task of exponential growth of circles and zero distance between them; with different proportions it will give increasing distance, or overlap.

  • Both adf shares VO even with different params on the same screen

    Hello everyone,
    My current problem is that I need to create a screen with several sharing the same VO graphics but with different settings for each of them.
    Lets assume I want to use EmployeesVO to show the 2 graphs on the same page jspx.
    A chart will display all the salaries of employees for the "Marketing" Department and the other will show all the salaries of employees for the Department 'IT '.
    Remember, I want them both on the same screen.
    The read-only VO will look like this:
    SELECT First_Name
    Salary
    Employees
    WHERE department_id =: p_dept

    To do this, I did the following:
    For each graph, I created an iterator.
    For each iterator I created an ExecuteWithParams. (a receiver "Depto Marketing" and anther receive "IL Depto")
    For each ExecuteWithParams, I created an InvokeAction.

    When executing the application all the graphs show the same information. All of them show only one (the last in the list of executables InvokeAction) Department.

    The question is: how to keep each graph has their own parameter on the same screen?

    I use Windows 7 x 64 SP1 JDeveloper 11.1.2.1.

    Thanks in advance!

    Why not add 2 instances of the same original version of AM. For each instance of defined the different VC.

  • Disk space is full with 143 GB free space

    Hello

    I found a strange math calculations to Apple here. My disk space is filled with 143 GB free space.

    Here's the new math = 507 GB Apps + 119 movies GB 50 GB + 38 GB Audio 143 GB of space free Photos Plus 500 GB

    I use MacBook Pro (retina, 15 inch, mid-2014) with Mac OS X 10.11.4 running

    Thank you

    Kiran

    Hi Kirin, for more information on the other category in the view of storage , see this support article.

    There seems to be a bug in the about this Mac Look storage tab > system report > storage. It's probably different.

    Omni DiskSweeper can show you the exact size and location of all your files. It will be the inventory of your disc from files that occupy more space. It can also give you a fairer read disk space than the Finder or storage tab of the about this Mac. If you want you can even delete files from OmniDisk Sweeper. But beware, some items may be important for your system.

    For more information about the category others in storage to display, see this support article.

  • ASM diskgroup with different disc size

    Hello

    DB: 10.2.0.4
    Operating system: AIX 5.3 64-bit L

    I have installation on 10g RAC ASM with node 2. It has the only Eve on ASM.

    Total DB size is 250 GB.
    Total size of FRA is 700 GB.

    My FRA diskgroup to archivelog (also holds multiplex controlfile) each size of 50 GB drive. Even if I set the retention period for 1 day, backup to disk, rman getting failed, due to space issues. So I manually delete obsolete data report and rerun backup.

    I want to add the workspace to FRA diskgroup regarding adding disks to FRA diskgroup. But, I have 100 GB drives available , it's not the same waist size of current existing FRA disc (50 GB).

    Here's my question

    (1) that I can Add the size different to the same diskgroup disc ?. If I add, are there performance problems?
    My all data files are out of FRA diskgroup and there are someother diskgroup.

    (2) if FRA diskgroup 50 GB and 100 GB of disks, and then how the archivelog and backup data will be erased?
    Will the data stored up to 50 GB in all disks in FRA, even * 100 GB * disc is?.

    (3) while doing recovery with different size of disk at diskgroup, what kind of problems can I face in performance wise?

    (4) can I remove any diskgroup 50 GB disks and add the 100 GB drive, so that I can increase the size of the disk in the same diskgroup?. I'll remove it and add at the same time.

    (5) add disks redundant external diskgroup , I'm ok with the following query?

    ALTER DISKGROUP FRA add DRIVE ' </dev/rhdsk1 >', </dev/rhdsk2 > ', </dev/rhdsk3 > ';


    Please help me on my doubts above.

    Thank you and best regards,
    Therese

    Hi Sunand,

    (1) can I add different diskgroup disc even size?. If I add, are there performance problems?
    My all data files are out of FRA diskgroup and there are someother diskgroup.

    A minimum of four (Oracle ASM disks) LUNS of equal size and performance is recommended for each disk group

    (2) if FRA diskgroup 50 GB and 100 GB of disks, and then how the archivelog and backup data will be erased?
    Data are saved up to 50 GB in all disks of FRA, same 100 GB drive is it?

    Oracle ASM data distribution policy is based on the ability. Ensure that the Oracle ASM disks in a disk group have the same ability to maintain balance.

    (3) while doing recovery with different size of disk at diskgroup, what kind of problems can I face in performance wise?

    Ensure that all Oracle ASM disks in a disk group have similar performance characteristics and the availability of storage. In configurations of storage with dimmers of mixed speed, for example, 10 K and 15 K rpm, i/o performance is limited by the slow speed control.

    (4) can I remove any diskgroup 50 GB disks and add the 100 GB drive, so that I can increase the size of the disk in the same diskgroup?. I'll remove it and add at the same time.

    Yes. First, you add the 100 GB drive and then remove the drives from 50 GB.

    (5) to add disks to external redundancy diskgroup, I'm ok with the following query?
    ALTER DISKGROUP FRA ADD DRIVE ",", ";

    Redundancy is controlled by the diskgroup. Then simply add the disks.

    e.g ALTER DISKGROUP FRA ADD DISK '/dev/rhdsk1', '/dev/rhdsk2', '/dev/rhdsk3';
    

    See doc below... Here are all your anwser.

    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14231/storeman.htm#i1014729

    Kind regards
    Levi Pereira
    http://levipereira.WordPress.com

  • How to structure the DMA buffer for SMU 6341 DAQ card for analog output with different frequencies on each channel

    I use the outgoing/incoming analog DDK with the DAQ 6341 SMU map.

    The examples, for example aoex5, show a single timer (method outTimerHelper::loadUI), but the example shows the DMA loaded with same size of vector data.

    There is a comment in the outTimerHelper:call rogramUpdateCount, which implies that memory sizes different pad per channel can be used.

    (the comment is: switching between the sizes of the various buffers is not used)

    Nobody knows what should be the format the DMA buffer for data from multiple channels with different frequencies?

    For example, we want a0 with a sinusoid at 1 kHz and a1 with a sine wave of 1.5 Khz.  What looks like the DMA buffer?

    With the same frequency for each channel, the data are interleaved, for example (ao0 #0, ao1 #0; ao0 ao1 #1, #1,...), but when the frequencies for each channel is different, what the stamp looks like?

    Hello Kenstern,

    Data are always intertwined since each card has only a single timing for each subsystem engine.

    To AO, you must specify the number of samples that will be released to the AO. You also specify the number of channels. Because he didn't is that a single engine timing for AO, each AO will be channel will be updated at the same time to update clock tick. Data will be interlaced exactly as shown in the example because each channel AO needs output at each tick of the clock to update. The data itself can change depending on the frequency you want to copy.

    kenstern wrote:

    For example, we want a0 with a sinusoid at 1 kHz and a1 with a sine wave of 1.5 Khz.  What looks like the DMA buffer?

    With the same frequency for each channel, the data are interleaved, for example (ao0 #0, ao1 #0; ao0 ao1 #1, #1,...), but when the frequencies for each channel is different, what the stamp looks like?

    In your example, you must come with an update rate that works for the two waveforms (sine waves of 1 and 1.5 KHz). To get a good representation of a sine wave, you need to update more than 10 x faster than your fastest frequency... I would recommend x 100 if possible.

    Update frequency: 150 KHz

    Channels: 2

    Then create you stamps that include complete cycles of each wave you want to produce based on the frequency of update. These buffers must also be of the same size.

    Buffer 1: Contains data for the sine wave of 1 KHz, 300 points 2 cycles of sine wave

    Buffer 2: Contains data for the sine wave of 1.5 KHz, 300 points, 3 cycles of sine wave

    You can Interleave them as before. When the data are performed through the ADC, they are out different sine waves, even if the AO channels are updated at the same speed.

  • Graph XY overlay multi field with different colors

    Hello

    I want to make a cyclic XY one track loop and plot the graph for each cycle in different colors.

    I want a field like XYgraph2 but with different colors and probably even without this line of tracing. How can I change my schema?

    Thank you for your time and your efforts.

    KOUYATÉ

    Try this.

  • I want to clone my hard drive and this clone allows you to configure a new computer, how do I do this for several PCs with different versions of XP?

    I am trying to replace 15 PCs.  They all have XP because their BONES, bought with different SPs at different times.  They all have been updated to SP3...  They have all MS 2003, upgaded to MS 2007.  I would use a clone as image.  I do not support different key codes?  Although the XP are authentic, I may not all key codes.  My predessor has not keep good records, and stickers on some had labels of Vista.  Even if the PC was bought with XP downgrade.  I need to use XP because of some other software requirements.

    What is the best way to represent all the PC so that I can get back them to my users?

    Hello

    I suggest you to refer to this link and check if it helps:

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_xp-windows_install/cloning-Windows-XP-Pro-to-new-hard-drives-ready-to/b7edf501-6ae6-4bc1-94BB-39a4177d8b71

    It will be useful.

Maybe you are looking for