
Create a dynamic link 217
1. In Source mode, enter the following click property in the <mx:LinkButton> tag (in
bold):
<mx:LinkButton x="30" y="250" label="Select an item and click here for
full post"
click="navigateToURL(new
URLRequest(dgTopPosts.selectedItem.postLink));"/>
The value of the link field of the selected item in the DataGrid control,
dgTopPosts.selectedItem.postLink, is specified in the argument to the
navigateToURL() method, which is called when the user clicks the LinkButton control.
The
navigateToURL() method loads a document from the specified URL in a new
browser window.
2. Save the file, wait until Flex Builder finishes compiling the application, and click the Run
button.
A browser opens and runs the application. Click an item in the DataGrid control and then
click the LinkButton control. A new browser window should open and display the blog
page with the full post.
In this lesson, you used a WebService component to call and pass method parameters to a
SOAP-based web service. You then bound the data returned by the web service to a DataGrid
and a LinkButton control. To learn more, see the following topics in Flex 2 Developer’s Guide:
■ Chapter 44, “Understanding RPC Components”
■ Chapter 45, “Using RPC Components”
NOTE
The navigateToURL() method takes a URLRequest object as an argument, which in
turn takes a URL string as an argument.
Kommentare zu diesen Handbüchern