|
|
YOUR FEEDBACK
Did you read today's front page stories & breaking news?
SYS-CON.TV SYS-CON.TV WEBCASTS |
TOP COLDFUSION LINKS Feature
Your First Adobe Flex Application with a ColdFusion Backend
The wow factor plus usability
Jul. 19, 2007 01:30 PM
Digg This!
Page 3 of 4
« previous page
next page »
Adding a Form To Insert Items <mx:ComboBox id="priorityList"> Going back to the main application file (mytodolist.mxml), switch to the design view and drag a new panel and inside drag your EditForm component. At this point, your main application should have a list of tasks and a form to add tasks. But the form doesn't send the new task data to the server yet. Using Events To Communicate Between Components First you need to make the form button respond to the click event. You'll implement a function called addItem() that will be invoked when the user clicks on the submit button: <mx:Button label="Add task" id="addButton" click="addItem()"/> The function must create a new event called saveItemEvent. Store the new task in the event and dispatch it so that other components that might be listening for this event can act on it. <mx:Script> Now you must make other components listen to that event. In the main application file, you created a method setUp() that was invoked when the application was completely loaded. In that same method you can specify the main application as a listener to any number of events, including the "saveItem" event your form is dispatching. addEventListener("addItem",saveTask); saveTask and taskDone are functions that will be called whenever the application gets notices about the "addItem" and "setAsDone" events. saveTask simply sends the request to the server by using one of the methods defined in the RemoteObject tag: private function saveTask(event:ItemClickEvent):void{ Similarly, the setAsDone function sends a save request, but ensures that the task is set as done before sending the Task object: private function taskDone(event:ItemClickEvent):void{ Page 3 of 4 « previous page next page »
CFDJ LATEST STORIES . . .
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
|
SYS-CON FEATURED WHITEPAPERS MOST READ THIS WEEK |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||