RE: [flexcoders] passing data from jsp page to flex app
Hai, I tried ur code but item is not getting added to the cart. I dont understand the reason. please can u help?Abdul Qabiz [EMAIL PROTECTED] wrote: Hi Nithya, Both of Flex applications can communicate using LocalConnection. See the modified code below: 1) ##app.mxml## ?xml version="1.0" encoding="utf-8"? mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*" initialize="onAppInit()" creationComplete="iFrame.visible=true" mx:Script ![CDATA[ var receiving_lc:LocalConnection; function onAppInit() { receiving_lc = new LocalConnection(); receiving_lc.addItemToCart = mx.utils.Delegate.create(this, addItemToCart); receiving_lc.connect("cartConnection"); } function addItemToCart(itemObj) { cart.addItem(itemObj); } ]]/mx:Script mx:Model id="catalog" source="catalog.xml"/ mx:HBox width="100%" height="100%" mx:Panel title="Tile" width="350" height="100%" panelBorderStyle="roundCorners" mx:TileList id="tile" dataProvider="{catalog.product}" width="100%" height="100%" cellRenderer="Thumbnail" itemWidth="120" itemHeight="108" change="iFrame.source=tile.selectedItem.path"/ mx:DataGrid id="cart" dataProvider="{catalog.product}" mx:columns mx:Array mx:DataGridColumn columnName="name" headerText="Name"/ mx:DataGridColumn columnName="price" headerText="Price"/ /mx:Array /mx:columns /mx:DataGrid /mx:Panel mx:Panel title="Content" width="400" height="100%" marginTop="1" marginBottom="1" marginLeft="1" marginRight="1" IFrame id="iFrame" width="100%" height="100%"/ mx:ControlBar mx:CheckBox id="cbVisible" label="IFrame Visible" selected="true" click="iFrame.visible=cbVisible.selected"/ /mx:ControlBar /mx:Panel /mx:HBox /mx:Application 2) ##popup.jsp## %@ taglib uri="FlexTagLib" prefix="mm"%htmlheadmeta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"titleProduct Detail/title/head bodymm:mxml border="1"mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" initialize="onAppInit()" mx:Script var cart; var _lc:LocalConnection; function onAppInit() { _lc = new LocalConnection(); } function addRow() { //if (name.text != "") cart.addItem( {name: name.text, orderno: orderno.text} ); if(name.text != "") _lc.send("cartConnection", "addItemToCart", {name: name.text, orderno: orderno.text}); } /mx:Script mx:VBoxmx:Text id="name" text="Prod 1" /mx:Text id="orderno" text="#0011"/mx:Button label="Add" click="addRow()"//mx:VBox/mx:Application/mm:mxml/body/html Also check out LocalConnection documentation for more help. Hope that helps... -abdul From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of nithya karthikSent: Saturday, June 11, 2005 12:04 PMTo: flexcodersSubject: [flexcoders] passing data from jsp page to flex app hai, i have a flex appl that would call a jsp page. in the jsp page i have an embedded mxml witha button "add". when i trigger that it must get added to my mxml page outside jsp page. how to do this? my code is as below: mxml: ?xml version="1.0" encoding="utf-8"? mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*" creationComplete="iFrame.visible=true" mx:Model id="catalog" source="catalog.xml"/ mx:HBox width="100%" height="100%" mx:Panel title="Tile" width="350" height="100%" panelBorderStyle="roundCorners" mx:TileList id="tile" dataProvider="{catalog.product}" width="100%" height="100%" cellRenderer="Thumbnail" itemWidth="120" itemHeight="108" change="iFrame.source=tile.selectedItem.path"/ mx:DataGrid id="cart" dataProvider="{catalog.product}" mx:columns mx:Array mx:DataGridColumn columnName="name" headerText="Name"/ mx:DataGridColumn columnName="price" headerText="Price"/ /mx:Array /mx:columns /mx:DataGrid /mx:Panel mx:Panel title="Content" width="400" height="100%" marginTop="1" marginBottom="1" marginLeft="1" marginRight="1" IFrame id="iFrame" width="100%" height="100%"/ mx:ControlBar mx:CheckBox id="cbVisible" label="IFrame Visible" selected="true" click="iFrame.visible=cbVisible.selected"
[flexcoders] passing data from jsp page to flex app
hai, i have a flex appl that would call a jsp page. in the jsp page i have an embedded mxml witha button "add". when i trigger that it must get added to my mxml page outside jsp page. how to do this? my code is as below: mxml: ?xml version="1.0" encoding="utf-8"? mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*" creationComplete="iFrame.visible=true" mx:Model id="catalog" source="catalog.xml"/ mx:HBox width="100%" height="100%" mx:Panel title="Tile" width="350" height="100%" panelBorderStyle="roundCorners" mx:TileList id="tile" dataProvider="{catalog.product}" width="100%" height="100%" cellRenderer="Thumbnail" itemWidth="120" itemHeight="108" change="iFrame.source=tile.selectedItem.path"/ mx:DataGrid id="cart" dataProvider="{catalog.product}" mx:columns mx:Array mx:DataGridColumn columnName="name" headerText="Name"/ mx:DataGridColumn columnName="price" headerText="Price"/ /mx:Array /mx:columns /mx:DataGrid /mx:Panel mx:Panel title="Content" width="400" height="100%" marginTop="1" marginBottom="1" marginLeft="1" marginRight="1" IFrame id="iFrame" width="100%" height="100%"/ mx:ControlBar mx:CheckBox id="cbVisible" label="IFrame Visible" selected="true" click="iFrame.visible=cbVisible.selected"/ /mx:ControlBar /mx:Panel /mx:HBox /mx:Application Jsp code: %@ taglib uri="FlexTagLib" prefix="mm"%htmlheadmeta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"titleProduct Detail/title/head bodymm:mxml border="1"mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"mx:Scriptvar cart; function addRow() { if (name.text != "") cart.addItem( {name: name.text, orderno: orderno.text} ); } /mx:Script mx:VBoxmx:Text id="name" text="Prod 1" /mx:Text id="orderno" text="#0011"/mx:Button label="Add" click="addRow()"//mx:VBox/mx:Application/mm:mxml/body/html When i click on the add button in jsp page it should get added in my flex datagrid outisde the jsp page. I dont know how i shoule refer to the grid. pls help.Send instant messages to your online friends http://uk.messenger.yahoo.com Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] passing data from jsp page to flex app
Hi Nithya, Both of Flex applications can communicate using LocalConnection. See the modified code below: 1) ##app.mxml## ?xml version="1.0" encoding="utf-8"? mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*" initialize="onAppInit()" creationComplete="iFrame.visible=true" mx:Script ![CDATA[ var receiving_lc:LocalConnection; function onAppInit() { receiving_lc = new LocalConnection(); receiving_lc.addItemToCart = mx.utils.Delegate.create(this, addItemToCart); receiving_lc.connect("cartConnection"); } function addItemToCart(itemObj) { cart.addItem(itemObj); } ]]/mx:Script mx:Model id="catalog" source="catalog.xml"/ mx:HBox width="100%" height="100%" mx:Panel title="Tile" width="350" height="100%" panelBorderStyle="roundCorners" mx:TileList id="tile" dataProvider="{catalog.product}" width="100%" height="100%" cellRenderer="Thumbnail" itemWidth="120" itemHeight="108" change="iFrame.source=tile.selectedItem.path"/ mx:DataGrid id="cart" dataProvider="{catalog.product}" mx:columns mx:Array mx:DataGridColumn columnName="name" headerText="Name"/ mx:DataGridColumn columnName="price" headerText="Price"/ /mx:Array /mx:columns /mx:DataGrid /mx:Panel mx:Panel title="Content" width="400" height="100%" marginTop="1" marginBottom="1" marginLeft="1" marginRight="1" IFrame id="iFrame" width="100%" height="100%"/ mx:ControlBar mx:CheckBox id="cbVisible" label="IFrame Visible" selected="true" click="iFrame.visible=cbVisible.selected"/ /mx:ControlBar /mx:Panel /mx:HBox /mx:Application 2) ##popup.jsp## %@ taglib uri="FlexTagLib" prefix="mm"%htmlheadmeta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"titleProduct Detail/title/head bodymm:mxml border="1"mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" initialize="onAppInit()" mx:Script var cart; var _lc:LocalConnection; function onAppInit() { _lc = new LocalConnection(); } function addRow() { //if (name.text != "") cart.addItem( {name: name.text, orderno: orderno.text} ); if(name.text != "") _lc.send("cartConnection", "addItemToCart", {name: name.text, orderno: orderno.text}); } /mx:Script mx:VBoxmx:Text id="name" text="Prod 1" /mx:Text id="orderno" text="#0011"/mx:Button label="Add" click="addRow()"//mx:VBox/mx:Application/mm:mxml/body/html Also check out LocalConnection documentation for more help. Hope that helps... -abdul From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of nithya karthikSent: Saturday, June 11, 2005 12:04 PMTo: flexcodersSubject: [flexcoders] passing data from jsp page to flex app hai, i have a flex appl that would call a jsp page. in the jsp page i have an embedded mxml witha button "add". when i trigger that it must get added to my mxml page outside jsp page. how to do this? my code is as below: mxml: ?xml version="1.0" encoding="utf-8"? mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*" creationComplete="iFrame.visible=true" mx:Model id="catalog" source="catalog.xml"/ mx:HBox width="100%" height="100%" mx:Panel title="Tile" width="350" height="100%" panelBorderStyle="roundCorners" mx:TileList id="tile" dataProvider="{catalog.product}" width="100%" height="100%" cellRenderer="Thumbnail" itemWidth="120" itemHeight="108" change="iFrame.source=tile.selectedItem.path"/ mx:DataGrid id="cart" dataProvider="{catalog.product}" mx:columns mx:Array mx:DataGridColumn columnName="name" headerText="Name"/ mx:DataGridColumn columnName="price" headerText="Price"/ /mx:Array /mx:columns /mx:DataGrid /mx:Panel mx:Panel title="Content" width="400" height="100%" marginTop="1" marginBottom="1" marginLeft="1" marginRight="1" IFrame id="iFrame" width="100%" height="100%"/ mx:ControlBar mx:CheckBox id="cbVisible" label="IFrame Visible" selected="true" click="iFrame.visible=cbVisible.selected"/ /mx:ControlBar /mx:Panel /mx:HBox