Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/StephanPartzsch/as3-yaul
yet another utility library for ActionScript 3
https://github.com/StephanPartzsch/as3-yaul
Last synced: 3 months ago
JSON representation
yet another utility library for ActionScript 3
- Host: GitHub
- URL: https://github.com/StephanPartzsch/as3-yaul
- Owner: StephanPartzsch
- License: mit
- Created: 2012-04-27T13:09:35.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-07-04T10:21:39.000Z (over 10 years ago)
- Last Synced: 2024-06-23T20:44:49.561Z (5 months ago)
- Language: ActionScript
- Size: 1.65 MB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license.txt
Awesome Lists containing this project
- awesome-actionscript-sorted - as3-yaul - yet another utility library for ActionScript 3 (Utilities / Other Utilities)
README
## as3-yaul
This collection of classes and functions is yet another util library for ActionScript 3. It is the place where reusable parts of code are stored to reuse them easily and to save some time.
For the most part yaul consists of small classes or functions and it is quite obvious how to use them. Some of the resources come with examples to demonstrate their usage.
Yaul contains so far the following functionality:***
### package browser
* **getBrowserVersion** - return a BrowserVersion object which gives you the properties (appCodeName, appName, appVersion, cookieEnabled, platform, userAgent) from the browser navigator object.### package display
* **ClickCatcher** - a Sprite that listens for addedToStage, removedFromStage and resize events and draws an invisible hitarea to catch all mouse events
### package math
This package contains functions which are well known from the flash [Math class](http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Math.html), but they operate much faster.
* **abs** - Returns the absolute value for the number specified by the parameter *value*.
* **ceil** - Returns the ceiling of the number specified by the parameter *value*.
* **floor** - Returns the floor of the number specified in the parameter *value*.
* **round** - Returns the rounded value for the number specified by the parameter *value* (up or down to the nearest integer).### package test
* **hasValidSetterAndGetter** - tests if all getter and setter of an object work as expected
* **hasValidSetterAndGetterExcluding** - tests if all getter and setter excluding given fields work as expected
* **hasValidSetterAndGetterFor** - tests if all getter and setter for given fields work as expectedAll functions work with public properties, explicit and implicit getters/setters.
**Dependencies**
The 'has valid setter/getter' functions are compiled against *hamcrest-as3-only-1.1.3.swc* and *mockito-1.4M5.swc*. The SWCs are included in the [download file](https://github.com/StephanPartzsch/as3-yaul/downloads).
**Usage**
The properties of your class have to be writable, readable, not static and not const to be tested automaticly by the 'has valid setter/getter' functions. Readonly, static and const properties are excluded by default from the matching process.
[Test]
public function test_should_get_and_set_properties_for_all_properties() : void
{
assertThat( new MyObject(), hasValidSetterAndGetter() );
}[Test]
public function test_should_get_and_set_properties_for_specific_properties() : void
{
assertThat( new MyObject(), hasValidSetterAndGetterFor( "fieldC", "fieldD" ) );
}[Test]
public function test_should_get_and_set_properties_with_excluding_properties() : void
{
assertThat( new MyObject(), hasValidSetterAndGetterExcluding( "fieldA", "fieldB") );
}### package text
* **cutTextToFitInTextField** - cuts a given text and extend it with three dots (...) so that it fits in a text field with a fixed width
* **decreaseFontSizeToFitInTextField** - decreases the font size of a given text so that it fits into a text field
* **fitTextInTextField** - fits a given text into a text field by decreasing the font size (up to a minimal font size) and cutting the text with an extension of three dots (...)
* **trim** - trims whitespace from a string***
### Developer
The 'as3-yaul' was developed by [Stephan Partzsch](https://github.com/StephanPartzsch/) and [Peter Höche](https://github.com/PeterHoeche/).