tag:robotlegs.tenderapp.com,2009-10-18:/discussions/robotlegs-2/7074-loading-the-assetsRobotlegs: Discussion 2013-10-14T08:35:47Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/293032422013-10-09T18:07:33Z2013-10-14T07:56:58ZLoading the assets<div><p>Sorry, I had a mistake. I can't dispatch the event. When I try
to do it, I obtain an error because the eventDispatcher is
null.</p></div>amkokytag:robotlegs.tenderapp.com,2009-10-18:Comment/293032422013-10-10T08:56:37Z2013-10-14T07:56:58ZLoading the assets<div><p>Hi again!</p>
<p>Ok, I change a bit the steps:<br>
- when the app is initialized, I create the context. - I create a
view and dispatch MyEvent.LOAD_ASSETS when the view is added to
stage.(without inject anything) - In the viewMediator I add
"addViewListener(MyEvent.LOAD_ASSETS, dispatch, MyEvent);"</p>
<ul>
<li>in the appConfig file I have,
"commandMap.map(MyEvent.LOAD_ASSETS,
MyEvent).toCommand(LoadAssetsCommand);" and
"mediatorMap.map(MainView).toMediator(MainViewMediator); "</li>
</ul>
<p>Now I don't have an error, but nothing happens. The execute
function in the LoadAssetsCommand is not called</p></div>amkokytag:robotlegs.tenderapp.com,2009-10-18:Comment/293032422013-10-10T10:12:18Z2013-10-14T07:56:58ZLoading the assets<div><p>And here is the test project. I don't know what else I can do
:-(</p></div>amkokytag:robotlegs.tenderapp.com,2009-10-18:Comment/293032422013-10-10T10:31:03Z2013-10-10T10:31:03ZLoading the assets<div><p>Hello Carlos,</p>
<p>I haven't looked properly, but noticed that you didn't override
the <code>clone()</code> method in your custom event. See: <a href=
"https://github.com/robotlegs/robotlegs-framework/wiki/common-problems#wiki-event-dispatch-broken">
https://github.com/robotlegs/robotlegs-framework/wiki/common-proble...</a></p>
<p>Hopefully that will fix it.</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/293032422013-10-10T10:35:39Z2013-10-14T07:56:58ZLoading the assets<div><p>OMG! BINGOO!!!!!!! Thanks Shaun. Just that was the problem.</p></div>amkokytag:robotlegs.tenderapp.com,2009-10-18:Comment/293032422013-10-10T10:46:11Z2013-10-10T10:46:11ZLoading the assets<div><p>Cool! Without overriding <code>clone</code> the event will be
turned into an object of type <code>Event</code> instead of
<code>MyEvent</code> when redispatched (or bubbled). Because your
mapping explicitly requires an event of type <code>MyEvent</code>
the plain event will be ignored.</p></div>Shaun Smith