Expand my Community achievements bar.

SOLVED

FLex : Creating and accessing session variables

Avatar

Level 2
Hi all,



Good morning folks.

Am new to FDS and using Flex 2.0



I have collection hotel_list. and have a datagrid mapped to
it , which has a 'book Now' button against each row(hotel).

On click of the 'book Now' Button , i want to pass the hotel
details in that particular row to next page,.

Can i create session variable and access the session
variables in the next page in client/server side.

How can i do that..?






Pls any one advice me on creating session variables and acessing
the same in another page?

Can any one post the sample code?




My code is as follows..



<mx:Script>



<![CDATA[



import flash.net.navigateToURL;

public function OnBook_click(hcode:String):void{

var request:URLRequest = new
URLRequest("/quick_search/booking.mxml");

var uv:URLVariables = new URLVariables();

uv.hotelcode=hcode;

request.data=uv;

navigateToURL(request,"_self");

}

</mx:Script>





<mx:DataGrid id="dg" width="100%" rowHeight="38"
styleName="GridColumnText"

dataProvider="{hotel_details}"
enabled="{!ds.commitRequired}"
creationComplete="fill_hotelDetails()"

verticalScrollPolicy="{mx.core.ScrollPolicy.OFF}"
rowCount="10" height="404">

<mx:columns >

<mx:DataGridColumn dataField="hotel_address"
headerText="Hotel Name"

headerStyleName="DynamicLabel" width="300" wordWrap="true"
editable="false"/>



<mx:DataGridColumn id ="pr_rate" dataField="prdt_rate"
headerText="Rate"

headerStyleName="DynamicLabel" paddingRight="10"
editable="false" width="50" />



<mx:DataGridColumn dataField="hotel_status"
headerText="Availabilty"

headerStyleName="DynamicLabel" editable="false"
width="75"/>



<mx:DataGridColumn headerText="Book Now" editable="false"
dataField="hotel_code"

headerStyleName="DynamicLabel" width="75"
sortable="false">

<mx:itemRenderer>

<mx:Component>

<mx:HBox width="25%" horizontalCenter="0"
horizontalAlign="center"

styleName="GridColumnText" paddingTop="5">

<mx:Button id="book" label="Book Now"
click="outerDocument.OnBook_click (data.hotel_code)" />

</mx:HBox>

</mx:Component>

</mx:itemRenderer>

</mx:DataGridColumn>

</mx:columns>

</mx:DataGrid>



Instead of passing the values to booking.mxml as request
parameters .. is there any way to set session variables ?

pls any one help me..





thx in advance

Ambili Surendran

1 Accepted Solution

Avatar

Correct answer by
Level 4
Have a look at Shared Objects, I think these are the sort of
thing you are after. I think the "Specifying a path" subtopic
should be particularly relevant for sharing the variables/objects
between the two swf files.




Livedocs
- Shared Objects




View solution in original post

2 Replies

Avatar

Correct answer by
Level 4
Have a look at Shared Objects, I think these are the sort of
thing you are after. I think the "Specifying a path" subtopic
should be particularly relevant for sharing the variables/objects
between the two swf files.




Livedocs
- Shared Objects




Avatar

Level 2
Hi Robert,



first of all, thank u for reply..

Shared Object concept worked very well..



But if u came across anything like session variables in flex.
please do post it..



thnx,

Ambili.