<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
public function clicker(cName:String):void {
foolabel.text=cName;
}
]]>
</mx:Script>
<mx:Label id="foolabel" text="foo"></mx:Label>
<mx:Model id="data">
<color>
<colorName>Red</colorName>
<colorName>Yellow</colorName>
<colorName>Blue</colorName>
</color>
</mx:Model>
<mx:ArrayCollection id="myAC" source="{data.colorName}"/>
<mx:Repeater id="myrep" dataProvider="{myAC}">
<mx:Button click="clicker(event.currentTarget.getRepeaterItem());"
label="{myrep.currentItem}"/>
</mx:Repeater>
</mx:Application>
After the user clicks the Yellow button, the application looks like this:
The code in the following example uses the getRepeaterItem()
method to display a specific URL for each Button control that the user clicks. The Button controls must share a common data-driven click handler, because you cannot use binding expressions inside event handlers. However, the getRepeaterItem()
method lets you change the functionality for each Button control.
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
[Bindable]
public var dp:Array = [ { label: "Flex",
url: "http://www.adobe.com/flex" },
{ label: "Flash", url: "http://www.adobe.com/flash" } ];
]]>
</mx:Script>
<mx:ArrayCollection id="myAC" source="{dp}"/>
<mx:Repeater id="r" dataProvider="{myAC}">
<mx:Button label="{r.currentItem.label}" click="navigateToURL(new
URLRequest(event.currentTarget.getRepeaterItem().url));"/>
</mx:Repeater>
</mx:Application>
When executed, this example yields two buttons: one for Flex and one for Flash. When you click the button of your choice, the relevant product page loads in a new browser window.
<script type="text/javascript"></script>
分享到:
相关推荐
Javascript Event Handlers
总结了IE 5 ,页面的所有事件 Dom Event Handlers/Dom 事件处理函数
NULL 博文链接:https://qtlkw.iteye.com/blog/1887380
Event Handling – add event handlers to your components. Menu Editing – visually create and edit menubars, menu items and popup menus. Morphing – convert one component type into another.
EventHandler<Event>[] eventHandlers=new DisruptorEventHandler[]{new DisruptorEventHandler()}; DisruptorPublisher dp=new DisruptorPublisher(1024, eventHandlers); dp.start(); for (int i = 0; true;...
on with in-depth code examples to discover firsthand how to exploit the rich query capabilities that Rx provides and the Rx concurrency model that allows you to control both the asynchronicity of your...
flexpaper_handlers.jsflexpaper_handlers.jsflexpaper_handlers.js
This application demonstrates how to use the Format and Parse event handlers when data binding Windows Form controls. The Format event fires when the data is transferred the data source to the bound ...
You will dive into advanced techniques such as manipulating time in data-flow, customizing operators and provider and how to Use the concurrency model to control asynchronicity of code and process ...
handlers.js
All application logic resides in these event handlers: logic to accept and validate user input, to perform data access and storage, and to provide feedback by updating the UI. The whole application ...
Chapter 11 Working with Chart Event Handlers Chapter 12 Accessing Data Programmatically Part IV Integrating BIRT Functionality into Applications Chapter 13 Understanding the BIRT APIs Chapter 14 ...
The last chapter looked at the ...event handlers. We also explain the relationship between the code generated for you by the Visual Studio .NET Forms Designer and the code that you must write yourself.
The MVC project chapters dumped the old JavaScript-like event handlers for the sleek new streams interface, and the chapter on testing reflects the extensive changes in testing now available in Dart....
✔ Event Handlers ✔ Flux Pattern ✔ One Way Data Flow ✔ Presentational vs Container ✔ Third Party Integration ✔ Passing Function To setState() ✔ Decorators ✔ Feature Flags ✔ Component Switch ✔...
event handlers. We also explain the relationship between the code generated for you by the Visual Studio .NET Forms Designer and the code that you must write yourself. vb版的哈,别下错了
OSSEventManager is short for "Office SharePoint Server 2007 Event handler Manager", it's a winform tool to deploy some list item event handlers into SharePoint lists. 本工具用于部署SharePoint 2007列表...
Adding-Event-Handlers_lesson 学习如何使用事件处理程序和JavaScript的.addEventListener()方法的课程