cosmodesktop

Happy Flash/Flex Coder

Category: Tips

Scale 9 Grid with Gradient work around!!

Today I’ve try to create a scale 9 shape with gradient fill in its shape and found that when create the scale 9 from IDE the gradient will not slice into scale 9 properly. So the result look like it is stretch. The work around that I found after googling for a while is use [...]

การอ่านค่า flashvars จาก swf ที่ถูกโหลดเข้ามา

ปัญหาในการพยายามโหลดค่า flashvars จาก swf ที่ถูกโหลดเข้ามาภายใน swf อีกตัว เป็นปัญหาที่เรียกได้ว่าน่าปวดหัวไม่น้อยทีเดียว แต่จริงๆ แล้ววิธีแก้ปัญหานั้นไม่ยากครับ หลังจากที่ผมพยายามแก้ปัญหาและหาข้อมูลอยู่พักใหญ่ ในที่สุดก็ได้ข้อสรุป คือ ที่ตัว Main นะครับ เวลาอ่านค่า flashvars จะใช้คำสั่ง var myVar:String = this.root.loaderInfo.parameters.whatever; ในขณะที่ถ้าต้องการอ่านค่า flashvars จาก swf ที่ถูกโหลดเข้ามาจะต้องเปลี่ยนคำสั่งเป็น var myVar:String = stage.loaderInfo.parameters.whatever; การเรียกผ่านตัวแปร stage จะเป็นการเรียกไปยัง display container ของ swf ที่ถูกโหลดเข้ามานั่นเอง และหากยังไม่ได้ ก็ยังมีอีกวิธี โดยการส่งค่าตัวแปรต่างๆ เข้าไปตอนโหลด swf อีกตัวนั่นเอง //:: Store loader info var lInfo:Object = this.root.loaderInfo.parameters; //:: [...]

Today I want to add Hibernate feature to Vista?

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 [...]

ฟันธงโหลดภาษาไทยใน XML ด้วย AS3 จาก ServerSide

หัวข้อนี้ไม่เขียนภาษาไทยคงจะแปลก เพราะเกี่ยวกับการดึงข้อมูลภาษาไทย จากไฟล์ XML หรือจากการส่งข้อมูลจาก Server แบบ XML Format เรื่องของเรื่องคือ พอดีได้มีโอกาสต้องทำงานดึงข้อมูลภาษาไทยมาแสดงบนหน้าเว็บ ซึ่งเนื้องานที่ทำอยู่ทุกที ไม่ค่อยได้ใช้ภาษาไทยเท่าไหร่ สรุปคือ เกิดปัญหาขึ้น แสดงได้บ้าง ไม่ได้บ้าง มี random character แปลกๆ ต่อท้ายข้อมูลที่โหลดมาบ้้าง ทำให้เกิด XML not well-formed ฟ้องขึ้นมา (ตัวอย่าง well formed xml) สุดท้ายไ้ด้ความช่วยเหลือจาก katopz และ joke และทำให้แก้ปัญหาไปได้ จึงอยากเอามาแบ่งปัน เผื่อว่าจะช่วยลดเวลาในการแก้ปัญหาของท่านอื่นๆ ได้ต่อไป ดังนี้ 1. ฝั่ง flash โหลด XML ตามปกติ แต่ห้ามใช้ System.useCodePage = true; ถ้ามีให้ comment ทิ้งไป เนื่องจากเราจะใช้การ encode [...]

Useful HexColor Extract Code

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 >> [...]

Radians & Degrees

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 / [...]