Declaring RemoteObjects in Cairngorm

Hi all,
I'm beginning with Cairngorm and Flex2. I understand quite
good how to use Cairngorm, but I can't find how I may configure the
RemoteObjects for Cairngorm. In the Services.mxml there are only
logical links to the RemoteObjects, and the real description seems
to be the flex-config.xml (from the 6 part tutorial) but I don't
know what dtd it should have. I also use BlazeDS, so I'm wondering
if I could re-use the config files for BlazeDS to describe the
RemoteObjects for Cairngorm, but I don't know how to set the
location of these files for Cairngorm.
Can someone help me?
Thanks a lot!

j8by7 wrote:
Solved problem, novice mistake, making variable an instance variable to the class solved problem.Making it an instance variable to get rid of a compiler error is absolutely the wrong approach. It should be an instance variable if and only if it represents the state of an object, something that is a property of the object outside of any method calls.
If that value is only meaningful within that method, then the variable should be declared in the method. Either you'll need to declare it outside the if statement, or you'll need to reexamine your logic. What the best approach is depends on the specifics of your code.

Similar Messages

  • ' s:RemoteObject ' is not allowed to follow ' fx:Declarations '

    Hi,
    I am new to Flex.
    I have the following hello.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application 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:Declarations>
        <s:RemoteObject /></fx:Declarations> 
    </s:Application>
     I am getting:Parse error: '<s:RemoteObject>' is not allowed to follow '<fx:Declarations>'. hello.mxml/hello/src line 6 Flex Problem
    I am using
    FlashBuilder plugin 4.0.1
    Flex SDK 4.1
    Eclipse Gallileo SR2
    I have removed eclipse/flash builder plugin and started with a fresh installation but I still get the same error.
    Something must be wrong somewhere.
    Thanks.

    Hi Levent
    After some research, i got discovered a solution for this turkish region spesific problem
    Just add these two lines in your mxmlc task as nested parameters.
      <jvmarg value="-Duser.country=US"/>
    <jvmarg value="-Duser.language=en"/>
    Full build.xml :
    <?xml version="1.0" encoding="utf-8"?>
    <project name="My Project" default="main" basedir=".">
    <taskdef resource="flexTasks.tasks" classpath="../Adobe Flash Builder 4/sdks/4.0.0/ant/lib/flexTasks.jar"/>
    <property name="FLEX_HOME" value="../Adobe Flash Builder 4/sdks/4.0.0"/>
    <property name="APP_ROOT" value="../My Project"/>
    For some valuable information : http://www.likyateknoloji.com/phpBB3/viewtopic.php?f=3&t=16
    <target name="main">
         <mxmlc fork="true" file="${APP_ROOT}/src/com/likya/tloslite/TlosLiteWeb.mxml" keep-generated-actionscript="true">
              <jvmarg value="-Duser.country=US"/>
              <jvmarg value="-Duser.language=en"/>
              <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
              <source-path path-element="${FLEX_HOME}/frameworks"/>
         </mxmlc>
    </target>
    </project>

  • RemoteObject FaultEvent, Alert, Cairngorm

    Hi All,
    I am using the Cairngorm framework, Java for my online flex application. One of my screens has a search field, upon clicking enter an Event is dispatched and the corressponding Command class is called. This command class sends a RemoteObject request to one of the Java class methods which returns a list of items found.
    When there is an error returned the FaultEvent method catches it and throws and Alert message to the user.
    Now my problem is if any of the next search returns Fault, the Alert message pops up twice and keeps adding up every time a Fault is returned.
    So for ex: if 4 times the search fails, the Alert message pops up 4 times.
    This is very annonying and I am not able to figure it out exactly. Is it my code or something to do with Cairngorm?
    Please suggest.
    Thanks,
    Shankar.

    The problem is about resource management. You add listeners without removing them after task done.
    In Cairngorm, to handle each dispatched event, FrontController will create a new command of corresponding CommandClass. First time you dispatch the search event, command1 will be generated to execute and listen to ResultEvent as well as FaultEvent, but after all the listeners still remain. Next time you dispatch the search event, command2 will be generated and once again addEventListener to the remoteObject. From now, whenever a fault event happens, both command1 and command2 executes their own event handling functions.
    To solve this problem, you can either
    _ Call removeEventListeners when the command is no longer needed,
    _ Split this command into several subCommand, each command implements IResponder interface and handles one AbstractOperation. Use the following code lines instead of add listeners directly to the Operation
    var estOp:AbstractOperation = remoteService.getOperation("getEstimators");
    var call:AsyncToken = estOp.send();
    call.addResponder( this ); // this here is the subCommand instance, which has result(event) and fault(event) methods

  • Data Management Services with Cairngorm 2.1

    Hello.
    I have been using cairngorm 2.0 for a while, and I am now
    trying to convert the 2.1 stuff over, including using cairngorm to
    manage my DataServices. However I have some questions about it if
    you have used it.
    Using the command, and passing the command into the delegate,
    and then firing the service from the delegate, there is a problem
    trying to catch faults. Even though I have a fault method defined
    on my command, and I am setting up the responder on the delegate as
    the command which called it, the fault handler is not being fired.
    I am generating a runtime exception on the java assembler just to
    see what happens, and the delegate never fires the fault handler.
    However if I remove the runtime excpetion from the java
    assembler, and put a simple alert on the result, the delegate sends
    to the commands result function, and the alert fires.
    If you have any code examples, even if they dont have the
    actual assembler behind them, I would really appreciate it. I dont
    know if you are supposed to define commands which call DataServices
    the same way you would declare a command that calls a RemoteObject.
    If so how do you do that? What do you declare on the command to get
    it to work?
    If you have any ideas, please help.

    Has this question already been answered on flexcoders? I
    think the Cairngorm folks may be more plugged in there than here:
    www.yahoogroups.com/group/flexcoders/
    Seth

  • How to use generated code from "Import Web Services" with Cairngorm Framework

    I recently downloaded Flex Builder 3 beta 2 and tried out the
    wizard that lets you import web services. The code that is
    auto-generated makes if fairly straight forward to consume web
    services using the object types defined in the WSDL. No longer does
    the developer need to decode the XML payload! The only problem I am
    having is how does you integrate the auto- generated code with the
    Cairngorm framework? This seems like a huge question for anyone who
    might want to leverage Cairngorm and the auto-generated proxy code
    in the same project (like me).
    Here are the problems that I see so far.
    1) How do you configure the generated service class to work
    with the Cairngorm service locator? The service constructor only
    accepts a “LCDS destination string” which implies that
    you must use Lifecycle data services. Unfortunately, the project I
    am trying to retrofit currently uses a WebService and does not use
    data services. All I really need to do is change the endpoint URL
    (ie from local to a development server). This issue is noted in the
    bug https://bugs.adobe.com/jira/browse/FB-8456. What I think is
    needed is a way to set the endpointURI in the Services.mxml file.
    2) Even if I come up with a hack around #1, I do not receive
    a callback to my IResponder even though I register it immediately
    after the method call. I can register and listener function within
    my business delegate and receive the callback, but my Command
    object, which implements IResponder, does not receive the call back
    even though it is registered. From what I read in the ASDocs it
    should but it doesn’t for me!
    These are the issues I have observed in 3 hours of messing
    with this. I hope this makes sense. I would love to integrate
    auto-generated web service proxies into Cairngorm but I don’t
    see a straight forward way without re-architecting Cairngorm. Has
    any one else run across this issue? If so, do you have any insights
    on how to proceed? Any help is appreciated.

    Since I posted this question, I have abandoned the notion of
    auto-generated web services and embraced the good old FDS concept
    where the RemoteObject meta-tag does all the conversion work for
    me. We are now using the Granite DS package and it is working well
    for us. I would love to consume web services, but it just isn't
    worth the hassle when all you have to do with Granite (and FDS) is
    cast your return objects to the proper object type.
    BTW, since this posting, I have investigated competing Flex
    app frameworks. After my research, I checked out the PureMVC
    framework. Wow!! Cairngorm always left me with an uneasy feeling
    and I guess I am not alone. Apparently, Cliff Hall felt the same
    way. That is why he started the project. I like his approach alot
    more than Cairngorm especially since it includes notifications
    which allow me to broadcast my own app level events independent
    from the AS Event framework. Check out PureMVC. For what it is
    worth, it has my humble endorsement. Cliff was even gracious enough
    to acknowledge the other Adobe Consulting guys for their work. Good
    for you Cliff, I respect that. Check out a better way at
    http://www.puremvc.org/

  • Flash Builder 4 - RemoteObjects

    I'm having an issue with remoteobjects in flash builder 4. I built a simple little project to see if I could get remoteobjects working.
    I got the project working and the output folder resides on a web server on my local LAN (not the machine with flash builder installed).
    Here is the issue I am having...
    When I build the app from from flash builder 4 the project launches everything works fine. If I open the URL of the project on the web server from my machine with flash builder 4 on it the project works fine. If I open the URL from any other machine the calls to the remoteobject do not work. I've scoured the web and haven't seen anyone else run into this issue so I'm assuming its something I'm doing wrong.
    I am on a trial version of flash builder 4. I just wanted to mention that but I don't see how that could be the issue.
    I've tried both methods of defining the remoteobject endpoint (both at runtime as one of the MXML remoteobject properties, and via a services-config.xml using the compiler argument -services PathToConfigFile). In each case the project runs and works fine from the machine with flash builder 4 installed on it but just not any other machine. I've also tried defining the -context-root thinking that may have been the issue still no dice.
    Any help would be greatly apprecaited.
    I'm not sure how useful the code would be as the project does work but here it is in any event...
    APPLICATION FILE:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application 
    xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="
    library://ns.adobe.com/flex/spark" xmlns:mx="
    library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
    <fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
    <s:RemoteObject id="testRO"source="
    TestRO"destination="
    TestRO"endpoint="
    endPoint.php"showBusyCursor="
    true">
    <s:method name="say" result="say_resultHandler(event)"/>
    </s:RemoteObject>
    </fx:Declarations>
    <fx:Script>
    <![CDATA[
    import mx.controls.Alert; 
    import mx.rpc.events.ResultEvent; 
    protected function say_resultHandler(event:ResultEvent):void
    Alert.show(String(event.result));
    ]]>
    </fx:Script>
    <s:TextInput x="73" y="73" id="repeatEntry"/>
    <s:Button x="209" y="73" label="Say" click="testRO.say(repeatEntry.text)"/>
    </s:Application>
    PHP ENDPOINT:
    <?php
    //Define error reporting for this application.
    error_reporting(E_ALL|E_STRICT);
    //Set the display_errors in the php.ini
    ini_set("display_errors","on");
    //Path to the Zend server.php file.
    require_once 'Zend/Amf/Server.php';
    //require your php class file ('DIRECTORY/CLASS.PHP').
    require_once 'TestRO.php';
    $server = new Zend_Amf_Server();
    //Class name for the server (Same as the php file name).
    $server->setClass("TestRO");
    //Handle request
    echo ($server->handle());
    ?>
    PHP CLASS FILE:
    <?php
    class TestRO
        public function say($text)
           if($text =="")
       return "+++ Field left blank +++";
        } else {
          return "+++ ".$text." +++";

    I've resolved the issue sort of...
    I exported a release build then re-tested the application and it works fine. For some reason while the application is in debug mode the remoteobject method calls aren't working on any other machines on the network... I still have no idea why... is this a new feature to prevent folks from using the debug swf's in production?
    In flex 3 I'd give the PROJECT-debug URL to my manager so he could track my progress but I was using the httpservice class and it worked without issue. In any event if someone knows the answer or has any additional information it would be greatly appreciated.
    Thank-you.

  • Best use of a model in cairngorm

    I am a little confused about the use of a model , ModelLocator, in cairngorm
    I have it created and it all works fine but whats the best way to access it, Currently i have numerous forms that all do something like
        <fx:Script>
            <![CDATA[
                import com.model.ModelLocator;
                [Bindable] private var model:ModelLocator = ModelLocator.getInstance();
    and then later on
                private function fun1(evt:Event):void
                   model.something = "blah"
                   var s1:String = model.anotherSomething;
    or whatever
    Is it ok to have varibles all over the place in different mxml files all creating a private var model, does this comsume resouces or is it ok because its static
    Also i have several arrayCollections 11+ , plus other stuff in the model, is this ok

    Hi JockMahon,
    Its ok fine you can go with that..
    However remember one thing you will be declaring any variables in the ModelLocator class only if you are using them through out your application .. I mean more than one mxml page or AS files. However if you require any property or variable only within a single file then you can declare it locally within the file instead of decalring it in
    ModelLocator.
    The ModelLocator class in cairngorm framework is a singleton class so in how many files you have a model variable it will actually refer or return only single static instance of the ModelLocator class.
    [Bindable] private var model:ModelLocator = ModelLocator.getInstance();
    So how many times you have a variable by using the above style of decalring you will only get a single static reference to the instance of ModelLocator class. No ne instances are created. Its like you get a pointer to the model variable.
    Hope it is clear now.
    Thanks,
    Bhasker

  • Cairngorm close and background disable

    So after trying to write a custom class for TitleWindow popups for two weeks, I just couldn't invest any more time in getting them to work.
    So as an alternative I am using Cairngorm popup 1.7.
    Everything involving creating the popup works great, but I am having problems with closing.
    I dont get any compiler errors, but flash debug error pops up when I try to hit the close button on the TitleWindow.
    TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::Event@10a9fdf9 to mx.events.CloseEvent.
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\co re\UIComponent.as:12266]
    at components::newTicket/___newTicket_TitleWindow1_close()[/Users/brian/Documents/Adobe Flash Builder 4/PRISM/src/components/newTicket.mxml:9]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\co re\UIComponent.as:12266]
    at spark.components::TitleWindow/closeButton_clickHandler()[E:\dev\4.0.0\frameworks\projects \spark\src\spark\components\TitleWindow.as:458]
    If I disable the error console it works just fine. Any thoughts on getting rid of this error?
    Here is the code from the popup component mxml
    <?xml version="1.0" encoding="utf-8"?>
    <s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       xmlns:mx="library://ns.adobe.com/flex/mx"
       xmlns:popup="com.adobe.cairngorm.popup.*"
       title="Receive Items" x="800" y="600" width="800" height="264" close="dispatchEvent(new Event(Event.CLOSE))" textAlign="left">
    <s:layout>
    <s:VerticalLayout  horizontalAlign="center"/>
    </s:layout>
    <fx:Script>
    <![CDATA[
    ]]>
    </fx:Script>
    <fx:Declarations>
    <fx:Array id="category">
    <fx:String>Computers</fx:String>
    <fx:String>Phones</fx:String>
    <fx:String>Rides</fx:String>
    <fx:String>Audio</fx:String>
    <fx:String>Video</fx:String>
    </fx:Array>
    </fx:Declarations>
    <s:BorderContainer width="680" height="166" borderVisible="false">
    <s:Label text="Requested by: Someone" y="26" x="0"/>
    <s:Label text="Item: Wireless Headset" y="51" x="0"/>
    <s:Label text="Quantity Received:" y="106" x="0"/>
    <s:Label text="Order Date: 06/11/2010" y="26" x="550"/>
    <s:Label text="PO #: 378542" y="43" x="551"/>
    <s:Label text="Quantity Ordered: 1" x="0" y="77"/>
    <s:DropDownList x="105" y="100" width="43"></s:DropDownList>
    <s:CheckBox x="77" y="131"/>
    <s:Label text="Backordered:" y="136" x="0"/>
    </s:BorderContainer>
    <s:controlBarContent>
    <mx:Spacer width="100%" />
    <s:Button label="Save" click="dispatchEvent(new Event(Event.CLOSE))"/>
    <s:Button label="Cancel" click="dispatchEvent(new Event(Event.CLOSE))"/>
    </s:controlBarContent>
    </s:TitleWindow>
    Lastly, for those who are familiar with Cairngorm, is there a way to disable the background (aka main application) and have it blurred out just like the TitleWindow main function does?
    thanks!

    1. dispatchEvent(new CloseEvent(CloseEvent.CLOSE, true, false)) reports this error
    Error: Error #1023: Stack overflow occurred.
    at com.adobe.cairngorm.popup::PopUpEvent()[C:\workspaces\flex4.0betadrop17feb10\Cairngorm 3 trunk\target\checkout\libraries\Popup\src\com\adobe\cairngorm\popup\PopUpEvent.as:67]
    at com.adobe.cairngorm.popup::PopUpBase/dispatchPopUpEvent()[C:\workspaces\flex4.0betadrop17 feb10\Cairngorm 3 trunk\target\checkout\libraries\Popup\src\com\adobe\cairngorm\popup\PopUpBase.as:362]
    at com.adobe.cairngorm.popup::PopUpBase/closePopUp()[C:\workspaces\flex4.0betadrop17feb10\Ca irngorm 3 trunk\target\checkout\libraries\Popup\src\com\adobe\cairngorm\popup\PopUpBase.as:315]
    at com.adobe.cairngorm.popup::PopUpBase/set open()[C:\workspaces\flex4.0betadrop17feb10\Cairngorm 3 trunk\target\checkout\libraries\Popup\src\com\adobe\cairngorm\popup\PopUpBase.as:192]
    at com.adobe.cairngorm.popup::PopUpBase/onClose()[C:\workspaces\flex4.0betadrop17feb10\Cairn gorm 3 trunk\target\checkout\libraries\Popup\src\com\adobe\cairngorm\popup\PopUpBase.as:307]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\co re\UIComponent.as:12266]
    at components::newTicket/___newTicket_TitleWindow1_close()[/Users/brian/Documents/Adobe Flash Builder 4/PRISM/src/components/newTicket.mxml:9]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\co re\UIComponent.as:12266]
    at components::newTicket/___newTicket_TitleWindow1_close()[/Users/brian/Documents/Adobe Flash Builder 4/PRISM/src/components/newTicket.mxml:9]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\co re\UIComponent.as:12266]
    at components::newTicket/___newTicket_TitleWindow1_close()[/Users/brian/Documents/Adobe Flash Builder 4/PRISM/src/components/newTicket.mxml:9]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\co re\UIComponent.as:12266]
    at components::newTicket/___newTicket_TitleWindow1_close()[/Users/brian/Documents/Adobe Flash Builder 4/PRISM/src/components/newTicket.mxml:9]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\co re\UIComponent.as:12266]
    at components::newTicket/___newTicket_TitleWindow1_close()[/Users/brian/Documents/Adobe Flash Builder 4/PRISM/src/components/newTicket.mxml:9]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\co re\UIComponent.as:12266]
    at components::newTicket/___newTicket_TitleWindow1_close()[/Users/brian/Documents/Adobe Flash Builder 4/PRISM/src/components/newTicket.mxml:9]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\co re\UIComponent.as:12266]
    at components::newTicket/___newTicket_TitleWindow1_close()[/Users/brian/Documents/Adobe Flash Builder 4/PRISM/src/components/newTicket.mxml:9]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\co re\UIComponent.as:12266]
    at components::newTicket/___newTicket_TitleWindow1_close()[/Users/brian/Documents/Adobe Flash Builder 4/PRISM/src/components/newTicket.mxml:9]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\co re\UIComponent.as:12266]
    at components::newTicket/___newTicket_TitleWindow1_close()[/Users/brian/Documents/Adobe Flash Builder 4/PRISM/src/components/newTicket.mxml:9]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\co re\UIComponent.as:12266]
    at components::newTicket/___newTicket_TitleWindow1_close()[/Users/brian/Documents/Adobe Flash Builder 4/PRISM/src/components/newTicket.mxml:9]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\co re\UIComponent.as:12266]
    at components::newTicket/___newTicket_TitleWindow1_close()[/Users/brian/Documents/Adobe Flash Builder 4/PRISM/src/components/newTicket.mxml:9]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\co re\UIComponent.as:12266]
    at components::newTicket/___newTicket_TitleWindow1_close()[/Users/brian/Documents/Adobe Flash Builder 4/PRISM/src/components/newTicket.mxml:9]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\co re\UIComponent.as:12266]
    at components::newTicket/___newTicket_TitleWindow1_close()[/Users/brian/Documents/Adobe Flash Builder 4/PRISM/src/components/newTicket.mxml:9]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\co re\UIComponent.as:12266]
    at components::newTicket/___newTicket_TitleWindow1_close()[/Users/brian/Documents/Adobe Flash Builder 4/PRISM/src/components/newTicket.mxml:9]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\co re\UIComponent.as:12266]
    2. not sure how to develop the event handler within the application for the close event
    3. I am using flex 4 and the showCloseButton property is not available for Spark TitleWindow
    4. how would I close a window using PopUpManager without calling removePopUp? I dont see anything like PopUpManager.Close
    thanks for everything so far!

  • Cairngorm 3 Module and Parsley Context initialization problem.

    Hi,
       I am using parsley 2.2, cairngorm 3 module library. When the module is loaded the parsley context is not getting initialized at that time and returing null for the objects managed by the parsley container.
    <fx:Script>
    <![CDATA[
    import mx.events.FlexEvent;
    import org.spicefactory.parsley.flex.modules.FlexModuleSupport;
    import org.spicefactory.parsley.flex.tag.builder.ContextBuilderTag;
    [Bindable][Inject]public var faultMgtContainerPM:NMSFaultMgtContainerPM;
    public function get contextBuilder() : ContextBuilderTag
    return contextBuilderTag;
    ]]>
    </fx:Script>
    <fx:Declarations>
    <spicefactory:ContextBuilder id="contextBuilderTag" config="{ NMSFaultMgtModuleContext }" />
    <spicefactory:Configure />
    <s:Consumer id="notification" destination="sessionlog-notification-bus"
    fault="faultMgtContainerPM.notification_faultHandler(event)"
    message="faultMgtContainerPM.notification_messageHandler(event)"/>
    </fx:Declarations>
    In the above code the Inject of NMSFaultMgtContainerPM class doesn't work and returing null when accessed in the creationComplete event of the app.
    By the way the context file contains the NMSFaultMgtContainerPM class entry.
    Please let me know if I am missing any thing.
    Regards,
    Purushotham

    Hi,
    Please have a look at the [Init] metadata from the Parsley configuration : http://www.spicefactory.org/parsley/docs/2.1/manual/lifecycle.php#methods
    If you want the Parsley Container to invoke methods on your object when it is created or when it is destroyed,
    you can add the [Init] or [Destroy] metadata tags to the corresponding methods:
    [Init]
    public function init () : void
    [Destroy]
    public function dispose () : void
    The methods marked with [Init] get invoked after the object has been instantiated and
    all injections have been processed.
    The methods marked with [Destroy] get invoked after the Context instance they belong to has been
    destroyed with Context.destroy() or when the object was removed from the Context.
    See 6.3 Object Lifecycle Methods for details.
    For Flex Components declared in regular MXML files and wired to the Context as described in 7 Dynamic View Wiring
    the lifecycle is different: For those objects the methods get invoked whenever the object is added to or removed from the
    stage respectively. Of course the [Destroy] method additionally gets invoked if the Context the object
    was wired to was destroyed.
    Let me know if this works for you

  • Flex 4.5 - Cairngorm Module Support error with creationComplete

    Hi
    As a starting point I've already posted a thread (see link below)
    http://forums.adobe.com/thread/970855?start=0&tstart=0
    but I've had no luck in solving this.
    I have an mx:Application which loads a module defined in ShellContext(see below) using a ParsleyModuleDescriptor and is loaded using Cairngorn's ModuleViewLoader with BasicLoadPolicy.
    The module loads fine, however the module's children/components are not initialized correctly.
    The module is called DashboardModule. Its creationComplete handler is invoked last.
    The DashboardModule contains DashboardView and DashboardView's creationComplete also gets invoked second to last,
    however DashboardView's children's creationComplete never get invoked.
    So in particular, in DashboardView, the mx:ApplicationControlBar, the mx:Button, and the presentation:DashboardSearchView, presentation:DashboardMyApproval etc etc, are all initialized ( i can see the traces that are added there) but their creationComplete handlers never get invoked.
    I have tried adding creationPolicy="all", at application level, at module level and at component level with no luck.
    I have spent 2 whole days on this and I still haven't been able to figure out the problem.
    We've used cairngorm modules before with Parsley and Flex 4.5.1 and we've never had such a problem.
    To be more precise, I have the following configuration:
    ---ShellContext
    <fx:Object>
            <commonPresentation:NavigationHandlerPM id="navigationPM"/>
            <module:ParsleyModuleDescriptor objectId="dashboard"
                url="DashboardModule-1.0-SNAPSHOT.swf"
                applicationDomain="{ ClassInfo.currentDomain }"/>
    </fx:Object>
    --DashboardModule.mxml
    <mx:Module
        width="100%" height="100%"
        backgroundColor="white"
        horizontalAlign="left"
        verticalAlign="top"
        layout="vertical" verticalScrollPolicy="off" horizontalScrollPolicy="off"
              creationComplete="creationComplete();"
        xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:spicefactory="http://www.spicefactory.org/parsley"
        xmlns:cairngorm="com.adobe.cairngorm.*"
        xmlns:presentation="com.test.presentation.*">
        <fx:Declarations>
            <spicefactory:ContextBuilder id="spiceFactoryContextBuilder">
                                  <cairngorm:CairngormModuleSupport/>
                                  <cairngorm:CairngormIntegrationSupport/>
                                  <cairngorm:CairngormNavigationSupport/>
                                  <spicefactory:FlexConfig type="{DashboardContext}"/>
                                  <spicefactory:ViewSettings autowireComponents="true"/>
            </spicefactory:ContextBuilder>
            <spicefactory:FastInject  property="model" type="{DashboardPM}"/>
            <spicefactory:Configure/>
        </fx:Declarations>
        <fx:Script>
            <![CDATA[
                [Bindable]
                [Inject(id="dashboardPM")]
                public var model:DashboardPM;
                private function creationComplete():void
                    trace('i should be called last god damn it');
                    model.startLoading();
            ]]>
        </fx:Script>
        <mx:VBox
            width="100%" height="100%"
            verticalScrollPolicy="off" horizontalScrollPolicy="off">
            <presentation:DashboardView
                width="{this.width}" height="{this.height}"
                verticalScrollPolicy="on" horizontalScrollPolicy="on"
                userProfile="{shell.userProfile}"/>
        </mx:VBox>
    </mx:Module>
    ----DashboardView.mxml
    <mx:VBox
        width="100%" height="100%"
        creationComplete="createComplete()"
              xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:spicefactory="http://www.spicefactory.org/parsley"
        xmlns:presentation="com.db.paragon.common.module.dashboard.presentation.*">
        <fx:Declarations>
            <spicefactory:Configure/>
        </fx:Declarations>
       <fx:Script>
            <![CDATA[
            import mx.core.FlexGlobals;
            import mx.utils.StringUtil;
            [Bindable]
            [Inject]
            public var searchModel:DashboardSearchPM;
            [Bindable]
            private var _userprofile:UserProfile;
            public function get userProfile():UserProfile {
                return this._userprofile;
            public function set userProfile(userPr:UserProfile):void {
                this._userprofile = userPr;
                setUserWelcomeString();
            public function createComplete():void {
                  trace('i should be called second to last');
            ]]>
        </fx:Script>
        <mx:ApplicationControlBar
                initialize="trace('initialise control bar');" creationComplete="trace('controlbar complete');"
            width="100%"
            horizontalAlign="right"
            verticalAlign="middle">
            <mx:Text
                width="97%"
                left="10"
                fontSize="14"
                fontThickness="12"
                fontWeight="bold"
                textAlign="left"
                selectable="false" text="{userWelcomeString}"/>
            <mx:LinkButton id="help"
                width="60"
                color="gray"
                textAlign="right"
                label="Help"
                click='navigateToURL(new URLRequest(urlToHelp));'/>
        </mx:ApplicationControlBar>
        <mx:Button initialize="trace('initialise button')" creationComplete="trace('button complete');"/>
        <presentation:DashboardSearchView initialize="trace('initializesearchview');" creationComplete="trace('searchviewcomplete');" creationPolicy="all"/>
        <presentation:DashboardMyApproval initialize="trace('initializeapproval');" creationComplete="trace('approvalcomplete');" creationPolicy="all"/>
        <presentation:DashboardPendingApproval initialize="trace('pendingapproval');" creationComplete="trace('pendingapprovalcomplete');" creationPolicy="all"/>
        <presentation:DashboardReviewsDue initialize="trace('reviewsdue');" creationComplete="trace('reviewsdue');" creationPolicy="all"/>
        <presentation:DashboardHistCreditApplications initialize="trace('histcreditapps');" creationComplete="trace('histcredcomplete');" creationPolicy="all"/>
        <presentation:DashboardRatingWriteups initialize="trace('ratingwriteups');" creationComplete="trace('ratingwriteupslcomplete');" creationPolicy="all"/>
        <presentation:DashboardNotifications initialize="trace('notifications');" creationComplete="trace('notificationscomplete');" creationPolicy="all"/>
    </mx:VBox>
    Any help is greatly appreciated.

    Yes, there are all kinds of problems when you remove something from the screen that had focus (for instance, at that point you can't capture keyboard events either).
    My code is sprinkled with so many things to make sure something is in focus, I tend to forget that I've done it.
    In your code that changes the currentState, add
    this.setFocus()
    HTH;
    Amy

  • Accessing the id's in Cairngorm

    I have started working in Cairngorm recently. My doubt is say
    if we have a mxml file which has a HBox whose id is "container". I
    want to access that id into my command file. Say I want to set my
    height .....normally i would set that as container.height...but how
    can I access that into my command file?

    I guess that is not a best practice to use your objects
    representing your view in the command. According to Cairngorm
    philosophy, the command allow just to execute command and recover
    data in server side.
    But is not restricted, you have to do an import of your view
    like :
    import x.y.z.view.*; which x,y and z represent your packages,
    then you have to declare variables with same name in the view and
    with visibility public, in this case : public var container:HBox;
    then enjoy yourself ;)
    but It would be better to describe you situation, perhaps
    there is an other solution more than optimized than this.

  • About responders in Cairngorm

    Hello all
    I am confused here. I have seen some examples of cairngorm in action - login screens, posts in a blog etc.
    From what I have understood, I have got that all of my services will reside in the ServiceLocator mxml file. I have many service classes and I will create a RemoteObject for each of them, defining their methods inside the mx:RemoteObject tag using the mx:method tag.
    But what about responders? Should I create a separate responder for every method of the every service? Or 1 responder per service? Or just once responder - its not a Singleton so I think this option is not correct.
    Please guide me appropriately.
    Thanks and Regards
    ShiVik

    Hello there
    One responder object for every service? That doesn't seem to fit in.
    In the command we create an instance of delegate and pass to it an instance of responder and after that a parituclar method of delegate is called.
    This method in turn calls the method of service on server - so in nutshell, it means that my responder is going to respond to the method of service residing on server.
    So doesn't that mean that I should create a responder for every method of my service? Or did I get something wrong here?
    Please guide me
    Thanks and Regards
    ShiVik

  • RemoteObject Scope Issue

    I posted this in the ColdFusion forums earlier, but figured it might actually be better here in the Flex forums, so sorry for the repost.
    I am trying to create a backend for an AIR application. The application is a poker site. I can return objects from ColdFusion to AIR just fine, but the problem is, everytime I make a call to a function in my CFC, it acts as if each call is a seperate "instance" of the CFC.
    Below is the CFC I am using...
    <cfcomponent output="false" name="Deck">
    <cfset suits = ["hearts", "diamonds", "spades", "clubs"]>
    <cfset cards = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"]>
    <cfset names = ["Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"]>
    <cfset deck = ArrayNew(1)>
    <cffunction name="CreateDeck" access="remote">
    <cfscript>ArrayClear(deck);</cfscript>
    <cfset cardsLength = ArrayLen(cards)/>
    <cfset suitsLength = ArrayLen(suits)/>
    <cfloop index="i" from="1" to=#suitsLength#>
    <cfloop index="j" from="1" to=#cardsLength#>
    <cfscript>
    ArrayAppend(deck, [cards[j],suits[i]]);
    </cfscript>
    </cfloop>
    </cfloop>
    <cfscript>ShuffleDeck();</cfscript>
    <cfreturn deck />
    </cffunction>
    <cffunction name="ShuffleDeck">
    <cfset CreateObject("java","java.util.Collections").Shuffle(deck)/>
    </cffunction>
    <cffunction name="DealCard" access="remote">
    <cfset randomNumber = RandRange(1, ArrayLen(deck), "SHA1PRNG")/>
    <cfreturn ArrayLen(deck)/>
    </cffunction>
    </cfcomponent>
    Below is a sample of the Flex code I am using to call the CFC...
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/mx"
      creationComplete="initApp()">
    <fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
    <s:RemoteObject id="svc" destination="ColdFusion" endpoint="http://localhost:8500/flex2gateway/" source="PokerSite.cfc.Deck">
    <s:method name="CreateDeck" result="resultHandler(event)" fault="faultHandler(event)"/>
    <s:method name="DealCard" result="resultHandler(event)" fault="faultHandler(event)"/>
    </s:RemoteObject>
    </fx:Declarations>
    <fx:Script>
    <![CDATA[
    import mx.rpc.events.FaultEvent;
    import mx.rpc.events.ResultEvent;
    private function initApp():void
    svc.CreateDeck();
    private function doDeal():void
    svc.DealCard();
    private function resultHandler(e:ResultEvent):void
    trace(e.result);
    private function faultHandler(e:FaultEvent):void
    trace(e.fault);
    ]]>
    </fx:Script>
    <s:Panel x="0" y="0" width="250" height="200">
    <s:Button click="doDeal()" label="Deal"/>
    </s:Panel>
    </s:WindowedApplication>
    When I call the CreateDeck() function of the CFC, it returns the entire deck just fine. However, when I then call the DealCard() function by clicking the button, it returns a length of 0 of the deck object in the CFC (just returning the length to test that the deck has been created for now) as if the deck was never created. I did some searching online, and found that I might have to setup the remoting-config.xml file to allow application level scope. I then setup the remoting-config.xml like so...
    <destination id="ColdFusion">
    <channels>
    <channel ref="my-cfamf"/>
    </channels>
    <properties>
    <source>*</source>
    <scope>application</scope>
    </properties>
    </destination>
    Yet, this still fails the same way. Does anyone know if I am missing a simple step? Or setting up the application scope in the wrong place? It definitely sounds like the problem I am having, but when I change that remoting-config.xml file, it doesn't seem to change anything in the way the functions are called.

    Anyone have any idea for this?

  • Cairngorm, XMPP, and Services

    I'm trying to build an XMPP service that inherits from
    AbstractService so that I can use it in a Cairngorm based project.
    I'm having a real hard time following the twist and turns of some
    of the existing services, ie RemoteObject and HTTPServices. Are
    there any example implementations? Documentation talking about how
    to build a new service? Any help would be appreciated.
    Thanks in advance - AYAL

    http://letmegooglethatforyou.com/?q=xiff

  • Cairngorm 3 + AIR + Modules

    I had seen a couple of posts about the issues using modules in AIR application. Does Cairngorm 3 [Module Library] provides a solution for this issue OR Module Library only supports Flex Applications for now?
    -MD

    Thanks Alex,
    I believe that I've got all the dependencies downloaded from the trunk and in the build path:
    Module
    Navigation
    Integration
    IntegrationRPC
    Task
    parsley-complete-flex3-2.1.0.swc
    spicelib-complete-flex-2.1.0.swc
    Here's the PM that is dispatching the event:    
    ilc.modules.timeline.presentation{
    import flash.events.EventDispatcher;  
    import ilc.modules.timeline.GetDecadesEvent; 
    Event(name="getDecades", type="ilc.modules.timeline.GetDecadesEvent")][ManagedEvents(
    "getDecades")] 
    public class TimelinePM extends EventDispatcher{
    public function TimelinePM(){
    getDecades();
    public function getDecades():void
    dispatchEvent(
    new GetDecadesEvent());}
    Here's the Command class:
    package  
    ilc.modules.timeline.application{
     import ilc.modules.timeline.GetDecadesEvent; 
    import ilc.modules.timeline.domain.Decades; 
    import mx.collections.ArrayCollection; 
    import mx.rpc.AsyncToken; 
    import mx.rpc.events.FaultEvent; 
    import mx.rpc.events.ResultEvent; 
    import mx.rpc.remoting.mxml.RemoteObject; 
    public class GetDecadesCommand{
    public function GetDecadesCommand(){
    [MessageDispatcher]
    public var dispatcher:Function; 
    [Inject]
    public var decades:Decades; 
    [Inject(id=
    'remoteService')] 
    public var service:RemoteObject; 
    [Command]
    public function execute(event:GetDecadesEvent):AsyncToken{
    trace('getting decades'); 
    return service.getDecades() as AsyncToken;}
    [CommandResult(selector=
    "getDecades")] 
    public function serviceResult(event:ResultEvent):void{
    decades.decades =
    new ArrayCollection(event.result as Array);}
    [CommandFault(selector=
    "getDecades")] 
    public function showError(fault:FaultEvent):void{
    trace(fault.toString()); 
    Do you see anything obvious?
    Jeff

Maybe you are looking for