Skip navigation
Currently Being Moderated

Flex 4.5 - Cairngorm Module Support error with creationComplete

Mar 6, 2012 6:00 AM

Tags: #module #cairngorm #creationcomplete #initialize #parsley

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.presentati on.*">

 

 

    <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.

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points