2008/10/05

How to See Your AS Code in Flex

Anatomy MXML tag:
//================================================================//
example codes:< id="'btn'" label="Click Me" cornerradius="20" onclick="'....'">
//================================================================//
Tags are Classes: 
import mx.controls.Button; btn:Button=new Button(); addChild(btn);
Attributes are properties:
btn.label='Click Me';
Attributes are styles:
btn.setStyle("cornerRadius", 14);
Attributes are Event Listeners
btn.addEventListener('onclick',someFunction);
//================================================================//

MXML is great for laying out structure, and ActionScript is built for interactivity. In this sample, you see that MXML markup is actually turned into ActionScript by the Flex compiler. Like ColdFusion Meta-Language(CFML) is html-based language transfer java background.

your MXML tag could transfer *.as files in your Flex project by following steps.

First, you open dialog by project>properties.
Second, choose additional compiler arguments under Flex Compiler. then add -keep or  -keep-generated-actionscript parameter at compiler parameters (spearte parameter by space). save the setting.
you could see all *.as used in your project right now in your src/generated folder in Flex Navigator panel.


沒有留言: