2011-08-29 63 views
1

我想獲得一個RTMP消息應用程序在FlashDevelopFluorineFx中工作。我習慣用FlexBuilder 3中的NetConnection與一些hackery進行連接,但我正在繪製一個空白的文件,使其與FlashDevelop一起工作。如何在FlashDevelop AS3項目中使用FluorineFx配置RTMP通道?

我有一個FluorineFx網站通過配置文件\ WEB-INF \彎曲\服務,配置

<?xml version="1.0" encoding="utf-8" ?> 
<services-config> 
    <services> 
    <service-include file-path="remoting-config.xml" /> 
    <service id="message-service" class="flex.messaging.services.MessageService" messageTypes="flex.messaging.messages.AsyncMessage"> 

     <!-- DO NOT CHANGE <adapters> SECTION--> 
     <adapters> 
     <adapter-definition id="messagingAdapter" class="FluorineFx.Messaging.Services.Messaging.MessagingAdapter" default="true"/> 
     </adapters> 
     <destination id="chat"> 
     <adapter ref="messagingAdapter"/> 
     <properties> 
      <network> 
      <session-timeout>0</session-timeout> 
      </network> 
     </properties> 
     <channels> 
      <channel ref="my-rtmp"/> 
     </channels> 
     </destination> 

    </service> 
    <!-- <service-include file-path="data-management-config.xml" /> --> 
    </services> 

    <!-- Custom authentication --> 
    <security> 
    </security> 

    <channels> 
    <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"> 
     <endpoint uri="http://{server.name}:{server.port}/{context.root}/Gateway.aspx" class="flex.messaging.endpoints.AMFEndpoint"/> 
     <properties> 
     <!--<legacy-collection>true</legacy-collection> --> 
     </properties> 
    </channel-definition> 

    <channel-definition id="my-rtmp" class="mx.messaging.channels.RTMPChannel"> 
     <endpoint uri="rtmp://{server.name}:1951" class="flex.messaging.endpoints.RTMPEndpoint"/> 
    </channel-definition> 
    </channels> 
</services-config> 

我client.swf文件在目錄\ apps中運行\聊天在我的網站

內APPS \聊天目錄我有一個App.config文件:

<configuration> 
    <!-- Application object. Specify a fully qualified type name for your handler --> 
    <application-handler type="testfx.AppHandler"/> 
    <!-- Filename generator for streams. Specify a fully qualified type name to use a custom generator--> 
    <streamFilenameGenerator type="FluorineFx.Messaging.Rtmp.Stream.DefaultStreamFilenameGenerator"/> 
    <consumerService type="FluorineFx.Messaging.Rtmp.Stream.ConsumerService"/> 
    <providerService type="FluorineFx.Messaging.Rtmp.Stream.ProviderService"/> 
    <streamService type="FluorineFx.Messaging.Rtmp.Stream.StreamService"/> 
    <!-- Manages creation, retrieval and update of remote shared objects--> 
    <sharedObjectService type="FluorineFx.Messaging.Rtmp.SO.SharedObjectService"> 
     <persistenceStore type="FluorineFx.Messaging.Rtmp.Persistence.FileStore"/> 
    </sharedObjectService> 
    <!-- 
    <sharedObjectSecurityService type=""/> 
    --> 

</configuration> 

的testfx.AppHandler類唯一有迴音方法:

public class AppHandler : ApplicationAdapter 
    { 
     public string echo(string msg) 
     { 
      return "Echo: " + msg; 
     } 
    } 

我有以下的庫名爲.swc

  • framework.swc
  • rpc.swc
  • rpc_rb.swc

而且main.as文件的FlashDevelop項目是:

package 
{ 
    import flash.display.Sprite; 
    import flash.events.Event; 
    import flash.events.NetStatusEvent; 
    import flash.net.NetConnection; 
    import flash.net.ObjectEncoding; 
    import mx.messaging.channels.*; 
    import mx.messaging.Consumer; 
    import mx.messaging.events.MessageEvent; 
    import mx.messaging.events.MessageFaultEvent; 
    import mx.messaging.Producer; 

    /** 
    * ... 
    * @author Nathan 
    */ 
    public class Main extends Sprite 
    { 

     public function Main():void 
     { 
      if (stage) init(); 
      else addEventListener(Event.ADDED_TO_STAGE, init); 
     } 

     private function init(e:Event = null):void 
     { 
      removeEventListener(Event.ADDED_TO_STAGE, init); 
      // entry point 

      var consumer:Consumer = new Consumer(); 
      consumer.destination = "chat"; 
      consumer.addEventListener(MessageEvent.MESSAGE, messageHandler); 
      consumer.addEventListener(MessageFaultEvent.FAULT, faultHandler); 
      consumer.subscribe(); 

      var producer:Producer = new Producer();   
      producer.destination = "chat"; 
      producer.addEventListener(MessageFaultEvent.FAULT, faultHandler); 
      producer.connect(); 
     } 

     private function faultHandler(event:MessageFaultEvent):void 
     { 
      trace("fault"); 
     } 

     private function messageHandler(event:MessageEvent):void   
     { 
      trace(event.message.body); 
     } 

     private function onNetStatus(event:NetStatusEvent):void 
     { 
      trace(event.info.code); 
     } 

    } 

} 

當前異常我正在當我運行是這樣的:

[故障]例外,信息= [MessagingError消息=「目標 ‘聊天’不存在或目的地沒有通道 定義(和)']

回答

0

首先,如果更改services-config,則需要重新啓動IIS或應用程序池。

其次,您是否檢查過FluorineFX日誌文件以查看是否存在任何錯誤(FluorineFX的DEBUG上的+設置級別)。在日誌文件中,您還應該看到添加的目的地。看看聊天是否在其中。

第三,我會得到FluorineFX源代碼並嘗試從那裏調試它。有點了解源代碼總是有用的。

一些非常好的例子也隨FluorineFX的安裝一起發貨。檢查出來並將它們與您的代碼進行比較。也許這樣你很快就會發現什麼是錯的。

0

我知道這是晚了,但FluorineFX不接受任何其他目的地比「氟」。

<destination id="fluorine"> 
相關問題