So I'm trying to be as explicit as I can.

The reason for which I choose to go with a module is because there will
be a lot of users which won't be interesetd in acessing this
functionality. It is a window which displays a chart and a datagrid.

Now the the application is a simulation of a horse race and you can
place bets on each of the horses you consider will win. (go to
games.betfair.com and start the - card derby racing game). What you
cannot see now is that when user wil click on either Spades, Hearts,
Clubs, Diamonds in there a pop-up window will show up and will display
information about the betting volume over time. That is the window I am
talking about. So I have a title window in the main application and I
load a module via module loader in that window. (if you look at any
other games at games.betfair.com you's lee when you click on a market
name in there a javascript pop-up showing up with a chart and a grid in
there). I am building something like that in flex...

The main app is based on cairngorm, and I also have cairngorm in my
module a separate controller, and using a simple httpService with the
urls got from the mai app. The module listens for some variables in the
main app and when that change, the bindings tiggers and updates the
chart and datagrid via httpService calls.

I'll paste some code snippets in here so you can get a better
understanding:
The module:

    
//======================================================================\
=================================================
     // Private fields
    
//======================================================================\
=================================================
         private var _currencyFormater : CurrencyFormatter = new
CurrencyFormatter();

         [Bindable]
         private var _model : MarketInfoModel =
MarketInfoModel.getInstance();


//i use these for unwatching the bindings when the module unloads
         private var _gameMarketIdChangeWatcher : ChangeWatcher;
         private var _gameSelectionClickedChangeWatcher : ChangeWatcher;
         private var _updateTradeActivityInfoChangeWatcher :
ChangeWatcher;
         private var _gameMarketSelctionInfoChangeWatcher :
ChangeWatcher;


//the init event handler
         private function initModuleVars() : void
         {
             //get the appmodel
             this._model.gameModel = GamexModel.getInstance();
             this._model.url =
((this._model.gameModel.urls.tradeActivityInfo == null) ||
(this._model.gameModel.urls.tradeActivityInfo == '')) ?
this._model.gameModel.altURLS.tradeActivityInfo :
this._model.gameModel.urls.tradeActivityInfo;
             this._model.currentMarketId =
this._model.gameModel.channel.game.market.marketInfoChangeTrigger.trigge\
ringMarketId;
             this._model.currentSelectionId =
this._model.gameModel.channel.game.market.marketInfoChangeTrigger.trigge\
ringSelectionId;

             //init the model Httpservice with this HTTPService
             this._model.httpService = this.marketInfoHTTPService;

             //set the currency formatter
             this._currencyFormater.precision = 2;
             this._currencyFormater.rounding =
NumberBaseRoundType.NEAREST;
             this._currencyFormater.currencySymbol =
this._model.gameModel.user.currency.symbol;

             trace("init");
}

creationComplete eventHandler
         /**
           * creationComplete eventHandler
           * @return void
           */
         private function onCreationComplete() : void
         {
             trace("1");
             this._gameMarketIdChangeWatcher =
BindingUtils.bindSetter(this.onGameMarketIdChanged,
this._model.gameModel.channel.game.market, "id");
             trace("2");
             this._gameSelectionClickedChangeWatcher =
BindingUtils.bindSetter(this.onGameSelectionClicked,
this._model.gameModel.channel.game.market.marketInfoChangeTrigger,
"triggerMarkeInfoChange");
             trace("3");
             this._updateTradeActivityInfoChangeWatcher =
BindingUtils.bindSetter(this.updateTradeActivityInfo,
this._model,"trigger");
             trace("4");
             this._gameMarketSelctionInfoChangeWatcher =
BindingUtils.bindSetter(this.onGameMarketSelctionInfoChanged,
this._model.gameModel.channel.game.market, "triggerModuleGridUpdate");

             trace("creation complete");
         }

Basically the "init" handler fires for all children and then for the
whole module, it is the creation complete that doesn't get called
sometimes untile very late or the end of the game. Bu it you give time
until then it will show up evetually. The polling for data only happend
when the above bindings are set. I poll for data only inside those
setters...

This morning I have set creation policy to quequed for the module and I
wasn't able to reproduce it until now. However this is not something I
can be sure of that it is indeed the fix... And the fact that this
happend very randomly doesn't help that much either....

TIA,
Claudiu

--- In flexcoders@yahoogroups.com, claudiu ursica <[EMAIL PROTECTED]>
wrote:
>
> I am, but via bindings (set via BindUtils.bind setter in the complete
handler), but I have put a message before those bindings and it is not
like the bindings are not init, the event doesn't get dispatched. The
setters are the one who dispatch cairngorm events and in the command
(actually delegate) I make a request to the server.
>
> I'll post some code tomorrow first thing in the morning...
> Cheers,
> Claudiu
>
>
>
>
> ________________________________
> From: valdhor [EMAIL PROTECTED]
> To: flexcoders@yahoogroups.com
> Sent: Tuesday, November 25, 2008 6:47:09 PM
> Subject: [flexcoders] Re: Module loaded but not displayed every
time...
>
>
> Are you contacting a server by any chance?
>
> Perhaps you could post some code?
>
> --- In [EMAIL PROTECTED] ups.com, "Claudiu Ursica" <the_braniak@
...>
> wrote:
> >
> > Hi again,
> > I see nobody bumped into this issue...
> > Since the previous post I have discovered that the module does not
> > show up because the cration complete event does not fire all the
time.
> > I was able to log the preinitialize event and the init event but
when
> > the module doesn't show it is because the creation complete does not
> > fire. Eventually the module does show after 2 minutes or so... an
then
> > I see the log for creation complete.
> >
> > In my initialize event I initialize some variables and that always
> > gets done, but I vahe no odea what happends sometimes that
determines
> > the creation complete to fire so late.
> >
> > Maybe some of you can help with this,
> > TIA,
> > Caludiu
> >
> >
> > --- In [EMAIL PROTECTED] ups.com, "Claudiu Ursica" <the_braniak@ >
> > wrote:
> > >
> > > Hi,
> > > I load a module using a custom module loader. Event though the
READY
> > > event fires every time, and the visible property traces out to
true, I
> > > am not able to see the module each time I load it. This happens
only
> > > when I start the application. If I can see it the first time I can
> > > then unload and load it again and it gets displayed. However if
I'm
> > > not seeing it the first time it is not visible for good.
> > >
> > > Sometimes (not all the time) I gets shown after a while. I have
tried
> > > invalidating the display list or similar force repainting
techniques
> > > but nothing seems to work.
> > >
> > > Has any of you experienced something similar?
> > > If so please let me know if you have found any workaround.
> > >
> > > TIA,
> > > Claudiu
> > >
> >
>

Reply via email to