| Previous | Next |
mApplication.addEventListener()
Availability
| Support | PC | Mac | Package (AS3) / Scope (AS2) |
|---|---|---|---|
| ActionScript 3.0 | 4.0 or later | 4.0 or later | stm.mprojector.mApplication stm.mprojector.mApplicationEvent |
| ActionScript 2.0 |
Usage
mApplication.addEventListener(type:String, listener:Function) : VoidParameters
type - AS3 mApplicationEvent Types:
mApplicationEvent.ACTIVATE
mApplicationEvent.DOCUMENT_COMPLETE
mApplicationEvent.DOWNLOAD_COMPLETE
mApplicationEvent.DOWNLOAD_FILE_PROGRESS
mApplicationEvent.MESSAGE
mApplicationEvent.RESTART
mApplicationEvent.SCREEN_CHANGE
mApplicationEvent.SYSTEM_TRAY
listener
Returns
Nothing.
Description
Method; In AS3, event listeners are used to receive application events to your SWF.
ActionScript 3.0 Example:
The following example shows how to be notified when your application is active and respond accordingly.
import stm.mprojector.mApplication;
import stm.mprojector.mApplicationEvent;
function applicationEventHandler(event:mApplicationEvent):void {
switch (event.type) {
case mApplicationEvent.ACTIVATE :
if (event.active) {
// re-draw application to active state
} else {
// re-draw application to in-active state
}
}
}
function initListeners():void {
mApplication.addEventListener(mApplicationEvent.ACTIVATE, applicationEventHandler);
}
initListeners();See Also
mApplicationEvent.ACTIVATE, mApplicationEvent.DOCUMENT_COMPLETE, mApplicationEvent.DOWNLOAD_COMPLETE, mApplicationEvent.DOWNLOAD_FILE_PROGRESS, mApplicationEvent.MESSAGE, mApplicationEvent.RESTART, mApplicationEvent.SCREEN_CHANGE, mApplicationEvent.SYSTEM_TRAY
Code Examples
| Questions or Feedback? | Previous | Next |
- AS2 Migration
- Getting Started - Flash
- Debugging in Flash
- Building your application from inside Flash
- Getting Started - Flex
- Debugging in Flex
- Using mProjector - Compile Your SWF into an Appli
- Customizing The About Window
- Debugging Your Application
- Launching Application at Startup
- Mac vs. Windows Application Development
- Menus
- Dynamic Window Creation
- Application Basics
- mProjector Class Basics
- Add Remove Programs Control Panel
- Fullscreen and Center
- Check Connection and Download File
- Choose Files
- Creating an Installer
- Creating and Controlling Multiple Windows
- Cut, Copy, and Paste (Windows)
- Desktop Shortcut and Start Menu Support
- Drag and Drop Files
- Embedding HTML and other Media types
- Flash-Shaped Windows
- Message Box
- Open Documents
- Project Files
- Reading and Writing to Hard Drive
- Startup Application
- Wallpaper and Screensaver
- Window to Window Communications
- Working with Included Files
- Context Sensitive Menus
- Alert User
- Screen Resolution
