0

我有这样的 php 服务。

    <stockproductservice:StockproductService id="stockproductService"
                                             fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                             showBusyCursor="true"/>

它使用 php 服务。

我应该如何在 itemRedenerer 中设置数据提供者?

        <s:DataService source="{stockproductService.getAllStockproduct1()}"/>

        <s:WebService source="{stockproductService.getAllStockproduct1()}"/>

不工作。

4

1 回答 1

0

如果您的问题是如何设置 WebService 以最简单的形式填充 dataProvider,它可能是这样的:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" creationComplete="creationCompleteHandler(event)"
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

    <s:List dataProvider="{restaurants}" labelField="name" />

    <fx:Declarations>
        <s:WebService id="RestaurantWS" wsdl="http://examples.adobe.com/flex3app/restaurant_ws/RestaurantWS.xml?wsdl" /> 
        <s:CallResponder id="getRestaurantsResult" 
                         result="restaurants = getRestaurantsResult.lastResult as ArrayCollection"/> 
    </fx:Declarations>

    <fx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
            import mx.events.FlexEvent;

            [Bindable]
            public var restaurants:ArrayCollection;

            protected function creationCompleteHandler(event:FlexEvent):void
            {
                getRestaurantsResult.token = RestaurantWS.getRestaurants(); 
            }

        ]]>
    </fx:Script>
</s:Application>
于 2012-09-22T09:03:41.503 回答