Announcement Announcement Module
No announcement yet.
MXMLApplicationContext Samples Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • MXMLApplicationContext Samples


    There is sufficient detail in the documentation for configuring SAS application context using XML files but there is very minimal to do using MXML.

    The following configuration returns a channel length of zero for the configured ChannelSet.

    <?xml version="1.0" encoding="utf-8"?>

    import mx.messaging.ChannelSet;
    import mx.messaging.Channel;
    import mx.messaging.channels.AMFChannel;
    <Object id="amfChannel" clazz="{mx.messaging.channels.AMFChannel}">
    <Property name="url" value="http://localhost:8090/dmi/messagebroker/amf"/>

    <Object id="remotingChannelSet" clazz="{mx.messaging.ChannelSet}" >
    <MethodInvocation methodName="addChannel">
    <Arg ref="{amfChannel}">


    Could you point me to sample applications / documentation about configuring Sprint ActionScript DI using MXML?

    Any help is much appreciated.

  • #2
    Hi rambal,

    there is a sample app that uses MXML config here: (see "Movie-app with MXML based application context")

    Basically with MXML you have the option to skip the creation of object definitions and you can declare your instances directly, as you would normally do in MXML. There are some limitations though, mainly with prototype scoped objects, but in your example you should be fine.

    <mx:ChannelSet id="remotingChannelSet">
                <mx:AMFChannel id="amfChannel" url="http://localhost:8090/dmi/messagebroker/amf"/>


    • #3
      Hi Christophe,
      Thanks for your comments.

      I ended up using MXML style definition similar to what you have suggested in your reply. I had to do so due to two issues I came across while using <Objects/> definition within MXML.

      i) <MethodInvocation /> tag for an object defined inside a MXML doesn't seem to get invoked during the object instantiation process. For instance,

      Does not work
      <Object id="channelDefinitionSet" clazz="{mx.messaging.ChannelSet}">
      <MethodInvocation methodName="addChannel">
      <Arg ref="{amfChannel}"/>
      works though in an XML definition
      <object id="channelDefinitionSet" class="mx.messaging.ChannelSet">
      <method-invocation methodName="addChannel">
      <arg ref="amfChannel" />

      ii) Difficulty in setting an array property in a MXML style definition. To circumvent the first issue, I had tried to set the channels property in the channel set with an array. But I couldn't get the appropriate syntax to do so.
      <Object id="channelDefinitionSet" clazz="{mx.messaging.ChannelSet}">
      <Property name="channels" ref="??">
      Is this supported?

      Again, with XML based Object definitions, it is not a problem.



      • #4
        maybe fixed

        Hi there,

        I just fixed this issue:

        there were some bugs in the copying of properties from the MXML object definition to the IObjectDefinition being registered with the context, this might also have prevented the method invocations from being registered properly.
        The changes are available in the trunk if you'd liek to try it out.

        There is an upcoming 1.0.1 release in the works, we are dedicating ourselves to releasing bugfixes more often in the future, we promise



        P.S. Arrays and such are not supported in MXML indeed, we'll look into that as soon as possible, please submit a feature request in JIRA for this:
        Last edited by 666shooter; Sep 11th, 2010, 11:58 AM. Reason: added JIRA link