August 13th, 2009
And I can’t find it in the control panel / power management section. After google around then I found the solution.
To disable hibernation:
Click Start. Type “powercfg /hibernate off” and then Press Ctrl+Shift+Enter.
To enable hibernation:
Click Start. Type “powercfg /hibernate on” and then Press Ctrl+Shift+Enter.
A command prompt will appear and disappear. The program doesn’t give you any feedback anyway, so you’re not missing anything.
By press Ctrl+Shift+Enter is a shortcut to run a program as an Administrator.
Tags: Tips
Posted in Tips | No Comments »
February 12th, 2009
This is another fun animation from simple math. Mainly function that I use are:
- linear equation : y = ax + b
- Brownian
- Circle : radius to point
For tweening between each mode was done by TweenLite and the sparking techniq
is base on flash drawing api and linear equation with some tune on the variable.
My Sparker

have fun
Tags: AS3, Experimental, Math
Posted in Experimental, Math | 3 Comments »
January 24th, 2009
หัวข้อนี้ไม่เขียนภาษาไทยคงจะแปลก เพราะเกี่ยวกับการดึงข้อมูลภาษาไทย จากไฟล์ XML หรือจากการส่งข้อมูลจาก Server แบบ XML Format เรื่องของเรื่องคือ พอดีได้มีโอกาสต้องทำงานดึงข้อมูลภาษาไทยมาแสดงบนหน้าเว็บ ซึ่งเนื้องานที่ทำอยู่ทุกที ไม่ค่อยได้ใช้ภาษาไทยเท่าไหร่ สรุปคือ เกิดปัญหาขึ้น แสดงได้บ้าง ไม่ได้บ้าง มี random character แปลกๆ ต่อท้ายข้อมูลที่โหลดมาบ้้าง ทำให้เกิด XML not well-formed ฟ้องขึ้นมา (ตัวอย่าง well formed xml) สุดท้ายไ้ด้ความช่วยเหลือจาก katopz และ joke และทำให้แก้ปัญหาไปได้ จึงอยากเอามาแบ่งปัน เผื่อว่าจะช่วยลดเวลาในการแก้ปัญหาของท่านอื่นๆ ได้ต่อไป ดังนี้
1. ฝั่ง flash โหลด XML ตามปกติ แต่ห้ามใช้ System.useCodePage = true; ถ้ามีให้ comment ทิ้งไป เนื่องจากเราจะใช้การ encode ข้อมูลแบบ UTF-8 ซึ่งจะกำหนดมากจาก xml ที่โหลดเข้ามา หากกำหนดให้ใช้ System.useCodePage จะเป็นการบังคับให้แฟลชใช้การ encode ข้อมูลตาม System default ของเครื่องผู้ใช้ ซึ่งเมื่อส่งข้อมูลมาแบบ UTF-8 แน่นอนว่าภาษาไทยมันจะแสดงไม่ได้อย่างแน่นอน และการเตรียมการฝั่ง Flash จะจบเพียงแค่นี้ (จริงๆ)
ส่วนวิธีการอ่านข้อมูล XML ลองอ่านกระทู้ของน้องก่อ ดูนะครับ เขียนไว้ละเอียดดีครับ
- ทำงานกับฐานข้อมูลแบบ Online ด้วย Flash และ PHP
- Flash+XML ตอนที่ 1
2. ถัดมาส่วนที่เป็นเทคนิคสำคัญในการที่จะทำให้ส่งข้อมูลภาษาไทยสำเร็จ คือ ฝั่ง XML นี่เอง ที่สำคัญอย่างยิ่ง ดังนี้
2.1 ข้อมูลที่ส่งมาทั้งหมด ต้อง encode เป็นแบบ UTF-8 (วิธีแปลงไฟล์เพื่อทดสอบง่ายๆ คือ ใช้ notepad เปิด xml ไฟล์ก่อน หลังจากนั้นเลือก Save As และเลือก Encoding เป็น UTF-8 ก็จะได้ไฟล์ไว้ทดสอบ – credit: katopz)
2.2 ข้อมูลภาษาไทยทั้งหมด ควรที่จะเก็บอยู่ภายใน tag value ของ xml ไม่ใช่ attribute และครอบข้อมูลภาษาไทยทั้งหมดด้วย <![CDATA[ภาษาไทย]]]> (credit: katopz และ joke) เช่น
<xml>
<title><![CDATA[กรุงเทพมหานคร]]></title>
<link>http://www.bangkok.com</link>
</xml>
2.3 ใส่ header ของ XML Data ที่ส่งกลับมาเป็น <?xml version=”1.0″ encoding=”utf-8″ ?>
2.4 หากยังไม่ได้ ให้ตรวจสอบอีกครั้งว่าข้อมูลที่ส่งมา encode เป็น UTF-8
2.5 หากยังไม่ได้ ให้ตรวจสอบอีกครั้งว่าข้อมูลที่ส่งมา encode เป็น UTF-8 และไม่ได้ encode ซ้ำซ้อนเพราะจะทำให้ข้อมูลผิดพลาดได้
2.6 หากยังไม่ได้ ทดสอบด้วยไฟล์ที่ได้มากจาก notepad และ encode ด้วย UTF-8
ถ้าทำตามข้างบนทั้งหมด ผมมั่นใจว่าน่าจะได้อย่างแน่นอนครับ และขอบคุณ katopz และ joke อีกครั้งสำหรับเทคนิคดีๆ ครับ
Tags: AS3, Tips
Posted in Experimental, Tips | 2 Comments »
December 24th, 2008
After googling around I found wp-syntax which I think it’s quite power full and support many programming language (surely Actionscript3). Woooooo, see what it look like.
var canvas_mc:Sprite = new Sprite();
addChild(canvas_mc);
canvas_mc.graphics.beginFill(0xFF0000, .9);
for(var i:int = 0; i<100; i++){
trace("Hello wp-syntax ("+i+")");
canvas_mc.graphics.drawCircle( stage.stageWidth*Math.random(),
stage.stageHeight*Math.random(),
10+50*Math.random() );
}
canvas_mc.graphics.endFill();
Tags: AS3, Experimental, General, wordpress
Posted in Experimental, General | No Comments »
December 23rd, 2008
I’ve watched this movie “The Day The Earth Stood Still” on last Sunday, the movie is ok for me, nothing really surprise but one scene in the movie make me wanna do some experimental in the flash. If you don’t want to be spoiled please skip the next bit that I’m gonna write next. And if you read here that mean you don’t care the spoiled, well the scene that the alien flies try to get in the mirror. The animation is quite cool and I think that is some kind of old trick animation by “Brownian” equation so I’ve done some experimental below:
Simple Brownian Movement:

Adapted version, try to make its come out closer to the film:

(Click anywhere on the stage to restart the animation)
Tags: AS3, Experimental, Math
Posted in BitmapData, Experimental, Math | No Comments »
December 12th, 2008
I’ve submit my code for competition at 25lines but my one still not as good enough for get in the final list, all of the final list are very cool and good to see. By the way, it’s quite fun to try to code. So after failed from the final list, I’m continue working on it a bit more for my fun and try to keep it as 25 lines. The result is quite impress now for me. The quick result is show as the image below:

The idea is using the camera as the eye for flash to sketch your image on screen. If you move and cause the original image which is you compare to the current draw on screen look different then program will blur those different section out and start to draw from the most blur to more clear again. The output also give the feeling of teleport from one place to another you move from one location to another quickly.
warning: for slow machine, this may cook your cpu
Tags: AS3, camera, Experimental
Posted in BitmapData, Math | No Comments »
November 25th, 2008
This code help me solve many cool effect and also shorten my writing. Also sometime it is easily to forget so here is another good tips to note on here
var colour:uint = 0xFF297400;
var A:Number = colour >> 24 & 0xFF;
var R:Number = colour >> 16 & 0xFF;
var G:Number = colour >> 8 & 0xFF;
var B:Number = colour & 0xFF;
// RGB
var colourRBG:uint = (R << 16 | G << 8 | B);
// ARGB
var colourARBG:uint = (A << 24 | R << 16 | G << 8 | B);
Tags: Math, Tips
Posted in Math, Tips | 1 Comment »
November 20th, 2008
This math always come back to me after a certain of time and take me 5 – 10 minutes to think or look around the correct one. So I write this down for myself and others for save time to look around.
radians = degrees * Math.PI / 180
degrees = radians * 180 / Math.PI
P.S.
360 degrees = 2 * Math.PI (radian)
Tags: Math, Tips
Posted in Math, Tips | No Comments »
November 19th, 2008
After have some fun with the first version then I’ve update some math and fine tune some attributes to allow more leaf to be able to render. Next version expect to do something more random and closer to nature.

This version can increase the number of leaf to 60 and able to decrease down to 10. But sorry for auto repeat for increase and decrease button. I’ll add in next version if the next version is happen.
Tags: AS3, Experimental, Math
Posted in BitmapData, Math | No Comments »
November 14th, 2008
This experimental in the night is so fun but right now I’m feeling so sleepy, gotta go sleep and will play more with this one later.

The spiral shape is scaling by using “Fibonacci” number and all animation use TweenMax.
Tags: Math
Posted in BitmapData, Math | 1 Comment »