Search Flex Components Free

Custom Search

December 27, 2007

MXML & AS correlations





MXML is the powerful way to simplify the creation of user interfaces.


For example:


In MXML file for creating a button:


<mx:Button x=”166″ y=”56″ id=”btn” label=”Click Me”/>


In AS file for creating a button:


var btn:Button=new Button();


btn.label=”Click Me”;


“Lets see one more example:”


MXML file:


<?xml version=”1.0″ encoding=”utf-8″?>

<mx:Application xmlns:mx=”
http://www.adobe.com/2006/mxml” layout=”absolute”>

<mx:Button id=”btn”/>

</mx:Application>


AS file:


package

{

import mx.core.Application;

import mx.controls.Button;

public class example extends Application{

internal var btn:Button;

public function example(){

super();

btn=new Button();

addChild(btn);

}

}

}





Related Flex Tutorials