Example 4 - Mapping MXML attributes to actionscript

There are nothing FVF specific here. You just need to use Flex language reference. Attributes from MXML can be mapped to component property or can be mapped to component style:

package  
{
	import com.fvf.FVFApp;
	import com.fvf.containers.FVFPanel;
	import com.fvf.controls.FVFLabel;
	import com.fvf.controls.FVFList;
	import com.fvf.controls.FVFButton;
	
	public class ExampleApplication extends FVFApp
	{
		public function MyApplication() {
		}
		
		override protected function run() {
			var panel:FVFPanel = new FVFPanel();
			var myButton:FVFButton = new FVFButton();
			var myLabel:FVFLabel = new FVFLabel();
			var myList:FVFList = new FVFList();
			
			panel.title = "Using panel";
			panel.setStyle("left", 5);
			panel.setStyle("right", 5);
			panel.setStyle("top", 5);
			panel.setStyle("bottom", 5);
			
			application.addChild(panel.toDisplayObject());
			
			myButton.label = "dasdasdasdasd";
			myLabel.text = "Simple label";
			myList.dataProvider = ["Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "Item 6", "Item 7", "Item 8"];
			myList.width = 300;
			
			panel.addChild(myButton);
			panel.addChild(myList);
			panel.addChild(myLabel);
		}
	}
}

Last edited Aug 29, 2008 at 2:06 PM by PasalicZaharije, version 4

Comments

No comments yet.