Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/folletto/argilla-mosaic
ActionScript 3 dynamic layout library.
https://github.com/folletto/argilla-mosaic
Last synced: 26 days ago
JSON representation
ActionScript 3 dynamic layout library.
- Host: GitHub
- URL: https://github.com/folletto/argilla-mosaic
- Owner: folletto
- Created: 2010-01-10T18:00:27.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2014-07-22T12:08:37.000Z (over 10 years ago)
- Last Synced: 2024-10-10T20:52:27.725Z (about 1 month ago)
- Language: ActionScript
- Homepage: http://intenseminimalism.com
- Size: 141 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Mosaic - AS3 Layout Library
===========================Helper to provide modular alignment between objects.
Each object can be bound to just one other object. New binds will redefine the old one.Usage
-----```
var a = new Mosaic();
a.tile(Mosaic.BOTTOM_RIGHT, Mosaic.TOP_LEFT, sprite1, sprite2);
```You can also add a chain of elements, using the same pair of parameters:
```
a.tile(Mosaic.BOTTOM_RIGHT, Mosaic.BOTTOM_LEFT, sprite1, sprite2, sprite3, sprite4);
```You can use the contract form:
```
a.tile("br", "bl", sprite1, sprite2, sprite3, sprite4);
```To remove:
```
a.untile(sprite2);
```If there are elements bound to the removed element, they will realign "falling"
in the place of the unbound element.Note that normal `addChild()` also works, but it's automatically done on `tile()`:
```
a.addChild(sprite1);
```The Mosaic object supports also an Array-like structure, using this syntax:
```
a.array.name(Mosaic.BOTTOM_RIGHT, Mosaic.TOP_LEFT);
a.array.name.push(sprite1);
obj = a.array.name.pop();
obj = a.array.name.shift();
a.array.name.unshift(sprite2);
a.array.splice(2, 1, sprite3, sprite4);a.array.name[2]; // Positional get (arrya index)
a.array.name["item"]; // Name get (getChildByName shortcut)
```The Mosaic object supports also a "fast" creation for Display Objects, using `mold()`:
```
var obj = Mosaic.mold(TextField, "name", { prop1: "data", onEvent: function(){}, ... })
a.array.name.mold(
[TextField, "name1", { prop1: "data", onEvent: function(){}, ... }],
[TextField, "name2", { prop1: "data", onEvent: function(){}, ... }],
);
```