Wednesday, November 9, 2011

To launch to a new window with the url from the advanced data grid control, using
navigateToURL.


navigateToURL(request:URLRequest, window:String):void

The request argument is a URLRequest object that specifies the destination. The window argument specifies whether to launch a new browser window or load the new URL into the current window. The following table describes the valid values for the window argument:

_self:
Specifies the current frame in the current window.

_blank:
Specifies a new window. This new window acts as a pop-up window in the client’s browser, so you must be aware that a pop-up blocker could prevent it from loading.

_parent: Specifies the parent of the current frame.

_top: Specifies the top-level frame in the current window.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600">
<mx:Script>
<![CDATA[
import mx.events.FlexEvent;

protected function remove_watermark():void
{
//test.removeChildAt(test.numChildren-1);
(test.getChildAt(test.numChildren-1) as TextField).htmlText = " ";
}
protected function navigate():void
{
if( test.selectedItem.Album != null )
{
var urlRequest:URLRequest = new URLRequest(test.selectedItem.Album.toString());
navigateToURL(urlRequest,”_parent”);
}

]]>
</mx:Script>
<!-- <mx:Script>
<![CDATA[
[Bindable]
[Embed(source="assets/sap.png")]
public var sapicon:Class;
]]>
</mx:Script>-->
<mx:AdvancedDataGrid id="test" creationComplete="remove_watermark()">
<mx:dataProvider>
<mx:Object Artist="Jlo" Price="60" Album="enchanted"/>
<mx:Object Artist="Shakira" Price="90" Album="woddoo"/>
</mx:dataProvider>
<mx:columns>
<mx:AdvancedDataGridColumn dataField="Album"/>
<mx:AdvancedDataGridColumn dataField="Price" />
</mx:columns>
</mx:AdvancedDataGrid>

</mx:Application>
}

<mx:AdvancedDataGrid id="test" creationComplete="remove_watermark()"itemClick=”navigate”>
<mx:dataProvider>
<mx:Object Artist="Jlo" Price="60" Album="http://www.google.com"/>
<mx:Object Artist="Shakira" Price="90" Album=" http://www.facebook.com"/>
</mx:dataProvider>
<mx:columns>
<mx:AdvancedDataGridColumn dataField="Album"/>
<mx:AdvancedDataGridColumn dataField="Price" />
</mx:columns>
</mx:AdvancedDataGrid>

</mx:Application>

No comments:

Post a Comment