Code Monkey home page Code Monkey logo

as3-layout-manager's Introduction

AS3 Layout Manager

About

LayoutManager is a simple way to align and distribute display objects. Use the place method with an Align and arr parameters.

Usage

When using a LayoutManager instance (or it's "place" static instance), you must provide the alignment options and an array with the list of display objects to align/distribute. The first object in the Array will be used as reference to align all other objects.

Basic usage (Using the "place" global function, which acts as an static instance of LayoutManager): var sp1 :Sprite = new Sprite() var sp2 :Sprite = new Sprite() addChild(sp1) addChild(sp2)

place(Align.DISTRIBUTE_RIGHT,[sp1, sp2]) 
// will place sp2 by the right side of sp1 using the sp1.x + sp1.width as reference..

You can also use a Stage instance as a reference: place(Align.CENTER,[stage, sp]) // will put the sp in the center of the stage. Be careful with object with read only properties.

Available alignment and distribution options are:

  • DISTRIBUTE_RIGHT, DISTRIBUTE_LEFT, DISTRIBUTE_UP & DISTRIBUTE_DOWN
  • RIGHT, LEFT, TOP & BOTTOM
  • CENTER, CENTER_HORIZONTAL & CENTER_VERTICAL
  • GRID

Additional Options

Using more than one Alignment property at once: place(Align.BOTTOM | Align.DISTRIBUTE_RIGHT,[sp1, sp2]) // will put sp2 aligned by base and to the right side of sp1.

Grouping display objects place(Align.DISTRIBUTE_RIGHT,[sp1, [sp2, sp3]]) // Will place sp2 and sp3 together to the right of sp1, but won't change sp3 position to the right side of sp2.

License & Credits

2009-10 Cássio S. Antonio, based on the work by Igor Almeida (http://www.ialmeida.com) and Pedro Moraes (http://pedromoraes.net)

AS3 Layout Manager is released under the Open Source MIT license, which gives you the possibility to use it and modify it in every circumstance.

as3-layout-manager's People

Watchers

 avatar  avatar

Forkers

gamedesigngmbh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.