【问题标题】:display a panel at bottom of display screen actionscript 3在显示屏幕actionscript 3的底部显示一个面板
【发布时间】:2014-03-05 17:52:02
【问题描述】:

我在使用 osmf 来保持我的内置 flex 和 as3 的 Flash 播放器的全屏时遇到问题 我想在用户屏幕的底部显示面板栏。这应该适用于所有屏幕分辨率。我目前正在做的工作可以很好地全屏显示视频,但问题是它没有相应地对齐视频控制面板。 我目前拥有的是这个

stage.fullScreenSourceRect = new Rectangle(0, 0, fsvideoContainerW , fsvideoContainerH); videoContainer.width = fsvideoContainerW; videoContainer.height = fsvideoContainerH; stage.scaleMode = StageScaleMode.EXACT_FIT; stage.displayState = StageDisplayState.FULL_SCREEN;

请帮帮我。

【问题讨论】:

    标签: actionscript-3 flash apache-flex fullscreen


    【解决方案1】:

    我在您的代码中看不到专门用于定位控件的代码。创建可调整大小的组件时的主要想法是监听 Event.RESIZE。这是一个小的 sn-p 它是如何工作的:

    package {
    
        import flash.display.Sprite;
        import flash.display.StageAlign;
        import flash.display.StageScaleMode;
        import flash.events.Event;
    
        public class StackOverflow extends Sprite {
            private var _playerControls:VideoPlayerControls;
    
            public function StackOverflow() {
                addEventListener(Event.ADDED_TO_STAGE, onAdded);
            }
    
            private function onAdded(e:Event):void {
                removeEventListener(Event.ADDED_TO_STAGE, onAdded);
    
    
                stage.align = StageAlign.TOP_LEFT;
                stage.scaleMode = StageScaleMode.NO_SCALE;
    
                setup();
            }
    
            private function setup():void {
                //Main event that will help you reposition and resize your UI components
                stage.addEventListener(Event.RESIZE, onResize);
    
                _playerControls = new VideoPlayerControls();
    
                addChild(_playerControls)
            }
    
            private function onResize(e:Event):void {
                _playerControls.updateWidth(stage.stageWidth);
                _playerControls.y = stage.stageHeight - _playerControls.height;
            }
    
        }
    }
    
    import flash.display.Sprite;
    
    internal class VideoPlayerControls extends Sprite {
    
        public function VideoPlayerControls() {
            this.graphics.beginFill(0x333333);
            this.graphics.drawRect(0, 0, 100, 40);
        }
    
        internal function updateWidth(width:int):void {
            //Do logic with reposition and resizing components
            this.width = width;
        }
    }
    

    Stage 属性alignscaleMode 只能在视频播放器启动时设置一次。

    【讨论】:

    • 感谢您的紧急回复。好吧,如果您能提供帮助,我还有另一个问题。我的广播员不在 chrome 中工作,但在 Firefox 和任何其他浏览器中工作完美。我什么都试过了,发现是因为pepper flash插件已经内置了chrome。那么我该如何处理这个问题。我遇到的问题是它不允许单击闪存安全设置选项。任何帮助将不胜感激
    • 安全窗口的界面非常有限。在各种浏览器中存在几个错误(其中一个不可点击......),尤其是在 Mac 下。我可以建议将此作为错误添加到 Adob​​e Bug Tracker 中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-28
    • 1970-01-01
    • 2011-08-10
    • 1970-01-01
    • 2016-06-02
    • 1970-01-01
    相关资源
    最近更新 更多