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.retromodular | |
{ | |
import com.retromodular.listeners.IKeyboardListener; | |
import flash.events.KeyboardEvent; | |
import flash.utils.Dictionary; | |
/** | |
*/ | |
public final class GameKeyboard extends GameSystem |
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 | |
{ | |
public class Singleton | |
{ | |
static public const instance:Singleton = new Singleton(); | |
public function Singleton() | |
{ | |
if( instance ) | |
{ |
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 Example = new function() { | |
var anotherWord = "banana"; | |
return function ExampleConstructor( word ) { | |
this.word = word; | |
// | |
this.toString = toString; | |
this.getStatic = getStatic; | |
} |
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 o; | |
var v; | |
var x = /([0-9]+).([0-9]+).[\w]?([0-9]+)/; | |
try { | |
o = navigator.plugins["Shockwave Flash"]; | |
v = o.description.match( x ); | |
} | |
catch( error ) { | |
try { | |
o = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); |
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 { | |
import com.adobe.utils.AGALMiniAssembler; | |
import flash.display.Bitmap; | |
import flash.display.Loader; | |
import flash.display.MovieClip; | |
import flash.display.Sprite; | |
import flash.display.StageAlign; | |
import flash.display.StageQuality; | |
import flash.display.StageScaleMode; |
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
Array.cast = function( o ) { | |
return Array.prototype.slice.call( o, o ); | |
} | |
// | |
// EXAMPLES | |
// | |
function foo() { | |
// arguments to array |
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
// this is part of my core javascript code, it detects flash and MP4 media playback capabilities | |
window.core = new function() { | |
var document = window.document; | |
var navigator = window.navigator; | |
var flashVersion = null; | |
var flashAvailable = false; | |
var audioAvailable = false; // MP4 | |
var videoAvailable = false; // MP4 |
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
o = document.createElement( "audio" ); | |
if( o.canPlayType ) { | |
audioAvailable = o.canPlayType( 'audio/mp4; codecs="mp4a"' ) == "probably"; | |
} | |
o = document.createElement( "video" ); | |
if( o.canPlayType ) { | |
videoAvailable = o.canPlayType( 'video/mp4; codecs="avc1,mp4a"' ) == "probably"; | |
} | |
// NOTE: The codecs must be double-quoted |
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
// This function SHOULD be called directly by an event listener (see example). | |
// Works in Chrome, Firefox, MSIE, Opera and Safari. | |
window.getEvent = function() { | |
var event = getEvent.caller.arguments[0]; | |
return event ? event : window.event; | |
} | |
// | |
// Example | |
// |
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
if( /MSIE [6-8]\./.test(navigator.userAgent) ) { | |
// These elements will be treated like <span> elements by MSIE, | |
// but you can use CSS to style them like any other element. | |
var elements = [ | |
"article", | |
"aside", | |
"footer", | |
"header", | |
"nav", | |
"section" |
NewerOlder