# Align & Distribute Actionscript

**URL:** <https://forum.kirupa.com/t/align-distribute-actionscript/170341>\
**Category:** flash\
**Created:** [November 24, 2005, 8:19pm UTC](https://forum.kirupa.com/t/align-distribute-actionscript/170341 "2005-11-24T20:19:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![interfaced](https://avatars.discourse-cdn.com/v4/letter/i/839c29/32.png) [@interfaced](https://forum.kirupa.com/u/interfaced)\
**Post date:** [November 24, 2005, 8:19pm UTC](https://forum.kirupa.com/t/align-distribute-actionscript/170341/1 "2005-11-24T20:19:10Z")

</div>

Is there a function/library that emulated the align and distrubute functions of the flash environment?  
This would be a really useful script for arranging objects dynamically in a flash file.  
If there is an existing function could you leave it here. If not I will make one and input is welcome!

---

<div class="post-metadata">

**Author:** ![simpleSoft](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@simpleSoft](https://forum.kirupa.com/u/simpleSoft)\
**Post date:** [April 12, 2006, 1:41pm UTC](https://forum.kirupa.com/t/align-distribute-actionscript/170341/2 "2006-04-12T13:41:25Z")

</div>

```auto

public function centerHorizontally(targetMC:Object):Void {
		targetMC._x = Math.round((colorBackground._width/2)-(targetMC._width/2));
}

public function centerVertically(targetMC:Object):Void {
		targetMC._y = Math.round((colorBackground._height/2)-(targetMC._height/2));
}

```

---

<div class="post-metadata">

**Author:** ![interfaced](https://avatars.discourse-cdn.com/v4/letter/i/839c29/32.png) [@interfaced](https://forum.kirupa.com/u/interfaced)\
**Post date:** [April 12, 2006, 4:18pm UTC](https://forum.kirupa.com/t/align-distribute-actionscript/170341/3 "2006-04-12T16:18:38Z")

</div>

I actually figured out how to do it better with flade and springs.

If anyone is interested just go to [http://www.cove.org/flade/](http://www.cove.org/flade/)

---

<div class="post-metadata">

**Author:** ![simpleSoft](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@simpleSoft](https://forum.kirupa.com/u/simpleSoft)\
**Post date:** [April 12, 2006, 6:32pm UTC](https://forum.kirupa.com/t/align-distribute-actionscript/170341/4 "2006-04-12T18:32:33Z")

</div>

I don’t really get what I am to do with all of that. I don’t see any readmes or anything.

---

<div class="post-metadata">

**Author:** ![interfaced](https://avatars.discourse-cdn.com/v4/letter/i/839c29/32.png) [@interfaced](https://forum.kirupa.com/u/interfaced)\
**Post date:** [April 13, 2006, 1:49am UTC](https://forum.kirupa.com/t/align-distribute-actionscript/170341/5 "2006-04-13T01:49:15Z")

</div>

Well it’s kinda complicated, it’s a physics engine

but you can align stuff by making 2 particles and then putting a spring between them. If you don’t know what particle systems are it might be a bit tricky.

I have put my faith in this 2D particle system because it is really cool. I like that eveything is in one environment, and springs help because they adapt.

Sorry if this doesn’t make sense, I will try to have some real code for you later.

---

<div class="post-metadata">

**Author:** ![devonair](https://avatars.discourse-cdn.com/v4/letter/d/3be4f8/32.png) [@devonair](https://forum.kirupa.com/u/devonair)\
**Post date:** [April 13, 2006, 11:34pm UTC](https://forum.kirupa.com/t/align-distribute-actionscript/170341/6 "2006-04-13T23:34:22Z")

</div>

Never used it, but this one looks nice:  
demo:  
[http://www.infragistics.com/design/DesignViewer.html](http://www.infragistics.com/design/DesignViewer.html)  
download (request form):  
[http://www.infragistics.com/downloads/DownloadRequest.aspx?code=NAISAM](http://www.infragistics.com/downloads/DownloadRequest.aspx?code=NAISAM)

---

<div class="post-metadata">

**Author:** ![simpleSoft](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@simpleSoft](https://forum.kirupa.com/u/simpleSoft)\
**Post date:** [April 14, 2006, 1:39pm UTC](https://forum.kirupa.com/t/align-distribute-actionscript/170341/7 "2006-04-14T13:39:02Z")

</div>

That is cool. Thanks for the post devonair.
