jump to navigation

Actionscript 2 with UTF8 and BOM May 25, 2010

Posted by maxmil in : Flash , add a comment

This none has had me baffled for a while….

My AS2 source code files are all UTF-8. However in one of these i have extended characters (its a function that strips accents and the like from a text string).

With MTASC compiler this was working just fine but with the MMC compiler String.indexOf does not work.

After some poking i have found the problem. In order for flash to compile the files correctly it need the Byte Order Mark (BOM) to be included in all Unicode files.

No idea if this is still the case with AS3.

Character conversión in UTF-8 between Actionscript PHP and Mysql April 30, 2008

Posted by maxmil in : Flash,MySql,php , add a comment

Always a tricky one. The best solution that i’ve found is

1) Mysql database and/or tables with the utf-8 character set and utf_general_ci collation.
2) PHP files encoded in UTF8
3) After the initial connection with the database send the querySET NAMES `utf8`

Decimals to octals and vice versa August 1, 2007

Posted by maxmil in : Flash , add a comment

Just had to create a couple of functions in actionscript to transform base 10 numbers in base 8 and vice versa. Maybe this will be of use again to someone at some time.function octal2Decimal(n) {
var valDecimal:Number = 0;
var exp:Number = 1;
var str:String = String(n);
for (var j = str.length; j>0; j--) {
valDecimal = valDecimal+exp*str.substr(j-1, 1);
exp = exp*8;
return valDecimal;
function decimal2Octal(n) {
var rem:Number = n;
var octal:String = "";
var div:Number = 262144;
var sub:Number;
var begin:Boolean = false;
for (var i = 6; i>=0; i--) {
sub = Math.floor(rem/div);
if (sub>0 || begin) {
octal += String(sub);
begin = true;
rem -= sub*div;
div = div/8;
return Number(octal);

What versión of flash do i have installed in my navigator February 25, 2007

Posted by maxmil in : Flash , add a comment

Go here and it’ll tell you http://www.quirksmode.org/js/flash.html