在Flex应用程序双显示器支持 [英] Dual Monitor Support in Flex Application

查看:112
本文介绍了在Flex应用程序双显示器支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立使用Adobe Flex和AIR。

I am building an application for windows using adobe flex and Air.

这将支持两个显示器,一个将被用于选择视频播放,和其他将被用来玩QUED /选定的视频。

It will support two displays, one will be used to select the video to play, and the other will be used to play the qued/selected videos.

我读了Adobe网站上,该航然而支持多屏幕显示,它没有进入非常深入。

I read on the adobe website, that Air supports multiple displays however, it did not go into great depth.

这是我第一次做这个,所以可能有人请: 一)让我知道是否有可能 B)给我的,我怎么能实现它的概述

This is my first time doing this, so could someone please: a) let me know if it is possible b) give me an overview of how I could achieve it

感谢

推荐答案

我会尽力来形容一个简单的例子。

I'll try to describe a simple example.

让我们假设你的视频列表是主应用程序窗口(这是你一直想看到的窗口)和播放器窗口是可选的,这取决于用户是否选择视频或没有。

Let's assume your list of videos is the main application window (this is the window you always want to see) and the player window is optional, depending on whether the user selected a video or not.

首先,创建播放窗口:

<!-- PlayerWindow.mxml -->
<s:Window xmlns:fx="http://ns.adobe.com/mxml/2009" 
          xmlns:s="library://ns.adobe.com/flex/spark" 
          width="400" height="300">

    <fx:Declarations>
        <fx:String id="video" />
    </fx:Declarations>

    <s:Label text="Now playing: {video}" />

</s:Window>

正如你可以看到有没有视频播放器在那里:我只是婉的例子是尽可能简单
。 现在从主应用程序,我们要打开该窗口,并设置视频当用户从列表中选择视频属性:

As you can see there's no video player in there: I just wan the example to be as simple as possible.
Now from the main application we are going to open that window and set that video property when the user selects a video from a list:

<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                       xmlns:s="library://ns.adobe.com/flex/spark">

    <fx:Script>
        <![CDATA[               
            private var playerWindow:PlayerWindow;

            private function openPlayerWindow():void {
                //only open a new window if it isn't already there,
                //otherwise just set the 'video' property
                if (!playerWindow) {
                    playerWindow = new PlayerWindow();
                    playerWindow.addEventListener(Event.CLOSE, onClose);
                    playerWindow.open();
                }
                playerWindow.video = movieList.selectedItem;
            }

            private function onClose(event:Event):void {
                //remove the reference to the window when the user closes it,
                //so we can reopen it later
                playerWindow.removeEventListener(Event.CLOSE, onClose);
                playerWindow = null;
            }
        ]]>
    </fx:Script>

    <s:List id="movieList" change="openPlayerWindow()">
        <s:dataProvider>
            <s:ArrayList>
                <fx:String>Batman</fx:String>
                <fx:String>Superman</fx:String>
                <fx:String>Spiderman</fx:String>
            </s:ArrayList>
        </s:dataProvider>
    </s:List>

视频属性只是一个简单的在这里的字符串。它可以替换为一种复杂的模型对象。然后,如果从主窗口中更改模型对象的属性,这些变化可以简单地体现在通过数据绑定的播放器窗口。     

The video property is just a simple string here. It can be replaced with a complex model object. If you then change properties of that model object from the main window, those changes can simply be reflected in the player window through data binding.

这篇关于在Flex应用程序双显示器支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆