Hai,
   Thanks alot abdul.. It works well.. Thank u so much . ur code was very helpful.
thanks and regards,
nithya

Abdul Qabiz <[EMAIL PROTECTED]> wrote:
Hi Nithya,
 
Just checked and found that everything seems to be working fine. I am not sure, why it is not working on your machine.
 
Run the attached example on your machine and see if it is working. I made slight changes like, removed cellRenderer="Thumbnail" from TileList attributes because I don't have Thumbnail renderer.
 
But if it runs there then your code might have some problems...
 
-abdul
 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of nithya karthik
Sent: Monday, June 13, 2005 11:49 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] RE: [flexcoders to Abdul] passing data from jsp page to flex app- not working. Pls help. urgent

yes exaclty.  on click of an image in the tille list the popup opens.
so how do i fix the problem? what has to be done? please help.. I have not used local connection previously so am not able to fix it. can u help me with the code?
 
thanks,
nithya

Abdul Qabiz <[EMAIL PROTECTED]> wrote:
So your app.mxml loads first and on clicking some button popup.jsp is opened in a frame?
 
It is not working, because app.mxml might be loading after popup.jsp?
 
-abdul


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of nithya karthik
Sent: Monday, June 13, 2005 11:29 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] RE: [flexcoders to Abdul] passing data from jsp page to flex app- not working. Pls help. urgent

Yeah! Sure.
I am posting the code now.
 
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>
popup.jsp:
<%@ taglib uri="FlexTagLib" prefix="mm"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Product Detail</title>
</head>
<body>
<mm: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:VBox>
     <mx: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>
IFrame.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.macromedia.com/2003/mxml"
    resize="doLater(this, 'moveIFrame')"
    move="doLater(this, 'moveIFrame')">
    <mx:Script>
        private var __source: String;
        function moveIFrame(): Void {
            var pt={x:0, y:0};
            this.localToGlobal(pt);
            getURL("_javascript_:moveIFrame("+pt.x+","+pt.y+","+this.width+","+this.height+")");
            //fscommand("moveIFrame", pt.x+","+pt.y+","+this.width+","+this.height);
        }
        function set source(source: String): Void {
            if (source) {
                __source = source;
                getURL(source, "myFrame");
            }
        }
        function get source(): String {
            return __source;
        }
        function set visible(visible: Boolean): Void {
            super.visible=visible;
            if (visible)
                getURL("_javascript_:showIFrame()");
                //fscommand("showIFrame");
            else
                getURL("_javascript_:hideIFrame()");
                //fscommand("hideIFrame");
        }
    </mx:Script>
</mx:Canvas>
 
I dont get any error but i dont undrstand y the item doesnt get added.. Pls tell me where i am going wrong  and y it doesnt work..

Abdul Qabiz <[EMAIL PROTECTED]> wrote:
Nithya,
 
It is tested code and it worked for me. I don't post code without testing, but I guess there might be some other problem. Can you please post your code again, I want to see how have you incorporated it?
 
Also tell us the flow of application, how popup is opened etc.
 
-abdul


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of nithya karthik
Sent: Monday, June 13, 2005 10:44 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] RE: [flexcoders to Abdul] passing data from jsp page to flex app- not working. Pls help. urgent

hai,
   Abdul, in tried running ur code. But item doesnt get added to the cart. I dont understand the reason. pls can u help? this is very urgent.
Is there any other way of doing it? help me with the code..
Regards,
nithya

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"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Product Detail</title>
</head>
<body>
<mm: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:VBox>
     <mx: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 karthik
Sent: Saturday, June 11, 2005 12:04 PM
To: flexcoders
Subject: [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"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Product Detail</title>
</head>
<body>
<mm:mxml border="1">
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:Script>
  var cart;
        function addRow() {
            if (name.text != "") cart.addItem( {name: name.text, orderno: orderno.text} );
        }     
 </mx:Script>
<mx:VBox>
 <mx: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

Send instant messages to your online friends http://uk.messenger.yahoo.com

Send instant messages to your online friends http://uk.messenger.yahoo.com

Send instant messages to your online friends http://uk.messenger.yahoo.com

Send instant messages to your online friends http://uk.messenger.yahoo.com


Yahoo! Groups Links

Reply via email to