2012-06-18 45 views
0

我在這裏帶着一個新問題 - 這一次更一般;希望你們大多數人都經歷過這個。Flex BlazeDS動態配置

所以比我配置我的Flex移動項目,所以它需要更新服務器的URL不會忽略每一個時間服務器的IP或端口改變: enter image description here

但在我的情況,我的Flex手機項目將在不同的醫院運行因此每次更改服務器地址時都需要更新更新 - 而且在醫院服務器僅限於遠程計算機以外的情況下,也需要進行更新。因爲我需要更新遠程對象類以及: enter image description here

因此,上述方法似乎不是很適合我的情況。如何配置我的項目,這樣我可以通過改變使用文本域等來設置如下運行時的一個改變服務器的URL:

enter image description here

簡單地說我說的外部化配置AMF通道端點url。

任何幫助將不勝感激...

回答

1

你可以自己只是建立消息的消費者並指定正確的通道:

function initConsumer():void { 
    var channelSet:ChannelSet = new ChannelSet(); 
    // for streaming 
    var myChannel:Channel = new StreamingAMFChannel("streaming-channel", "http://something.com/messagebroker/"); 
    // for polling 
    var myChannel:Channel = new AMFChannel("polling-channel", "http://something.com/messagebroker/"); 
    myChannel.pollingEnabled = true; 

    channelSet.addChannel(myChannel); 

    var consumer:Consumer = new Consumer(); 
    consumer.channelSet = channelSet; 
    consumer.destination = "NASDAQ"; 
    consumer.selector = "operation IN ('Bid','Ask')"; 
    consumer.addEventListener(MessageEvent.MESSAGE, messageHandler); 
    consumer.subscribe(); 
} 

function messageHandler(event:MessageEvent):void { 
    var msg:IMessage = event.message; 
    var info:Object = msg.body; 
    trace("-App recieved message: " + msg.toString()); 
}