Sometimes you need to do a bunch of similar tasks at once (create similar display objects, render stuff, reindex pools etc), but often this may be a pain due to performance limits (which may result in poor user experience) and that’s where the queue pattern comes to the rescue. I’ve wrote a simple thought useful util for that purpose.
I was curious, which of those would be quicker in the “copying objects” battle — bytearray / for in loop.
Foreseeing your possible thoughts, “yes” i do realize that those methods actually differ (bytearray copies the entire object, uses describeType etc), but still curiosity takes over
And, frankly, i was surprized with the results. See it for yourself.
It’s been a while since i last posted in my blog thx to the holidays and the the enormous num of projects that’ve fallen down. One of my lastest projects was to build a swf course for an LMS using the SCORM standart. That’s when i’ve ran across Philip Hutchison’s blog and his SCORM project. After a few days of SCORM researches and running through the pipwerks SCORM solution, i came up with the idea to make an extention of it, which would fully implement SCORM 1.2 and 2004 “from the box” in the nearest future (currently a beta yet it works). [to be continued...]
So, here’s my version of the SCORM implementation for as3:
Recently i had to align tons of UIComponents with scale and even rotation defined. And so, i decided to write a small static class that would really facilitate my life. I called it AlignUtil. That’s it for now. All links are listed bellow. Hope it helps someone. Cheers ^_^
ps: btw i decided to switch my devs license to MIT, so from now on u r free to use the source codes for whatever u want purpose.
Well, i’m not a js-developer actually, however i had to write a small tooltip in js 2day and i thought that some of you would probably find it usefull. Won’t post the source code here this time, but the demo and source archive are still available @see the links below.
In case u need to save utf8 data to a csv or xls file, mind that those formats do not support utf8 encoding.
Say, u’ve got to save a cyrillic text to a csv file:
// A sample cyrillic, bulgarian text, for exmaple
var utf8String:String = "Аз съм българче. Обичам наште планини зелени...";
// Try to save the file in utf8 charset and then
// open it with Microsoft Excel
var file:FileReference = new FileReference();
file.save(utf8String, "utf8_test.csv");
And here’s the result:
But don’t hurry to google for an as3 charset encoding library, as there’s a simple way to solve this issue:
// A sample cyrillic, bulgarian text, for exmaple
var utf8String:String = "Аз съм българче. Обичам наште планини зелени...";
// csv, xls appear to work only with the ascii
// and windows-like charsets, so as the string is
// cyrillic, we'll use the cyrillic (Windows) charset 'windows-1251'
// which codename's 'x-cp1251' according to the adobe's as3 reference.
var bytes:ByteArray = new ByteArray();
bytes.writeMultiByte(utf8String, "x-cp1251");
var file:FileReference = new FileReference();
file.save(bytes, "cp1251_test.csv");
Now we got the expected result:
Really simple, but still there might be someone who’d need it.