//richinternet.blog

Viewing By Entry / Main
Thursday, June 29, 2006
Modifying channel definitions dynamically in Flex 2

Yummy... I just found that using a bit of E4X it's possible to adjust the channel definitions that are defined in the services-config.xml file dynamically after your SWF has been compiled. This way you can easily switch endpoints on the fly during development :)

What happens behind the scenes when you compile your SWF using the compiler flag -services=services-config.xml is that parts of the service-config.xml (and the linked *.xml files e.g. data-management-config.xml) get compiled into the application SWF as native XML. This chunk of data is stored in the static xml property of the (undocumented) mx.messaging.config.ServerConfig class. Modifying the data before any service call is made ensures that your modifications will be respected :)

Here's a little snippet how to modify the endpoint URI of the channel "my-rtmp" for example:

XML(ServerConfig.xml.channels.channel.(@id=="my-rtmp")[0]).endpoint.@uri = "rtmp://dev:2048";

Dirk.

Comments

The following is a non XML equivilent.

mx.messaging.config.ServerConfig.getChannel("my-rtmp", false).uri)




Sun Mon Tue Wed Thu Fri Sat
   1234
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

About this blog
www.aws-blog.de
www.richinternet.de
www.flexforum.de
www.die-flexperten.de

AIR (10)
Apollo (3)
BlazeDS (8)
Breeze (1)
Central (5)
Cocoon P2P (1)
ColdFusion (55)
Flash (61)
Flash Media Server (8)
Flex (170)
Flex Trace Panel (6)
FXUG (3)
J2Flex (4)
MAX (31)
Mobile (1)
mxmlc (1)
Other topics (47)
Plugins (9)
Video (7)


Recent Flex Technotes
Recent ColdFusion Technotes
Recent Flash Technotes

http://www.aws-blog.de
http://www.die-flexperten.de
http://www.flexforum.de
http://www.flex.org

Aggregated by fullasagoog.com
Aggregated by MXNA

Short Mode | Full Mode

Herrlich & Ramuschkat