>> new URLRequest(movieCollection.link)

new URLRequest (movieCollection.getItemAt (event.rowIndex - 1).link)

I believe, rowIndex (from dobleClick ListEvent) is not zero-based?

That might work? You get the row-index in double-click event. You need to use that index to find the
corresponding record in Collection..

-abdul

On 9/4/06, pioplacz <[EMAIL PROTECTED]> wrote:

I'm having some problems and can't really figure out a way of do it.
What i want to do is a doubleclick event in tilelist. On doubleclick
i want to create a link. Every item rendered in tilelist have
diffrent link. But cannot get it to work. I have created a
doubleclick event in tilelist. Everything work so far but i cannot
get the dynamic link to work.

here is my code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
horizontalAlign="center" verticalAlign="middle"
backgroundGradientColors="[#000000, #000000]"
width="100%" height="100%"
creationComplete="movieService.send()"
viewSourceURL="srcview/index.html">
<mx:HTTPService id="movieService"
url="" href="http://192.168.25.200/PHP/katalog.php" target="_blank" >http://192.168.25.200/PHP/katalog.php" useProxy="false"
result="srv_results(event)"/>
<mx:Style>
LinkButton {
rollOverColor: #333333;
color: #ffffff;
textRollOverColor: #ffffff;
}
VScrollBar {
highlightAlphas: 0.23, 0;
fillAlphas: 0.6, 0.72, 0.63, 0.69;
fillColors: #000000, #333333, #666666,
#333333;
}
HScrollBar {
highlightAlphas: 0.23, 0;
fillAlphas: 0.6, 0.72, 0.63, 0.69;
fillColors: #000000, #333333, #666666,
#333333;
}
ApplicationControlBar {
dropShadowEnabled: true;
shadowDirection: center;
highlightAlphas: 0.26, 0.05;
fillAlphas: 0.22, 1;
fillColors: #000000, #333333;
backgroundAlpha: 1;
}
ComboBox {
backgroundAlpha: 0.53;
color: #ffffff;
borderColor: #999999;
cornerRadius: 3;
highlightAlphas: 0.23, 0;
fillColors: #333333, #000000, #000000,
#333333;
useRollOver: true;
alternatingItemColors: #000000, #000000;
}
</mx:Style>
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.collections.ArrayCollection;
import mx.events.ItemClickEvent;
// Import Event and URLRequest classes.
import flash.events.Event;
import flash.net.URLRequest;

public function srv_results(event:ResultEvent):void
{
//Alert.show(ObjectUtil.toString
(event.result) );
movieCollection =
event.result.helakatalog.katalog as ArrayCollection;
movieCollection.filterFunction=processFilter;
}
[Bindable]
private var movieCollection:ArrayCollection;

// Filter function
public function processFilter
(item:Object):Boolean
{
var result:Boolean=false;

// If no filter text, or a match, then true
if (!item.title.length
|| item.title.toUpperCase().indexOf
(filterInput.text.toUpperCase()) >= 0)
if (!item.genres.length
|| item.genres.toUpperCase().indexOf
(genresInput.text.toUpperCase()) >= 0)
result=true;

return result;
}
private function textChange():void
{
movieCollection.refresh();
}
public var u:URLRequest;

// Event listener to open URL using the navigateToURL()
method.
private function handleClick(eventObj:Event):void {
u = new URLRequest(movieCollection.link);
navigateToURL(u);
}
]]>
</mx:Script>
<!-- An ArrayCollection with an array of objects. -->
<mx:ArrayCollection id="genres">
<mx:Array>
<mx:Object label="" data=""> <mx:Object label="Action" data=""> <mx:Object label="Animerat" data=""> <mx:Object label="Drama" data=""> <mx:Object label="Komedi" data=""> <mx:Object label="Thriller" data=""> </mx:Array>
</mx:ArrayCollection>

<mx:states>
<mx:State name="Grid">
<mx:RemoveChild target="{tilelist1}"/>
<mx:AddChild relativeTo="{mainVbox}"
position="lastChild">
<mx:DataGrid width="100%"
height="80%" dataProvider="{movieCollection}" editable="false"
borderStyle="none">
<mx:columns>
<mx:DataGridColumn
headerText="Titel" dataField="title"/>
<mx:DataGridColumn
headerText="Kategori" dataField="genres"/>
<mx:DataGridColumn
headerText="År" dataField="year"/>
<mx:DataGridColumn
headerText="Utgivare" dataField="publisher"/>
<mx:DataGridColumn
headerText="Länk" dataField="link"/>
</mx:columns>
</mx:DataGrid>
</mx:AddChild>
<mx:RemoveChild target="{dockedBar}"/>
<mx:AddChild relativeTo="{mainVbox}"
position="lastChild" target="{dockedBar}"/>
<mx:SetEventHandler target="{stchange}"
name="click" handler="currentState=''"/>
</mx:State>
</mx:states>
<!-- Define the effects for the transitions between states --
>
<mx:transitions>
<!-- Define the transition from the base state to the Grid
state.-->
<mx:Transition id="toGrid" fromState="*" toState="Grid">
<mx:Sequence target="{mainVbox}" >
<mx:Parallel target="{mainVbox}">
<mx:WipeUp duration="1000"/>
</mx:Parallel>
</mx:Sequence>
</mx:Transition>

<!-- Define the transition from the Grid state to the base
state.-->
<mx:Transition id="toDefault" fromState="Grid" toState="*">
<mx:Sequence target="{mainVbox}" >
<mx:Parallel target="{mainVbox}">
<mx:WipeRight duration="1000"/>
</mx:Parallel>
</mx:Sequence>
</mx:Transition>
</mx:transitions>
<!-- Transition effects END -->

<mx:VBox width="90%" height="100%" horizontalCenter="0"
verticalCenter="20" id="mainVbox">
<mx:TileList width="100%" height="80%" paddingRight="10"
paddingLeft="10" paddingBottom="5" paddingTop="5"
itemRenderer="thumbnail" dataProvider="{movieCollection}"
horizontalCenter="0" color="#ffffff"
backgroundColor="#ffffff" rollOverColor="#333333" top="19"
borderStyle="none"
backgroundAlpha="0.0" id="tilelist1"
doubleClickEnabled="true" itemDoubleClick="handleClick(event);"/>
<mx:ApplicationControlBar id="dockedBar" dock="true"
width="100%">
<mx:HBox horizontalAlign="right" paddingBottom="5"
paddingTop="5">
<mx:Image source="assets/zoom.png" autoLoad="true"
height="100%" verticalAlign="middle" scaleContent="false"/>
<mx:TextInput id="filterInput" text="" change="textChange
()" width="166"/>
<mx:Spacer width="100%"/>
<mx:Image source="assets/color_swatch.png"
autoLoad="true" height="100%" verticalAlign="middle"
scaleContent="false"/>
<mx:Text text="Kategori" color="#ffffff" fontSize="12"
fontFamily="Arial" fontWeight="bold" textAlign="left"/>
<mx:ComboBox id="genresInput"
dataProvider="{genres}" enabled="true" color="#ffffff"
change="textChange()"/>
</mx:HBox>
<mx:HBox horizontalAlign="right" width="100%"
paddingBottom="5" paddingTop="5">
<mx:LinkButton id="intlink" label="Download" />
<mx:LinkButton id="stchange" label="Change State"
click="currentState='Grid'"/>
<mx:Text text="FilmKatalog Ver.2 BETA" color="#ffffff"
fontWeight="bold" fontSize="12" fontFamily="Arial"/>
</mx:HBox>
</mx:ApplicationControlBar>

</mx:VBox>

</mx:Application>


__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to