problem with mediator and service.
Hello, I am trying to build a simple app that consists of a button (in fl.controls package, I imported those by exporting swc in CS5) and a list (in fl.controls package, same senario).
There are two problems with my app: 1. The button gets mediated (consol outputs "button mediated"), but list does not. 2. Also, in AccessDataCommand.as, the instance of AccessDataService, service, which I injected, is causing Error #1009, being null.
The attached files are my source files.
- RSSInfo.as 279 Bytes
- RSSContext.as 1.05 KB
- ApplicationMediator.as 674 Bytes
- ButtonView.as 189 Bytes
- ButtonViewMediator.as 581 Bytes
- ListView.as 210 Bytes
- ListViewMediator.as 474 Bytes
- IAccessDataService.as 173 Bytes
- AccessDataService.as 1.22 KB
- AccessDataEvent.as 358 Bytes
- AccessDataCommand.as 335 Bytes
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Shaun Smith on 24 Jun, 2010 09:21 PM
Try changing the order of things in your context startup:
Notice that the ApplicationMediator mapping happens right at the end.
When you map a mediator to the contextView that mediator gets created immediately, so this line:
mediatorMap.mapView(RSSInfo, ApplicationMediator);
was causing an instance of ApplicationMediator to be created immediately - which, in your case, was too soon (before the ListViewMediator and IAccessDataService were mapped).
Hope that helps!
2 Posted by Seungtack Baek on 25 Jun, 2010 04:04 PM
THANKS A LOT! that fixed the ListView Issue.
However, it keeps saying that "service" in the AccessDataCommand.as is null.
How so?
Support Staff 3 Posted by Shaun Smith on 25 Jun, 2010 05:29 PM
Hi,
You are trying to access the property in the AccessDataCommand's constructor - that is too soon, the property will not have been injected yet. You should move that code into the execute() method, like so:
Stray closed this discussion on 16 Feb, 2011 09:05 PM.