- cach bitmaps when possible
- use correct object types: int and unit instead of Number if possible
- set mouseEnabled and mouseChildren to fals for items that don’t use mouseevents
- keep only the objects that you use and when you use them. Assign null when nolonger needed
- Bitwise math
performance checklist AS3
March 25th, 2009 § 0
scraping your pc for mp3 files
January 19th, 2009 § 0
The following is a simple dos trick to create a playlist of all your mp3’s.
- go to the start menu
- click run
- enter cmd => this opens a black dos window
- type dir /b/s *.mp3 > c:\mp3list.m3u
When this command finishes, a file will be created under c: with a list of all your mp3 files.
The m3u file is a plain text file with links to all your music. Some audio applications us this format for playlists.
PDFlib basics
October 22nd, 2008 § 0
$imagefile = “mybackground.tif”;
$outfilename = “”; //empty if you want to work in memory, else use filename
$p = PDF_new();
PDF_set_parameter($p, “license”, “your licensenr”);//call before anything else
PDF_set_parameter($p, “errorpolicy”, “return”);
PDF_set_parameter($p, “textformat”, “utf8″); // use utf8
//mysql_real_escape_string breaks variables with utf8 data
if (PDF_begin_document($p, $outfilename, “”) == 0) {
die(”Error: ” . PDF_get_errmsg($p));// if you can’t create the document return the error
}
PDF_set_info($p, “Creator”, “My name”);// place your name inside the pdf info
PDF_set_info($p, “Title”, “My title”); // give the pdf a title
PDF_begin_page_ext($p, 595, 842, “topdown”); // begin a page, these are settings for A4 size. coordinates start top left
$font = PDF_load_font($p, “Helvetica”, “unicode”, “”); // set the font
if ($font == 0) {
die(”Error: ” . PDF_get_errmsg($p)); // return errormessage if fontsettings are wrong
}
PDF_setfont($p, $font, 10);
/* place image in the background*/
$image = PDF_load_image($p, “auto”, $imagefile, “”);
if ($image == 0) {die(”Error: ” . PDF_get_errmsg($p));} // if failed, return the errormessage
PDF_fit_image($p,$image, 1, 842, “”); // place the image
PDF_close_image($p, $image);
/* textflow example*/
$mytext = “this is<nextline>some text<nextline>on multiple lines”;
$mytextflow = PDF_create_textflow($p,$mytext, “fontname=arial fontsize=8 encoding=unicode leading=12″);
PDF_fit_textflow($p, $mytextflow, 289, 122, 400, 400, “”);
/* working with fit_textline */
$optlist1= “boxsize={355 14} position={top left}”; // box is 355 width and 14 height, draw text top left
PDF_fit_textline($p,”test for fit_textline”, 36, 120, $optlist1);
/*draw rectangle*/
PDF_rect($p, 36, 755, 520, 107);
PDF_stroke($p);
PDF_end_page_ext($p, “”); // end of page
PDF_end_document($p, “”); // end of document
// $document = pdf_get_buffer($p); use this to capture the pdf from memory ->$outputfile should be empty
PDF_delete($p);