Results 1 to 4 of 4

Thread: MXMLApplicationContext Samples

  1. #1
    Join Date
    Sep 2010
    Posts
    3

    Default MXMLApplicationContext Samples

    Hi,

    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"?>
    <Objects
    xmlns="http://www.springactionscript.org/mxml/config"
    xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx">

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

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

    </Objects>


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

    Any help is much appreciated.

  2. #2
    Join Date
    Oct 2008
    Location
    Belgium
    Posts
    160

    Default

    Hi rambal,

    there is a sample app that uses MXML config here: http://www.springactionscript.org/samples.html (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.

    Code:
    <mx:ChannelSet id="remotingChannelSet">
            <mx:channels>
                <mx:AMFChannel id="amfChannel" url="http://localhost:8090/dmi/messagebroker/amf"/>
            </mx:channels>
        </mx:ChannelSet>
    regards,
    Christophe
    Christophe Herreman
    Spring ActionScript Founder
    http://www.herrodius.com

  3. #3
    Join Date
    Sep 2010
    Posts
    3

    Default

    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}"/>
    </MethodInvocation>
    </Object>
    --------------------------------------------------------------------
    works though in an XML definition
    <object id="channelDefinitionSet" class="mx.messaging.ChannelSet">
    <method-invocation methodName="addChannel">
    <arg ref="amfChannel" />
    </method-invocation>
    </object>
    ------------------------------------------------------------------

    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="??">
    </Object>
    Is this supported?

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

    Thanks.

  4. #4
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    406

    Default maybe fixed

    Hi there,

    I just fixed this issue:

    https://jira.springframework.org/bro...ONSCRIPTAS-106

    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

    cheers,

    Roland

    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:

    https://jira.springframework.org/bro...ACTIONSCRIPTAS
    Last edited by 666shooter; Sep 11th, 2010 at 11:58 AM. Reason: added JIRA link

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •