//passindata.mxml
?xml version="1.0"?>
mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
mx:Script>
![CDATA[
import mx.managers.PopUpManager;
public var helpWindow:Object;
public function displayForm():void
{
// Array with data for the custom control ComboBox control.
var doctypes:Array = ["*.as", "*.mxml", "*.swc"]
// Create the pop-up and cast the return value of the createPopUp()
// Method to the ArrayEntryForm custom component.
var pop1:ArrayEntryForm = ArrayEntryForm(
PopUpManager.createPopUp(this, ArrayEntryForm, true));
// Set TitleWindow properties.
pop1.title="Select File Type";
pop1.showCloseButton=true;
// Set properties of the ArrayEntryForm custom component.
pop1.targetComponent = ti1;
pop1.myArray = doctypes;
PopUpManager.centerPopUp(pop1);
}
]]>
mx:Script>
mx:VBox>
mx:TextInput id="ti1" text=""/>
mx:VBox>
mx:Button id="b1" label="Select File Type" click="displayForm();"/>
mx:Application>
---------------------------------------------
Create MXML Component.. with the name..ArrayEntryForm.MXML
?xml version="1.0"?>
mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" showCloseButton="true" width="200" close="removeMe();" borderAlpha="1">
mx:Script>
[CDATA[
import mx.controls.TextInput;
import mx.managers.PopUpManager;
// Variables whose values are set by the main application.
// Data provider array for the component's ComboBox control.
[Bindable]public var myArray:Array;
// A reference to the TextInput control in which to put the result.
public var targetComponent:TextInput;
// OK button click event listener.
// Sets the target component in the application to the
// selected ComboBox item value.
private function submitData():void
{
targetComponent.text = String(cb1.selectedItem);
removeMe();
}
// Cancel button click event listener.
private function removeMe():void
{
PopUpManager.removePopUp(this);
}
]]>
mx:Script>
mx:ComboBox id="cb1" dataProvider="{myArray}"/>
mx:HBox>
mx:Button label="OK" click="submitData();"/>
mx:Button label="Cancel" click="removeMe();"/>
mx:HBox>
mx:TitleWindow>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment