0 Replies Latest reply on Mar 25, 2010 1:30 PM by Hodmi

    Flex 4 service scope

    Hodmi Level 4

      Using Flash Builder 4 Premium build 272416 (not beta)

       

      I have an MXML application that has displays two MXML components (Edit.mxml and Details.mxml).  Both components use a service to get/set some data.

       

      Details:

            <services:AttributeService id="attributeService"
                                         fault="onFault(event)"/>

      ...

      protected function onFault(event:FaultEvent):void{
                      Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail, "Fault Detail");               
                  }

       

      Edit:

           <services:AttributeService id="attributeService_edit"
                                         fault="onAttFault(event)"/>

      ...

      protected function onAttFault(event:FaultEvent):void{
                          Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail, "Fault Edit");   
                  }

       

      Its the same service, but its used slightly differently (based on search vs update).  The problem is that if there is a fault in one instance then it fires the fault event in both services.

       

      For example if the Edit component does something that throws a fault on its service then I will not only see the Edit alert, but also the Details alert.

       

      Is there a way to keep the service instances seperate?  Some way of declaring the service scope to only be that component?