Following on from the simple BatteryBroadcaster class posted last week I have put together a second helper class for FlashLite, again built in ActionScript 2, so it should work for any FlashLite 2 or FlashLite 3 project. The NetworkBroadcaster class centralises all network and signal related events, and broadcasts any changes to listeners on 2 separate intervals. One for general signal levels, the other for “other” network status events, for example changes in network generation support.
The idea here is that signal levels probably change more frequently than some of the other network properties, so we may not need to check them so frequently. In theory this should reduce processing in our application, and as a result save our users some precious battery time. I say in theory, I haven’t tested is this makes any noticeable difference.
The NetworkBroadcaster class, like the BatteryBroadcaster class, uses some custom “Event” classes, SignalEvent and NetworkEvent, these both extend from the same custom core Event class as was used in the BatteryBroadcaster class. Once again I am using the EventDispatcher class to broadcast the Network and signal changes. This should mean that there is a limited file size over head in your application if you are:
- Already using the
mx.events.EventDispatcherclass in your FlashLite application
- Planning on or maybe already are, using my
com.bittube.core.BatteryBroadcasterclass in your FlashLite application. (incidentally if you are I am honored, and would also like to know 😀 )