This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function maxValue( p_array : Array ) : Number { | |
var max : Number = 0; | |
for each(var number : Number in p_array) { | |
if(number > max) { | |
max = number; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function popup(p_url, p_title, p_width, p_height) { | |
var left = (screen.width * .5) - (p_width * .5); | |
var top = (screen.height * .5) - (p_height * .5); | |
var target = window.open(p_url, p_title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=' + p_width + ', height=' + p_height + ', top=' + top + ', left=' + left); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var vec1 : Vector.<String> = new <String>["blue", "gray", "orange"]; | |
var vec2 : Vector.<String> = vec1.concat(); | |
vec1[0] = "foo"; | |
trace(vec1); // foo,gray,orange | |
trace(vec2); // blue,gray,orange |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tea.string | |
{ | |
/** | |
* | |
* Get a random string with alphanumeric and numeric characters. | |
* | |
* @param p_length String length. | |
* | |
* @author Rafael Rinaldi (rafaelrinaldi.com) | |
* @since May 29, 2011 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tea.display | |
{ | |
import flash.display.DisplayObject; | |
import flash.display.DisplayObjectContainer; | |
/** | |
* | |
* Return an <code>Array</code> with the children of any container. | |
* | |
* @param p_target The container you want. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @param p_string String to be repeated. | |
* @param p_times How many times the string will be repeated. | |
* | |
* @return A new instance with the string repeated. | |
* | |
* @author Rafael Rinaldi (rafaelrinaldi.com) | |
* @since 25/03/2011 | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Thanks to Grant Skinner (gskinner.com) | |
var arr : Array = [1,2,3]; | |
var arr2 : Array = [4,5,6]; | |
arr.push.apply(arr, arr2); | |
trace(arr); // 1,2,3,4,5,6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# author: Rafael Rinaldi (rafaelrinaldi.com) | |
# since: Aug 3, 2011 | |
# license: WTFPL | |
# A string with available options | |
options=$@ | |
# Options converted to an array | |
arguments=($options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.rafaelrinaldi.string | |
{ | |
import flash.utils.describeType; | |
/** | |
* | |
* List all properties and values from a object. | |
* | |
* @author Rafael Rinaldi (rafaelrinaldi.com) | |
* @since Aug 9, 2011 | |
* |