为了保障原创作者在本站发表文章的利益, 并维护本站原创的精神, 特声明: RIAShanghai对有以下任何情况之一的文章将不通知作者并直接进行快意删除:
- 非原创, 或者原创但一文多发;
- 各种形式的广告与吹擂;
- 不符合本站文章格式.
欢迎各位读者监督. 谢谢合作. 另: 作为Adobe正式的UG, 我们将把Adobe不定期分发的软件,书籍及各种纪念品赠送给发文活跃的作者, 共同进步.
We love AIR apps' sophisticated standalone application look and we are a big fan of install-free browser SWF apps. That's why we want our applications to run on both AIR and browser platforms. The table below lists my suggestions on developing flex apps targeting both platforms (sorted by importance):
| Features | AIR only classes/functions | Jack's Suggestions |
| Entry point | mx.core.WindowedApplication mx.events.AIREvent |
Create own entry point that can adapt to WindowsApplication (AIR) and Application (browser) |
| Child/popup windows | mx.core.Window mx.managers.WindowedSystemManager |
Create own sub window that can adapt to both Window (AIR) and TitleWindow (browser) |
| Native info/icons | flash.desktop.NativeApplication flash.desktop.Icon/DockIcon/SystemTrayIcon flash.display.NativeMenu/NativeMenuItem flash.display.ContextMenu.items mx.controls.FlexNativeMenu |
Browser version does not set app icon while AIR version can do all the fancy things - set icons, set system menus, start when system starts, exit the app |
| Clipboard & DnD | flash.desktop.Clipboard* flash.desktop.NativeDrag* |
Only the AIR version supports native clipboard and DnD |
| Local file system | flash.filesystem.File* mx.controls.FileSystem* mx.events.FileEvent |
Try not to access the local file system |
| Screen size | flash.display.Screen | SWF's 'screen' is the browser display area and in most cases it occupies the whole 'screen'; you can use the Screen info to maximize the AIR window |
| HTML | flash.html.HTML* mx.controls.HTML mx.core.FlexHTMLLoader |
In AIR, you use this HTML control to display the content; in SWF, you use text components or use the IFrame technique. |
| Local database | flash.data.SQL* flash.errors.SQLError* |
Do not use local database. |
| Encrypted local store | flash.data.EncryptedLocalStore | Do not use EncryptedLocalStore or save data in custom encryption format to SharedObject |
| URL request settings | flash.net.URLRequestDefaults | In AIR, you can use it to configure authentication and caching. In SWF, you do not configure. |
| XML signature validation | flash.security.* | In most cases, you never use this. |
| ByteArray compression | flash.utils.CompressionAlgorithm | Rarely used. If you must use it, consider to implement you own ways of compression algorithm to support both AIR and SWF. |
InsideRIA recently featured an article on how to transit from browser to AIR.