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
private function myNewIsNaN(val:Number): Boolean | |
{ | |
return val != val; | |
} | |
val != val; // inline isNaN() |
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
titleTF.addEventListener(FocusEvent.FOCUS_IN, onFocusIn); | |
titleTF.addEventListener(FocusEvent.FOCUS_OUT, onFocusOut); | |
function onFocusIn(event:FocusEvent):void { | |
setTimeout(event.target.setSelection, 50, 0, event.target.text.length); | |
} | |
function onFocusOut(event:FocusEvent):void { | |
event.target.setSelection(0,0); | |
} |
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
textfield.addEventListener(KeyboardEvent.KEY_UP, keyHandler); | |
private function keyHandler(event:KeyboardEvent):void { | |
if(event.type == KeyboardEvent.KEY_UP && event.keyCode == Keyboard.ENTER) { | |
event.target.text = event.target.text.replace("\r", ""); | |
} | |
} |
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
<object data="stage.swf" width="400" height="300" type="application/x-shockwave-flash" style="width:400px; height:300px;"> | |
<param name="movie" value="stage.swf"/> | |
</object> |
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
// here's a quick code snippet to replace windows-style line breaks (CRLF, or carriage return, line feed) with a standard | |
// actionscript new line character. | |
var newText:String = oldText.replace(/\r\n/g, "\n"); | |
// and here's a snippet to replace all multiple line breaks with a single new line character: | |
var newText:String = oldText.replace(/[\r\n]+/g, "\n"); | |
// for example, the preceding code would change the following string: | |
// a | |
// |
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 max:Number = Math.max.apply(null, randomList); | |
/* | |
An array's push method is capable of taking any number of arguments (meaning statements like this are valid: array.push(1,2,3,4)). Thus, if we call that method using apply and put in the sliced array all of the resulting items will be "concatenated" onto the end of the array, in one, single super-fast operation. | |
*/ | |
array.push.apply( array, array2 ); |
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
/* | |
Left bit shifting to multiply by any power of two | |
Approximately 300% faster. | |
*/ | |
x = x * 2; | |
x = x * 64; | |
//equals: | |
x = x << 1; |
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
// tinting | |
var colorTransform : ColorTransform = bmp.transform.colorTransform; | |
colorTransform.color = 0x3b1c4d; | |
bmp.transform.colorTransform = colorTransform; | |
// get URL of page where swf is embedded | |
function get currentURL():String | |
{ | |
var url:String; | |
if (ExternalInterface.available) { |
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
//1.27323954 = 4/pi | |
//0.405284735 =-4/(pi^2) | |
/********************************************************* | |
* low precision sine/cosine | |
*********************************************************/ | |
//always wrap input angle to -PI..PI | |
if (x < -3.14159265) | |
x += 6.28318531; |
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 paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters; | |
var clickTAG:String = String(paramObj["clickTAG"]); | |
box_mc.addEventListener(MouseEvent.CLICK, openBanner); | |
function openBanner(event: MouseEvent) : void { | |
flash.net.navigateToURL(new URLRequest( clickTAG ), "_blank"); | |
} | |
box_mc.useHandCursor = true; |
OlderNewer