Hi,
Right, code in show event handler is actionscript and {} braces have
different meaning in ActionScript. Compiler doesn't replace
{rp.currentItem.mrcid} with value.
You can use getRepeaterItem(..) function, see code below. I think, it
should work:
..
<mx:VBox label="{rp.currentItem.mrcName}"
show="getItems(event.target.getRepeaterItem().mrcid)">
..
-abdul
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Rajesh Jayabalan
Sent: Saturday, July 02, 2005 2:56 AM
To: [email protected]
Subject: [flexcoders] Re: Repeator to AS method
Hi Abdul,
If I use
<mx:VBox label="{rp.currentItem.mrcName}"
show="getItems({rp.currentItem.mrcid})">
with the '{' then I get the following errors. and it I remove the
'{,}' then the data is undefined.
Rajesh J
8 Errors found.
Error
C:\jboss\server\default\tmp\deploy\tmp22508mr-exp.war\categories.mxml:30
':' expected
Error
C:\jboss\server\default\tmp\deploy\tmp22508mr-exp.war\categories.mxml:30
The statement '' is incomplete.
Error
C:\jboss\server\default\tmp\deploy\tmp22508mr-exp.war\categories.mxml:33
ActionScript 2.0 class scripts may only define class or interface
constructs.
Error
C:\jboss\server\default\tmp\deploy\tmp22508mr-exp.war\categories.mxml:30
The class 'mx.controls.Alert' could not be loaded.
Error
C:\jboss\server\default\tmp\deploy\tmp22508mr-exp.war\categories.mxml:4
ActionScript 2.0 class scripts may only define class or interface
constructs.
Error
C:\jboss\server\default\tmp\deploy\tmp22508mr-exp.war\categories.mxml:5
ActionScript 2.0 class scripts may only define class or interface
constructs.
Error
C:\jboss\server\default\tmp\deploy\tmp22508mr-exp.war\categories.mxml:11
ActionScript 2.0 class scripts may only define class or interface
constructs.
Error
C:\jboss\server\default\tmp\deploy\tmp22508mr-exp.war\categories.mxml:20
Unexpected '}' encountered
--- In [email protected], "Abdul Qabiz" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Please ignore my previous mail, I couldn't see the code properly. Keep
> the code in show event, if you want to invoke HTTPService.send()
> whenever Vbox is shown in Accordion.
>
> There problem here is different, "param" variable is a local variable
in
> getItems(..) function. It needs to be global variable or in same scope
> where HTTPService tag has been declared. As you are binding request
> catId with param.
>
> See the modified code below, where I have declared param in global
> scope.
>
> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
> initialize="appInit()" xmlns="*">
> <mx:Script>
>
> var param:String;
>
> function appInit()
> {
> getMRC.send();
>
> }
>
> function getItems(catid:Object)
> {
> param = String(catid);
> getCatItems.send();
> }
> </mx:Script>
>
> <mx:HTTPService id="getMRC" url="getMarketiingCategories.jsp"
> showBusyCursor="true"/>
>
> <mx:HTTPService id="getCatItems" url="getCategoriesItem.jsp"
> showBusyCursor="true">
> <mx:request>
> <catId>{param}</catId>
> </mx:request>
> </mx:HTTPService>
>
> <mx:Accordion id="accordion" width="75%" height="96%">
> <mx:Repeater id="rp"
> dataProvider="{getMRC.result.mrcategories.mrcategory}">
> <mx:VBox label="{rp.currentItem.mrcName}"
> show="getItems({rp.currentItem.mrcid})">
> <mx:Button label="Button in Vbox
> {rp.currentItem.mrcName}"
> click="alert(event.target.getRepeaterItem() + '
> pressed')"/>
>
> </mx:VBox>
> </mx:Repeater>
> </mx:Accordion>
> </mx:Application>
>
>
> -abdul
>
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED]
On
> Behalf Of Rajesh Jayabalan
> Sent: Saturday, July 02, 2005 2:26 AM
> To: [email protected]
> Subject: [flexcoders] Re: Repeator to AS method
>
> Hi Abdul,
>
> I still am not able to see the value I am sending to my jsp, its
> coming as empty/null value.
>
> Rajesh J
> --- In [email protected], "Abdul Qabiz" <[EMAIL PROTECTED]> wrote:
> > Try using creationComplete event instead of show event in Vbox.
> >
> >
> > -abdul
> >
> > -----Original Message-----
> > From: [email protected] [mailto:[EMAIL PROTECTED]
> On
> > Behalf Of Rajesh Jayabalan
> > Sent: Saturday, July 02, 2005 12:23 AM
> > To: [email protected]
> > Subject: [flexcoders] Repeator to AS method
> >
> > Hi,
> >
> > In my mxml I am using a repeator to process a list and create VBox.
> > When the VBox is shown I need to call a method (getItems) with a
> > parameter from the list so I am using
> >
> > (<mx:VBox label="{rp.currentItem.mrcName}"
> > show="getItems({rp.currentItem.mrcid})">)
> >
> > and in my AS function Iam trying to set the id to a param so my jsp
> > can get it, but my jsp get only blanks.
> >
> > Can anyone tell me what I am doing wrong?
> >
> > Regards
> > Rajesh J
> >
> > Here is my mxml file.
> >
> > <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
> > initialize="appInit()" xmlns="*">
> > <mx:Script>
> > function appInit()
> > {
> > getMRC.send();
> >
> > }
> >
> > function getItems(catid:Object)
> > {
> > var param:String=catid;
> > getCatItems.send();
> > }
> > </mx:Script>
> >
> > <mx:HTTPService id="getMRC" url="getMarketiingCategories.jsp"
> > showBusyCursor="true"/>
> >
> > <mx:HTTPService id="getCatItems" url="getCategoriesItem.jsp"
> > showBusyCursor="true">
> > <mx:request>
> > <catId>{param}</catId>
> > </mx:request>
> > </mx:HTTPService>
> >
> > <mx:Accordion id="accordion" width="75%" height="96%">
> > <mx:Repeater id="rp"
> > dataProvider="{getMRC.result.mrcategories.mrcategory}">
> > <mx:VBox label="{rp.currentItem.mrcName}"
> > show="getItems({rp.currentItem.mrcid})">
> > <mx:Button label="Button in Vbox
> > {rp.currentItem.mrcName}"
> > click="alert(event.target.getRepeaterItem() + '
> > pressed')"/>
> >
> > </mx:VBox>
> > </mx:Repeater>
> > </mx:Accordion>
> > </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
> > Yahoo! Groups Links
>
>
>
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com
> Yahoo! Groups Links
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.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:
http://docs.yahoo.com/info/terms/