- 浏览: 101082 次
- 性别:
- 来自: 广州
文章分类
最新评论
-
zhangyulove911:
读XML in a Nutshell (10) -
sunzihao128858:
非常好
Red5源代码分析 - 关键类及其初始化过程 -
还是小鬼:
受用了
Red5源代码分析 - 关键类及其初始化过程 -
qiyue49:
如果有flex4版本,可以直接把C:\Program Fil ...
[转]Flex的中文编译 -
faylai:
标题党骗流量!
20090209-20090211 (about Red5 and Flex)
However, unlike other MXML components, a Window-based component cannot be used in another MXML document. Instead, you create an instance of the MXML component in ActionScript.
Once the window's initial properties are set, you call the Window component's open() method to cause the operating system window to appear on the user's display.
AIR supports three distinct APIs for working with windows: the ActionScript-oriented NativeWindow class, the Flex framework mx:WindowedApplication and mx:Window classes, which "wrap" the NativeWindow class, and, in the HTML environment, the JavaScript Window class.
The mx:WindowedApplication and mx:Window components are designed as Flex containers and so can accept Flex components directly whereas NativeWindow objects cannot. When necessary, NativeWindow properties and methods can be accessed through the WindowedApplication and Window objects using the stage.nativeWindow property.
Many window-related events are dispatched in pairs. The first event warns that a change is about to happen. The second event announces that the change has been made. You can cancel a warning event, but not a notification
Window Types
Normal
A typical window. Normal windows use the full-size style of chrome and appear on the Windows task bar and the Mac OS X window menu.
Utility
A tool palette. Utility windows use a slimmer version of the system chrome and do not appear on the Windows task bar and the Mac OS-X window menu.
Lightweight
Lightweight windows have no chrome and do not appear on the Windows task bar or the Mac OS X window menu. In addition, lightweight windows do not have the System (Alt+Space) menu on Windows. Lightweight windows are suitable for notification bubbles and controls such as combo-boxes that open a short-lived display area. When the lightweight type is used, systemChrome must be set to none.
The desktop window is not created until you call the window open() method. Once a window is opened, these initialization properties cannot be changed.
Native window: Once the window is created, you can initialize its properties and load content into the window using the stage property and Flash display list techniques.
To resize a window, use the NativeWindow startResize() method. When this method is called from a mouseDown event, the resizing operation is driven by the mouse and completes when the operating system receives a mouseUp event. When calling startResize(), you pass in an argument that specifies the edge or corner from which to resize the window.
To move a window without resizing it, use the NativeWindow startMove() method. Like the startResize() method, when the startMove() method is called from a mouseDown event, the move process is mouse-driven and completes when the operating system receives a mouseUp event.
Setting the displayState property of the Stage to StageDisplayState.FULL_SCREEN_INTERACTIVE puts the window in full-screen mode, and keyboard input is permitted in this mode. (In SWF content running in a browser, keyboard input is not permitted). To exit full-screen mode, the user presses the Escape key.
Window menus
A window menu is associated with a single window and is displayed below the title bar.
Context menus
Context menus open in response to a right-click or command-click on an interactive object in SWF content or a document element in HTML content.
Dock and system tray icon menus
These icon menus are similar to context menus and are assigned to an application icon in the Mac OS X dock or Windows notification area.
Pop-up menus
An AIR pop-up menu is like a context menu, but is not necessarily associated with a particular application object or component.
Flex menus
The Flex framework provides a set of Flex menu components. The Flex menus are drawn by the AIR runtime rather than the operating system and are not native menus. A Flex menu component can be used for Flex windows that do not have system chrome.
Menus are hierarchical in nature. NativeMenu objects contain child NativeMenuItem objects. NativeMenuItem objects that represent submenus, in turn, can contain NativeMenu objects. The top- or root-level menu object in the structure represents the menu bar for application and window menus. (Context, icon, and pop-up menus don't have a menu bar).
NativeMenu and NativeMenuItem objects both dispatch displaying and select events:
Displaying:
Immediately before a menu is displayed, the menu and its menu items will dispatch a displaying event to any registered listeners. The displaying event gives you an opportunity to update the menu contents or item appearance before it is shown to the user.
Select:
When a command item is chosen by the user, the item will dispatch a select event to any registered listeners. Submenu and separator items cannot be selected and so never dispatch a select event.
You can assign a key equivalent (sometimes called an accelerator) to a menu command. The menu item will dispatch a select event to any registered listeners when the key, or key combination is pressed. The menu containing the item must be part of the menu of the application or the active window for the command to be invoked.
Key equivalents have two parts, a string representing the primary key and an array of modifier keys that must also be pressed. To assign the primary key, set the menu item keyEquivalent property to the single character string for that key. If you use an uppercase letter, the shift key is added to the modifier array automatically.
To assign different modifier keys, assign a new array containing the desired key codes to the keyEquivalentModifiers property. The default array is overwritten. Whether or not you use the default modifiers or assign your own modifier array, the shift key is added if the string you assign to the keyEquivalent property is an uppercase letter.
Menu items have the two state properties, checked and enabled:
checked
Set to true to display a check mark next to the item label.
enabled
Toggle the value between true and false to control whether the command is enabled. Disabled items are visually "grayed-out" and do not dispatch select events.
The data property of the NativeMenuItem class allows you to reference an arbitrary object in each item.
Setting a window menu
nativeWindowObject.menu = root;
Setting a context menu on an interactive object
interactiveObject.contextMenu = root;
Setting a dock icon menu
DockIcon(NativeApplication.nativeApplication.icon).menu = root;
Setting a system tray icon menu
SystemTrayIcon(NativeApplication.nativeApplication.icon).menu = root;
Displaying a menu as a pop-up
root.display(stage, x, y);
To create a separator line, create a NativeMenuItem, setting the isSeparator parameter to true in the constructor. Then add the separator item to the menu in the correct location:
var separatorA:NativeMenuItem = new NativeMenuItem("A", true);
editMenu.addItem(separatorA);
If you provide more than one image, AIR selects the size closest to the current display size of the taskbar icon, scaling it only if necessary.
To change the icon image, assign an array containing the new image or images to the bitmaps property. You can animate the icon by changing the image in response to an enterFrame or timer event.
To remove the icon from the notification area on Windows, or restore the default icon appearance on Mac OS X, set bitmaps to an empty array.
You can add a menu to the system tray icon by creating a NativeMenu object and assigning it to the NativeApplication.nativeApplication.icon.menu property.
Add a tooltip to an icon by setting the tooltip property:
NativeApplication.nativeApplication.icon.tooltip = "Application name";
The SystemTrayIcon object referenced by the NativeApplication.nativeApplication.icon property dispatches a ScreenMouseEvent for click, mouseDown, mouseUp, rightClick, rightMouseDown, and rightMouseUp events.
On Windows, you can highlight the window taskbar button by calling the notifyUser() method of the NativeWindow instance.
NotificationType.CRITICAL: the window icon flashes until the user brings the window to the foreground.
NotificationType.INFORMATIONAL: the window icon highlights by changing color.
File
File object represents a path to a file or directory. You use a file object to create a pointer to a file or folder, initiating interaction with the file or folder.
FileMode
The FileMode class defines string constants used in the fileMode parameter of the open() and openAsync() methods of the FileStream class. The fileMode parameter of these methods determines the capabilities available to the FileStream object once the file is opened, which include writing, reading, appending, and updating.
FileStream
FileStream object is used to open files for reading and writing. Once you've created a File object that points to a new or existing file, you pass that pointer to the FileStream object so that you can open and then manipulate data within the file.
1.Locate the following files, provided in the samples/badge directory of the Flex SDK, and add them to your web server.
badge.swf
default_badge.html
AC_RunActiveContent.js
2.Open the default_badge.html page in a text editor.
3.In the default_badge.html page, in the AC_FL_RunContent() JavaScript function, adjust the FlashVars parameter definitions for the following:Parameter
Description
appname The name of the application, displayed by the SWF file when the runtime is not installed.
appurl (Required). The URL of the AIR file to be downloaded. You must use an absolute, not relative, URL.
airversion (Required). For the 1.0 version of the AIR runtime, set this to 1.0.
imageurl The URL of the image (optional) to display in the badge.
buttoncolor The color of the download button (specified as a hex value, such as FFCC00).
messagecolor The color of the text message displayed below the button when the runtime is not installed (specified as a hex value, such as FFCC00).
4.The minimum size of the badge.swf file is 217 pixels wide by 180 pixels high. Adjust the values of the width and height parameters of the AC_FL_RunContent() function to suit your needs.
5.Rename the default_badge.html file and adjust its code (or include it in another HTML page) to suit your needs.
badge.fla
The source Flash CS3 file used to compile the badge.swf file. The badge.fla file compiles into a SWF 9 file (which can be loaded in Flash Player ).
AIRBadge.as
An ActionScript 3.0 class that defines the base class used in the basdge.fla file.
You can use Flash CS3 to redesign the visual interface of the badge.fla file.
Loading the air.swf file
var airSWF:Object; // This will be the reference to the main class of air.swf
var airSWFLoader:Loader = new Loader(); // Used to load the SWF
var loaderContext:LoaderContext = new LoaderContext();
// Used to set the application domain domain
loaderContext.applicationDomain = ApplicationDomain.currentDomain;
airSWFLoader.contentLoaderInfo.addEventListener(Event.INIT, onInit);
airSWFLoader.load(new URLRequest("http://airdownload.adobe.com/browserapi/air.swf"), loaderContext);
function onInit(e:Event):void
{
airSWF = e.target.content;
}
With air.swf, you can:
Checking if the AIR runtime is installed - airSWF.getStatus();
Checking from a web page if an AIR application is installed - airSWF.getApplicationVersion(appID, pubID, versionDetectCallback);
Installing an AIR application from the browser - airSWF.installApplication(url, runtimeVersion, arguments);
Launching an installed AIR application from the browser - airSWF.launchApplication(appID, pubID, arguments);
To receive invoke events call the addEventListener() method of the NativeApplication object (NativeApplication.nativeApplication). When an event listener registers for an invoke event, it will also receive all invoke events that occurred before the registration. Queued invoke events are dispatched one at a time on a short interval after the call to addEventListener() returns.
Only one instance of an AIR application is started. When an already running application is invoked again, AIR dispatches a new invoke event to the running instance.
An AIR application can be set to launch automatically when the current user logs in by setting NativeApplication.nativeApplication.startAtLogin=true.
When the application is invoked via the browser, the application's NativeApplication object dispatches a BrowserInvokeEvent object.
Keep in mind that if you add an event listener later in execution (after application initialization) it will still receive all BrowserInvokeEvent events that have occurred since the application started.
If you expect only a specific web site to invoke the application, the application should check the securityDomain property of the BrowserInvokeEvent object.
The quickest way to terminate an application is to call NativeApplication.nativeApplication.exit() and this works fine when your application has no data to save or resources to clean up.
To provide consistent behavior on all platforms, whether the exit sequence is initiated via operating system chrome, menu commands, or application logic, observe the following good practices for exiting the application:
1.Always dispatch an exiting event through the NativeApplication object before calling exit() in application code and check that another component of your application doesn't cancel the event.public function applicationExit():void {
var exitingEvent:Event = new Event(Event.EXITING, false, true);
NativeApplication.nativeApplication.dispatchEvent(exitingEvent);
if (!exitingEvent.isDefaultPrevented()) {
NativeApplication.nativeApplication.exit();
}
}
2.Listen for the application exiting event from the NativeApplication.nativeApplication object and, in the handler, close any windows (dispatching a closing event first).
private function onExiting(exitingEvent:Event):void {
var winClosingEvent:Event;
for each (var win:NativeWindow in NativeApplication.nativeApplication.openedWindows) {
winClosingEvent = new Event(Event.CLOSING,false,true);
win.dispatchEvent(winClosingEvent);
if (!winClosingEvent.isDefaultPrevented()) {
win.close();
} else {
exitingEvent.preventDefault();
}
}
if (!exitingEvent.isDefaultPrevented()) {
//perform cleanup
}
}
3.Windows should always handle their own clean up by listening for their own closing event.
4.Only one exiting listener should be used in your application since handlers called earlier cannot know whether subsequent handlers will cancel the exiting event (and it would be unwise to rely on the order of execution).
Reading the application descriptor file
var appXml:XML = NativeApplication.nativeApplication.applicationDescriptor;
Getting the application and publisher identifiers
trace(NativeApplication.nativeApplication.applicationID);
trace(NativeApplication.nativeApplication.publisherID);
As part of the process of building an AIR file, the AIR Developer Tool (ADT) generates a publisher ID. This is an identifier that is unique to the certificate used to build the AIR file. If you reuse the same certificate for multiple AIR applications, they will have the same publisher ID.
Managing file associations
AIR can only manage associations for the file types originally declared in the application descriptor. You cannot get information about the associations of a non-declared file type.
isSetAsDefaultApplication()
Returns true if the AIR application is currently associated with the specified file type.
setAsDefaultApplication()
Creates the association between the AIR application and the open action of the file type.
removeAsDefaultApplication()
Removes the association between the AIR application and the file type.
getDefaultApplication()
Reports the path of the application that is currently associated with the file type.
Getting the runtime version and patch level
trace(NativeApplication.nativeApplication.runtimeVersion);
trace(NativeApplication.nativeApplication.runtimePatchLevel);
The NativeApplication object dispatches two events that help you detect when a user is actively using a computer. If no mouse or keyboard activity is detected in the interval determined by the NativeApplication.idleThreshold property, the NativeApplication dispatches a userIdle event. When the next keyboard or mouse input occurs, the NativeApplication object dispatches a userPresent event. The idleThreshold interval is measured in seconds and has a default value of 300 (5 minutes). You can also get the number of seconds since the last user input from the NativeApplication.nativeApplication.lastUserInput property.
The LocalConnection class enables communications between AIR applications, as well as among AIR applications and SWF content running in the browser.
By default, the connectionName argument is resolved into a value of "superdomain:connectionName", where superdomain is the superdomain of the file that contains the connect() command. For example, if the file that contains the receiving LocalConnection object is located at www.someDomain.com, connectionName resolves to "someDomain.com:connectionName".
In content running in the application security sandbox in Adobe AIR (content installed with the AIR application), the runtime uses the string app# followed by the application ID for the AIR application (defined in the application descriptor file) in place of the superdomain. For example a connectionName for an application with the application ID com.example.air.MyApp connectionName resolves to "app#com.example.air.MyApp:connectionName".
If the string for connectionNamedoes not begin with an underscore (_), a prefix is added with the superdomain and a colon (for example, "myDomain:connectionName").
If the string for connectionNamebegins with an underscore (for example, "_connectionName"), a prefix is not added to the string. This means that the receiving and sending LocalConnection objects use identical strings for connectionName.
You cannot specify a superdomain in connectionName in the receiving LocalConnection object — you can do this in only the sending LocalConnection object.
发表评论
-
20100505 (flash study)
2010-05-29 09:42 756enterFrame event: If the playhe ... -
更新flex sdk后,如何在flex builder中设置以使用新的特性
2010-02-13 19:47 2898正在做的项目需要将原来跑在浏览器上的flex项目转到air环境 ... -
20091007 (Flex P2P)
2009-10-07 10:10 1490var conn:NetConnection = new Ne ... -
[转]Flex的中文编译
2009-09-17 10:13 2650还是目前的这个项目, ... -
[转]各种减小swf文件大小的方法
2009-09-16 16:54 5463第一步:分离运行库,使用RSL减小FLEX生成文件的体积 要应 ... -
[转] Using custom objects in AMF3 with Red5
2009-07-14 15:00 2394转自http://gregoire.org/2008/09/1 ... -
20090612 (Red5 Study 3)
2009-06-15 09:44 845Is context global or there may ... -
Red5源代码分析 - 关键类及其初始化过程
2009-03-13 16:36 9646Red5如何响应rmpt的请求 ... -
20090312 (Red5 Study 2)
2009-03-12 17:12 1096Standalone server Should be ins ... -
20090310 (Flex Misc)
2009-03-10 17:58 738用popup manager来弹出窗口?用Accordion ... -
20090306 (Flex Microphone)
2009-03-06 14:11 1060Audio qualityEcho suppression: ... -
20090220-20090221 (Red5 Study 1)
2009-02-25 09:29 1214IScope: A statefull object shar ... -
20090216-20090219 (about Red5 and Flex)
2009-02-18 12:20 1198MXML is an XML-based user inter ... -
Red5 and Flex资源
2009-02-11 23:32 1415Red5 website http://osflash.org ... -
[转]Red5 Plugin for Eclipse 插件可更新
2009-02-11 23:07 1240使用ECLIPSE的人,下面的安装步骤不会陌生吧,自然就不用翻 ... -
20090209-20090211 (about Red5 and Flex)
2009-02-11 17:51 3306red5+flex视频聊天所有的 ...
相关推荐
Analysis Laboratory Exercises (WALEXs) in support of the Naval Air Systems Command. The goal of these exercises was to examine a concept then known as the Air-Directed Surface-to-Air Missile (ADSAM) ...
Chapter 17 : Case Study The Album Application Conclusion Chapter 18 : Asset Management Text Optimizing Art Bitmap Size and Mip Mapping Vector Graphics at Runtime Sprite Sheet and Blitting Custom ...
Chapter 17 : Case Study The Album Application Conclusion Chapter 18 : Asset Management Text Optimizing Art Bitmap Size and Mip Mapping Vector Graphics at Runtime Sprite Sheet and Blitting Custom ...
Chapter 17 : Case Study The Album Application Conclusion Chapter 18 : Asset Management Text Optimizing Art Bitmap Size and Mip Mapping Vector Graphics at Runtime Sprite Sheet and Blitting Custom ...
Chapter 17 : Case Study The Album Application Conclusion Chapter 18 : Asset Management Text Optimizing Art Bitmap Size and Mip Mapping Vector Graphics at Runtime Sprite Sheet and Blitting Custom ...
For those who spend most of their time working indoors, the indoor air quality (IAQ) could affect their working efficiency and health. This paper presents an intelligent proportional-integral-...
某二冲程汽油机气口关键参数的研究,丁秋明,苏小平,二冲程汽油机的气口参数对于提高燃油效率具有重要的作用,得到越来越多的关注。通过CATIA5.0建立某型二冲程汽油机的三维模型,对其�
气吸式惯性沉降分离室能耗研究,王立军,,采用相似理论方法中的Jiang -定理和G.Murphy-Jiang定理研究了气吸式割前摘脱联合收获机惯性分离室的压力损失。运用量纲分析进行试验设计
【标题】:“淡化后浓海水制备液体盐过程中除溴工艺及溴的平衡浓度的研究” 在当前的水处理领域,海水淡化技术得到了广泛应用,但其产生的浓海水问题引起了环境关注。浓海水含有高浓度的盐分,特别是溴离子,若不...
In this study, a homogeneous mixture of natural-gas and air was used in a compression ignition engine to reduce NOx emissions and improve thermal efficiency. In order to control ignition timing and ...
本文基于一份名为“A Study of Surface Roughness in Micro-end-milling of Aluminum”的学术论文,深入探讨了微型端铣削铝材过程中影响表面粗糙度的关键因素及其实验结果分析。 ### 引言 微型端铣削是指使用直径...
**蓝牙低功耗(BLE) Mesh 协议开发者学习指南** ...通过阅读《Bluetooth Mesh Developer Study Guide V2.0.1》这份文档,开发者可以获得更深入的理论知识和实践经验,以应对各种BLE Mesh应用场景的挑战。
### 人在高压下的活动:以空中交通管制员通信行为波动扩展为案例研究 #### 概述 本研究探讨了在高压环境下的人类活动特征,并通过分析空中交通管制员(ATC)的通信行为来深入理解这种环境下的行为模式。...
Air-breathing mode laser propulsion experiment with a long-pulse transversely excited (TE) CO<sub>2</sub> laser is carried out, and its ignition problem is solved with the ignition needle of ...
### 四维数值模拟在惯性约束聚变中高功率紫外激光通过长空气路径后受激旋转拉曼散射对近场光束分布的影响研究 #### 摘要与背景 本文探讨了一项关于四维数值模拟的研究,该研究旨在分析在惯性约束聚变(ICF)条件下...
In this study, we propose that by diminishing only the pitch of the innermost air-holes-ring of a HF1 photonic crystal fiber, both an effective mode area up to 100 μm2 at 1.55 μm wavelength and ...
We present a detailed study of oscillating modes in a slab waveguide with air core and anisotropic metamaterial cladding. It is shown that, under specific dielectric configurations, slow and even ...
Experimental study on thermal performance of a novel solar air heater [J]. International Journal of Heat and Mass Transfer, 2017, 107: 592-606. [6] Muraleedharan G, Karamani D. Solar thermal energy ...
A numerical simulation is performed to study the far-field diffraction properties of planar diamond waveguides. The far-field intensity distributions of a planar air waveguide and a diamond waveguide ...