The accordion in my code is used to display the category names.. assume i have 3 categories(ie.. 3 VBoxes in the accordion).. in each Vbox there is a button named"show products" which on click must display a viewstack containing the products.. the product names come from an Xml.. SO for the first category i have a viewstack and for the second another viewstack and so on.. I will nothave problm using the http service if i dont have a repeater but since i have a repeater how to specify a different viewstack on click of a particular category's button?

Abdul Qabiz <[EMAIL PROTECTED]> wrote:
Can you please explain, what is this code doing and what do you want to achieve? I don't see any ViewStack...
 
 
If you want to dynamically change "assets/category.xml" then you can use HTTPService.
 
 
 
-abdul


From: [email protected] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 03, 2005 2:13 PM
To: [email protected]
Subject: RE: [flexcoders] Dynamically changing the source of xml

hai,
     here is my code. i either want to change the viewstack dynamically or tell if it will be possible to replace the vbox by the images...
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.macromedia.com/2003/mxml" width="100%" height="100%">
 <mx:Metadata>
        [Event("change")]
    </mx:Metadata>
<mx:Script>
<![CDATA[
 var selectedItem: Object;
  var dataObject: Object;
  var BodyStack1;
function changeCurrentView() {
     BodyStack1.selectedChild=tile;
}
]]>
</mx:Script>
 <mx:VBox label="Navigators" marginBottom="8" marginLeft="8" marginRight="8" width="100%" height="100%">
         <mx:Model id="categoryModel" source="assets/category.xml"/>
   
        <mx:Accordion height="100%" width="100%">   
  <mx:Repeater id="catList" dataProvider="{categoryModel.category}">  
         <mx:VBox id="category" label="{catList.currentItem.name}" width="100%" height="500" vScrollPolicy="off">
           <mx:Grid width="100%">
             <mx:GridRow width="57%" height="100%">
               <mx:GridItem width="225">
          <mx:Image id="myImage" width="100%" height="100%" source="images/{catList.currentItem.image}" visible="true" />
                  </mx:GridItem>
               <mx:GridItem width="400">
        <mx:Label text="{catList.currentItem.description}"/>
                  </mx:GridItem>
                </mx:GridRow>
              </mx:Grid>
           <mx:Grid width="100%">
             <mx:GridRow width="57%" height="100%">
               <mx:GridItem width="400">
        <mx:Button label="Show Products" click="changeCurrentView()" width="150"/>
                  </mx:GridItem>
                </mx:GridRow>
              </mx:Grid>
      
         </mx:VBox>
  </mx:Repeater> 
        </mx:Accordion>
     </mx:VBox>  
</mx:Canvas>

Abdul Qabiz <[EMAIL PROTECTED]> wrote:
Hi,
 
Can you post your code so that I can see it and reply in its context?
 
-abdul


From: [email protected] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 03, 2005 12:43 PM
To: [email protected]
Subject: RE: [flexcoders] Dynamically changing the source of xml

thanks.. Your code works well. but in your code u dont have the buttons
inside a repeater.. imagine i have the buttons inside a repeater ,then how can i make the menuitems to appear dynamically again from different XML files?
pls help me with some code..
thanks&regards,
nithya
Abdul Qabiz <[EMAIL PROTECTED]> wrote:
Model is compile time object, which means you can only mention source on
compile time. If you want to load different XML on runtime, you should use
HTTPService instead. What I understand from your code is, you are loading an
xml into a Model and binding Model to MenuBar's dataProvider.

Following is a quick example, that allows to load two different xml data for
MenuBar. You can see, how HTTPService is able to load xml files on runtime
and result is bound to MenuBar dataProvider.

You can find the attached file, place in flex application directory and run
the HTTPServiceExample.mxml.



1) ##HTTPServiceExample.mxml##

<?xml version="1.0" encoding="iso-8859-1"?>
<mx:Application width="800" height="600"
xmlns:mx="http://www.macromedia.com/2003/mxml"  >

    <mx:Script>
        <![CDATA[

        function loadMenudata1()
        {
            service.url = "";
            service.send();
           
        }
       
        function loadMenudata2()
        {
            service.url = "";
            service.send();
        }

        ]]>
    </mx:Script>
   
    <mx:HTTPService id="service" resultFormat="object" url=""
useProxy="false"></mx:HTTPService>
    <mx:MenuBar dataProvider="{service.result}"></mx:MenuBar>
   
    <mx:Button label="load menudata1" click="loadMenudata1()"/>
    <mx:Button label="load menudata2" click="loadMenudata2()"/>

</mx:Application>



2) ##menudata1.xml##

<menuitem label="MenuItem A">
         <menuitem label="SubMenuItem 1-A" />
         <menuitem label="SubMenuItem 2-A" />
</menuitem>


3) ##menudata2.xml##

<menuitem label="MenuItem B">
         <menuitem label="SubMenuItem 1-B" />
         <menuitem label="SubMenuItem 2-B" />
</menuitem>




________________________________

From: [email protected] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 27, 2005 11:53 AM
To: [email protected]
Subject: RE: [flexcoders] Data Model


hai!
     I dont get ur solution.. I am already using a remote object as a data
service.. How should i use a http service in this case? cn u help me with
some code... I am very new to flex thats y i keep buging u a lot.. sorry for
this..
regards,
nithya

Matt Chotin <[EMAIL PROTECTED]> wrote:

      Sorry for not answering sooner.  You should look into using the
HTTPService instead of a Model in this case.  HTTPService can decode XML
into an object structure but does it dynamically instead of statically like
the Model does.

     

      Matt

     

      ________________________________

            From: [email protected]
[mailto:[EMAIL PROTECTED]
      Sent: Thursday, April 21, 2005 10:57 PM
      To: flexcoders
      Subject: [flexcoders] Data Model

     

     

      Hai,

             I have a problem with the data model source. I have a model
which provides data for a menubar.. the source i of the model hard coded..
But i want it to change dynamically during run time.. how can i do this? can
i give something like

      <mx:Model id="theXML"
source="../WEB-INF/Classes/com/jp/amway/shopping/Products/{subcatList.curren
tItem.name}.xml"/>

     

      please help me with the code..

     

      right now the code i am using is:

     

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Panel xmlns:mx="http://www.macromedia.com/2003/mxml"
width="100%" height="500">

     
        <mx:Script>

         <![CDATA[
           var dataObject : Object;
         ]]>
        
          function labelFunc(item) : String
           {
           return item.getProperty("Name");  
           }
        </mx:Script>
         
        <mx:Model id="theXML"
source="../WEB-INF/Classes/com/jp/amway/shopping/Products/cat_Artistry.xml"/
>

           <mx:MenuBar id="menu1" width="100%" dataProvider="{theXML}"
labelFunction="labelFunc"  mouseDown="event.menuItem.attributes.label"/>

      </mx:Panel>

      ________________________________

            Yahoo! Messenger
<http://uk.rd.yahoo.com/mail/tagline_messenger/*http:/uk.messenger.yahoo.com
>  - Communicate instantly..."Ping" your friends today! Download Messenger
Now
<http://uk.rd.yahoo.com/mail/tagline_messenger/*http:/uk.messenger.yahoo.com
/download/index.html> 

________________________________

Yahoo! Messenger
<http://uk.rd.yahoo.com/mail/tagline_messenger/*http://uk.messenger.yahoo.co
m>  - Communicate instantly..."Ping" your friends today! Download Messenger
Now
<http://uk.rd.yahoo.com/mail/tagline_messenger/*http://uk.messenger.yahoo.co
m/download/index.html> 

________________________________

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]
<mailto:[EMAIL PROTECTED]>
       
*      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .





Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now


Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now


Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now

Yahoo! Groups Links

Reply via email to