2012-06-18 43 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()); 
}