Posts Tagged ‘Flex’

How to implement Licensing in Flex and AIR

Wednesday, November 4th, 2009

There are a lot of questions about how to implement Licensing in Flex and AIR.

I cannot explain you 100% how it works but below is list of libraries/functions for my solution.

  1. codegenas3 – AS3 library for generating system/machine id.
  2. as3crypto – AS3 library for encryption/decryption.
  3. Local Shared Object – AS3 Class for storing license information (similar to Windows Registry).
  4. Mcrypt – PHP functions for encryption/decryption.

How to show/hide SWF in Firefox without reloading

Thursday, October 8th, 2009

It’s a bug in Firefox that when you hide and then show SWF (Flex or Flash) again, it will be reloaded.

So, this is workaround.

Firstly, do not use “display: none” CSS to hide the div that contains Flash. Use “visibility: hidden ” instead.

What about layout? Yes, it may be a problem due to “visibility: hidden” just hide the div but still reserve space for it.

Therefore, we will fix it by additional CSS which is “width: 0px; height: 0px;”.

There is one side effect, the browser scroll bar will be longer than content  (I’m not sure why, but you may fix it by JavaScript. It’s out of my scope, so please let me know if any).

Conclusion, in case of we have to show/hide SWF and serious about reloading, we will use “visibility: hidden; width: 0px; height: 0px;” instead of “display: none”

In my case, I use jQuery Tabs.  So, I will fix CSS class from

.ui-tabs .ui-tabs-hide { display: none !important; }

to be

.ui-tabs .ui-tabs-hide { visibility: hidden; width: 0px; height: 0px; }

References:
http://pipwerks.com/lab/swfobject/hide-swf/2.0/index.html
http://stackoverflow.com/questions/298342/firefox-restarts-flash-movie-if-enclosing-div-properties-change

Thanks @tvchampion and @dogdoy for help.

HTML Tag in Flex 3

Thursday, June 25th, 2009

เราสามารถใช้ Tag HTML บางตัวได้ใน Flex Control จำพวก Text ต่างๆ โดยแต่ละ Control ก็จะ support Tag แตกต่างกันไป

Adobe Flex 3 Help – Using the htmlText property

อันนี้ของ Flex 2 ครับ

Adobe Flex 3 Stuff

Tuesday, May 19th, 2009

ช่วงนี้ใช้ชีวิตอยู่กับ Flex3 ครับ เลยจดๆว่าเจออะไรบ้าง

น่าจะมีประโยชน์สำหรับ Flex Developer ครับ

Flex 3 Component Explorer

Flex 3 Style Explore

Tour de Flex component explorer

การ Embedding assets (Images, SWF, MP3, Font) ใน Flex Application

Tuesday, July 10th, 2007

การ Embed Asset ต่างๆเข้าไปใน Flex Application โดยรูปแบบที่ Flex support ก็จะมี

Images (multiple instances)
Image (single instance)
Images that stretch with scale-9
Images for use with CSS and skinning
SWF files
SWF Library Assets
Sound files
SVG files
Fonts

ตามไปอ่านกันได้ที่ Adobe – Flex Quick Start Basics: Embedding Assets

Flex 2 Documents

Wednesday, June 13th, 2007

สำหรับ Flex Developer ที่เบื่อกับการเปิด Flex Docs ผ่าน Eclipse เนื่องด้วยมันจะไปแชร์ Memory จาก Eclipse ทำให้ build โปรเจคได้ช้าลงนั่นเอง
ทาง Adobe ได้เตรียม Documents ที่เหมือนกับใน Eclipse ทุกประการให้ทั้งแบบ Online หรือจะ Download ไปดูแบบ Offline นอก Eclipse ก็ได้ครับ

Flex 2 Documentation (2.0.1 update)

Adobe Flash samples

Tuesday, June 12th, 2007

หลายตัวอย่างใน Flex Help จะอ้างอิงไปยัง Flash samples ครับ เช่น FileIO ที่เกี่ยวกับการ upload/download ด้วย Flex/Flash

Adobe Flash samples

Example: Uploading and downloading files with Flex2

Tuesday, June 12th, 2007

ตัวอย่างการ Uplaod และ Download Files จากเว็บของ Adobe ครับ

Example: Uploading and downloading files — Flex 2

ไฟล์ FileIO ในตัวอย่างนั้น download ได้ที่ Flex 2 ActionScript Example

Passing request data to Flex applications (Part 2)

Friday, May 18th, 2007

หลังจากภาคแรกของ Passing request data to Flex applications ที่ใช้ flashVars เป็นตัวกลางในการส่ง Param จากภายนอกเข้าไปใน Flex
แต่นั่นยังไม่ใช่วิธีที่ฉลาดพอ ผมจึงทำการแก้ Template ของ Flex Wrapper เล็กน้อยเพื่อให้ง่ายขึ้น
โดยตั้งใจว่า Wrapper จะส่งต่อ Parameter จาก Web Browser ไปยัง Flex ทั้งหมดโดยไม่ต้องแก้ Code เมื่อมีการเปลี่ยนแปลงแก้ไขจำนวนหรือชื่อ Parameter
ยกตัวอย่าง ถ้า เปิด Web Browser ไปยัง http://127.0.0.1:8080/flex/FlexApp.html?param1=value1&param2=value2
ค่า param1=value1&param2=value2 จะถูกส่งต่อไปยัง Flex Application โดยอัตโนมัติ

วิธีการก็ไม่ยากอะไรครับ ให้แก้ไขไฟล์ index.template.html ที่อยู่ในโฟล์เดอร์ html-template ของ Flex Application
โดยแก้ไขค่า flashvars ที่จะส่งให้กับ AC_FL_RunContent จากเดิมที่เป็น

“flashvars”,’historyUrl=history.htm%3F&lconid=’ + lc_id + ”,

ให้แก้ใหม่เป็น

“flashvars”,’historyUrl=history.htm%3F&lconid=’ + lc_id +’&’+ window.location.search.substring(1),

เท่านี้ Parameter ทุกตัวที่ถูกส่งมาแบบ QueryString หรือ GET Method ก็จะถูกส่งต่อไปยัง Flex Application โดยอัตโนมัติแล้วครับ

Passing request data to Flex applications

Friday, May 18th, 2007

การส่ง Parameters ให้ Flex นั้นมีด้วยกัน 2 วิธีดังต่อไปนี้ครับ

  • Using flashVars
  • Using query string parameters

โดยส่วนตัวผมแล้วจะใช้วิธี flashVars เนื่องจากวิธีที่สองนั้นจำเป็นต้องมี Flex Data Services หรือ Flex Server นั่นเอง

ตามไปอ่านต่อของแต่ละวิธีได้ที่ Passing request data to Flex applications