プロジェクトはほぼ完成しましたが、各ビューに動的サーバー URL 設定を追加したいと考えています。config.xml と channels-config.xml を使用したアプリケーションのブートストラップ (私は Parsley フレームワークを使用しました)。
config.xml:
<?xml version="1.0" encoding="utf-8"?>
<fx:Object xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:services="services.*">
<fx:Declarations>
<services:GenBUS id="genBUS"/>
<services:KarBUS id="karBUS"/>
<services:UygBUS id="uygBUS"/>
</fx:Declarations>
</fx:Object>
channels-config.xml:
<objects
xmlns="http://www.spicefactory.org/parsley"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.spicefactory.org/parsley
http://www.spicefactory.org/parsley/schema/2.4/parsley-core.xsd">
<object type="mx.messaging.ChannelSet">
<property name="channels">
<array>
<object type="mx.messaging.channels.AMFChannel">
<property name="uri" value="http://localhost:8080/ClinASM/messagebroker/amf"/>
</object>
</array>
</property>
</object>
</objects>
シナリオは次のとおりです。ユーザーはシステムにログインする前に URL を変更し、すべてが完了すると、更新されたエンドポイント URL が SessionClientData.endpoint に保持され、サーバー側のメソッドが呼び出される前に新しいエンドポイントを割り当てます。リモートオブジェクトクラスへ:
[Inject(id="genBUS")]
public var genBUS:GenBUS;
public function login(username: String, password:String):void {
//updating endpoint
genBUS.endpoint = SessionClientData.endpoint;
//call responder is created and..
loginViewResponder.token = genBUS.getLoginResult(username,password);
}
しかし、私は何か間違ったことをしています-それが機能していないように...動的で簡単にチャネル構成を作成する方法はありますか?
更新:クライアント側に「サービス」リモートオブジェクトがないように構造を再構成する方法-毎回フレックスサーバーセクションを更新したくない-場合によっては、私の場合と同じように到達できないサーバーがあるため今...これに関するチュートリアルまたは構成例はありますか?