# A small AS3 library to help with event handling and layouts..and some other things

**URL:** <https://forum.kirupa.com/t/a-small-as3-library-to-help-with-event-handling-and-layouts-and-some-other-things/326864>\
**Category:** flash\
**Created:** [January 17, 2012, 9:49am UTC](https://forum.kirupa.com/t/a-small-as3-library-to-help-with-event-handling-and-layouts-and-some-other-things/326864 "2012-01-17T09:49:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bwhiting](https://avatars.discourse-cdn.com/v4/letter/b/50afbb/32.png) [@bwhiting](https://forum.kirupa.com/u/bwhiting)\
**Post date:** [January 17, 2012, 9:49am UTC](https://forum.kirupa.com/t/a-small-as3-library-to-help-with-event-handling-and-layouts-and-some-other-things/326864/1 "2012-01-17T09:49:12Z")

</div>

Summary:  
Includes function to help align display objects against each other and an event system to give you a bit more freedom and power whilst reducing how much you type…

Please try it out and let me know any feedback or comments! I threw it together because I have found it very useful and thought someone else might be able to benefit. Suggestions and improvements are welcome.

More Detail:

> **[As3 short-cut library :- bwhiting swc](http://blog.bwhiting.co.uk/?p=266)**
>
> updated: 17.01.2012 Quick follow-on from the previous post. Added a few more features/functions that I use so feel free to give it a whirl see how you get on, please feedback with any problems or s…

Download:  
[http://code.google.com/p/bwhiting/downloads/list](http://code.google.com/p/bwhiting/downloads/list) click -\> bwhiting v1.1

Docs:  
[http://bwhiting.co.uk/bwhiting/](http://bwhiting.co.uk/bwhiting/) click -\> com.bwhiting.utilities

Sample Code:

```php

//aligns this to the stage (defaults to middle - centre)
align(this, stage);

//aligns this to the stage, top left
align(this, stage, [0, 0]);

//aligns this to the stage, top centre
align(this, stage, [0.5, 0]);

//aligns this to the stage, top centre with and y offset of +25
align(this, stage, [0.5, 0], [0, 25]);

//adds a Click listener to mc which calls the handleClick function
//and also passes in mc as a parameter
addListener(mc, MouseEvent.CLICK, handleClick, mc);

function handleClick(mc:MovieClip):void
{
    trace(mc);
}

```

If you have any questions fire away!

:pleased:
