Hi all,

I'm having some major trouble with FLEX at the moment, even more so
since it's for university!

Anyway:

Basically, what I'm doing is using this XML:
http://ws.audioscrobbler.com/1.0/user/tommyhaych/topartists.xml and
displaying the top 10 artists in a repeater. Each artist is
represented by a checkbox and added to an array when ticked. 

That array is eventually sent to a php file for subsequent decoding.

For the last few days however, when I try submitting that array, I get
this:


==========================

[RPC Fault faultString="Default decoder could not decode result"
faultCode="Client.CouldNotDecode" faultDetail="null"]

..which is really hard to understand what I'm doing wrong. 

I'll post my code anyway and hopefully someone might see whats going
here...

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" 
        creationComplete="lastListened.send();"
viewSourceURL="srcview/index.html">
        
        
<mx:Script>
        <![CDATA[
                
                import mx.collections.ArrayCollection;
                import mx.rpc.events.ResultEvent;

                
                
                [Bindable]
                private var tracks:ArrayCollection = new ArrayCollection();
                
                [Bindable]
             private var artistList:ArrayCollection;


          
                private function trackRPCResult (event:ResultEvent):void{
                        tracks = event.result.topartists.artist;
                        
                }
                
           public function modifyArray(item:Object):String{
                if(cBox.data != null){
                    return cBox.data;
                }
                
                return cBox.data+ " ( artist = "+cBox.data+")";;
            }
                
           
        ]]>
        
</mx:Script>
        <mx:HTTPService id="lastListened"
                       
url="http://ws.audioscrobbler.com/1.0/user/tommyhaych/topartists.xml";
                        result="trackRPCResult(event)"
                        />
                        
<mx:HTTPService id="addArtist" url="php/addArtist.php"
useProxy="false" method="POST">


         <mx:request xmlns="">
                
                
                        <band>
                                {cBox.data}
                        </band>
              

     </mx:request>
     
     </mx:HTTPService>
        
        <mx:ApplicationControlBar x="0" y="0" dock="true" width="100%"
height="90">    
        
          <mx:Form>
                <mx:FormItem label = "Last.Fm Username:" direction="vertical">
                        <mx:TextInput id="lastfm" />
                        <mx:Button label="Get Artists!" 
click="this.currentState='artists'" />
                
                </mx:FormItem>
         </mx:Form>
   </mx:ApplicationControlBar>

        <mx:states>
                        <mx:State name="artists">
                         <mx:AddChild position="lastChild">
                         
                         
             
            <mx:HBox width="100%" height="100%" id="bodyBox"
bottom="0" horizontalCenter="0">
         
             <mx:VBox width="100" height="100%" />
             <mx:VBox width="90%" height="100%" id="artists" x="4"
y="82">   
                <mx:Tile>
                        <mx:Repeater id="artistRepeat"
dataProvider="{tracks}" count="10">
                         <mx:VBox>                                      
                           <mx:Text text="{artistRepeat.currentItem.name}"  />
                           <mx:Image source =
"{artistRepeat.currentItem.image}"  scaleContent="true" /> 
                      
                        
                     
                       <mx:CheckBox
data="{artistRepeat.currentItem.name}" id="cBox"
click="modifyArray(Object)" />
                          
                          
                          </mx:VBox>
                          
                          
                        </mx:Repeater>  
               
                <mx:Button label="SUBMIT" id="submit" width="140"
height="75" click="{addArtist.send();}" />
                
               
                 </mx:Tile>   
              </mx:VBox>
                   <mx:VBox height="100%" width="20%" id="cartBox"
backgroundColor="#800000" backgroundAlpha="0.08">
                   <mx:HBox>

                        <mx:VBox height="100%">                 
           
                        </mx:VBox>      
                        </mx:HBox>

                </mx:VBox>
      </mx:HBox>
                     </mx:AddChild>
                        </mx:State>
                </mx:states>    
</mx:Application>

=================

I'm very new to FLEX so I'm panicking like hell!

Could anyone pleeaassseee shed some light on this?

It would be a very big help!

Thanks,

Tom Harding


Reply via email to