Skip to content

Instantly share code, notes, and snippets.

View caubry's full-sized avatar
🌵

Caroline Aubry caubry

🌵
View GitHub Profile
protected var callback:Function;
public function ConfigLoader( path:String, _callback:Function )
{
this.callback = _callback;
var configLoader:URLLoader = new URLLoader();
configLoader.load( new URLRequest( path ) );
configLoader.addEventListener( Event.COMPLETE, processXML );
}
static const LOCATION_XML:String = "/conf/myXML.xml"; // Location of your XML relative to your application
var controller:ConfigLoader = new ConfigLoader( LOCATION_XML, retrieveXML );
protected function retrieveXML( xml:XML ):void
{
// Do something...
}
var file:File = File.desktopDirectory.resolvePath("myXML.xml"); // This file doesn't exit yet
var stream:FileStream = new FileStream();
stream.open(file, FileMode.WRITE);
stream.writeUTFBytes(newOutput); // newOutput of type XML
stream.close();
@caubry
caubry / panda
Last active December 25, 2015 16:59
Objects in file panda.swf:
[-i] 36 Shapes: ID(s) 28, 30, 33, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 87, 91, 119, 120, 123, 129, 130, 143
[-i] 9 MovieClips: ID(s) 31, 34, 35, 135, 136, 144, 147, 175, 191
[-j] 2 JPEGs: ID(s) 27, 86
[-p] 2 PNGs: ID(s) 29, 32
[-s] 26 Sounds: ID(s) 2-26, 92
[-F] 4 Fonts: ID(s) 88, 126, 149, 181
[-M] 8 Embedded MP3s: ID(s) 31, 34, 35, 136, 144, 147, 175, 191
[-f] 1 Frame: ID(s) 0
[-m] 1 MP3 Soundstream
swfextract panda.swf
Objects in file panda.swf:
[-i] 1 Shape: ID(s) 1
[-b] 2 Binarys: ID(s) 2, 3
[-f] 1 Frame: ID(s) 0
@caubry
caubry / imageCompression.sh
Last active December 13, 2023 14:50
Bash script using pngquant and jpegoptim library to compress PNG, JPG and JPEG, with batch compression as an option.
#!bin/bash
pwd=`pwd`
# Set the quality factor to 80
qualityCompression=80;
# Set a minimum quality factor to 20
qualityLimit=20;
# To run a new compression
second_run_compression=false;
# For batch compression
# !/bin/bash
for NUM in {2..26} 92
do
swfextract -s $NUM output.swf -o "xylo_sounds/sound_$NUM.mp3"
done
# !/bin/bash
for NUM in {2..26} 92
do
swfextract -s $NUM panda.swf -o "sounds/sound_$NUM.mp3"
done
parseJSON = function (weaponJSON) {
var object = JSON.parse(weaponJSON);
console.log(object.frames['chaingun_impact.png'].spriteSourceSize.x);
};