As I'm working towards the conclusion of my first major PureMVC project, I thought I'd post a few reminders for myself (and anyone else who might stumble upon such posts) for things to watch out and not do.
The following is a little thing that I ran into with PureMVC. It is not noted here as a criticism of the framework or anything of that sort!
Flex Builder-created Mediators and Listing Notifications
When you create a new PureMVC mediator in Flex Builder 3 using the new ActionScript Class 'wizard', you extend the framework's Mediator class and implement its IMediator interface. Flex Builder provides and option, which you can check, to "Generate functions from inherited interfaces". If this options is selected, Flex Builder stubs out the functions from the interface, as you would expect.
The only problem is that it stubs out the method for listNotifications as follows:
There are two problems with this auto-generated code. First, if you are going to use this method in your mediator, you need to override it. This isn't a big deal because the compiler will throw an error letting you know you need to override it.
Second, this method has to return an array. It can be an empty array, but it must be an array and not a null value. This is not an error that will get caught in the compiler, so your application will run and then throw an error when you try to register your mediator.
If you include this method, and it's not required in mediators unless you want the mediator to subscribe to be sure to have it stubbed out as follows:
In the scenario where you override the function but return null per the Flex Builder-generated code, the Flash player will throw an error when you go to instantiate (register in PureMVC) the Mediator in question, noting that it can't operate on a null value (Error 1009, if I recall).
The problem is that as the Mediator is being registered, the framework wants to know what notifications this mediator is subscribed to. At the least, it needs an empty array to determine that the Mediator is not interested in any notifications. The returned null value just doesn't do it!
It's little, I know, but it cost me a little time trying to track down a null object.
The following is a little thing that I ran into with PureMVC. It is not noted here as a criticism of the framework or anything of that sort!
Flex Builder-created Mediators and Listing Notifications
When you create a new PureMVC mediator in Flex Builder 3 using the new ActionScript Class 'wizard', you extend the framework's Mediator class and implement its IMediator interface. Flex Builder provides and option, which you can check, to "Generate functions from inherited interfaces". If this options is selected, Flex Builder stubs out the functions from the interface, as you would expect.
The only problem is that it stubs out the method for listNotifications as follows:
public function listNotificationInterests():Array
{
return null;
}
There are two problems with this auto-generated code. First, if you are going to use this method in your mediator, you need to override it. This isn't a big deal because the compiler will throw an error letting you know you need to override it.
Second, this method has to return an array. It can be an empty array, but it must be an array and not a null value. This is not an error that will get caught in the compiler, so your application will run and then throw an error when you try to register your mediator.
If you include this method, and it's not required in mediators unless you want the mediator to subscribe to be sure to have it stubbed out as follows:
override public function listNotificationInterests():Array
{
return [];
}
In the scenario where you override the function but return null per the Flex Builder-generated code, the Flash player will throw an error when you go to instantiate (register in PureMVC) the Mediator in question, noting that it can't operate on a null value (Error 1009, if I recall).
The problem is that as the Mediator is being registered, the framework wants to know what notifications this mediator is subscribed to. At the least, it needs an empty array to determine that the Mediator is not interested in any notifications. The returned null value just doesn't do it!
It's little, I know, but it cost me a little time trying to track down a null object.
Sorted.
this is ashik
I'm a beginner in flex develop and programming side ..
your post is useful for myself ..
i want details using SOAP webservice ...