Actionscript 3 AS3、空气、八哥滑动面板类组件

Actionscript 3 AS3、空气、八哥滑动面板类组件,actionscript-3,starling-framework,Actionscript 3,Starling Framework,我正在为移动设备开发一个使用AS3/Air的应用程序。我正在使用Feathers UI和Starling,但我想创建一个面板幻灯片(菜单、信息面板等),该幻灯片随组件一起提供。我正在考虑创建一个包含“面板”的类,将其导入到我的屏幕上,并使用Greensock来制作tweening 我的问题是: 这是使用椋鸟和羽毛的最好方法吗 考虑到MadComponents是使用闪存而不是Starling构建的,我可以将其与Starling一起使用吗 还有什么其他建议可以让我达到同样的效果吗 基本上,我只需要一

我正在为移动设备开发一个使用AS3/Air的应用程序。我正在使用Feathers UI和Starling,但我想创建一个面板幻灯片(菜单、信息面板等),该幻灯片随组件一起提供。我正在考虑创建一个包含“面板”的类,将其导入到我的屏幕上,并使用Greensock来制作tweening

我的问题是:

  • 这是使用椋鸟和羽毛的最好方法吗
  • 考虑到MadComponents是使用闪存而不是Starling构建的,我可以将其与Starling一起使用吗
  • 还有什么其他建议可以让我达到同样的效果吗
  • 基本上,我只需要一个按钮,用户点击按钮,屏幕左/右交替,“打开”信息面板。再按一下按钮,它就会关闭它


    非常感谢

    如果我正确理解了您所描述的内容,那么ScreenNavigator Feathers类听起来正是您所需要的


    Feathers组件资源管理器使用SlideNavigator的方式与您描述的相同。

    看起来Josh Tynjala希望将此功能添加到Feathers中:

    同时,我也想要同样的东西,所以我只是快速编写了这个,我很高兴与大家分享(警告:还没有经过广泛的测试):


    您可能需要向组件添加一个明确的尺寸,在滑动方向上,如果它接近零。否则,使用应该非常简单。如果您需要更多关于如何使用它的指导,请告诉我。

    谢谢,屏幕导航器很棒,我以前也使用过它,但我希望滑动关闭的屏幕仍然略微向左/向右显示。所以基本上我希望选项卡和面板滑动打开,然后用户单击相同的选项卡关闭面板。也许我会集成mad组件面板。
    package com.hiddenachievement.space.components
    {
        import feathers.core.FeathersControl;
    
        import starling.animation.Transitions;
        import starling.animation.Tween;
        import starling.core.Starling;
        import starling.display.Sprite;
    
        /**
         * Creates a control that emerges from one side of the stage, while moving the main view to show it.
         */
    
        public class EdgeSlideControl extends FeathersControl
        {
            private var _mainView:Sprite;
            private var _open:Boolean;
            protected var _tween:Tween;
            protected var _side:int;
            protected var _callback:Function;
            protected var _uncover:Boolean;
    
            static public const NORTH:int = 0;
            static public const SOUTH:int = 1;
            static public const EAST:int = 2;
            static public const WEST:int = 3;
    
    
            /**
             * Creates an EdgeSlideControl.
             *
             * @param mainView The main view (possibly a ScreenNavigator) that will move to show the menu.
             * @param side The side that the control will emerge from.
             * @param uncover When true, the main view will slide away to uncover the control.  When false, the control will slide in from the side, as the main view slides out of the way. 
             *
             */
            public function EdgeSlideControl(mainView:Sprite, side:int, uncover:Boolean = true)
            {
                super();
                _mainView = mainView;
                _side = side;
                _uncover = uncover;
            }
    
            /**
             * Implements the standard FeathersControl's initialize.
             */
            override protected function initialize():void
            {
                _open = false;
                visible = false;
            }
    
            /**
             * Begin the animation to display the control.
             */
            public function show(callback:Function=null):void
            {
                _callback = callback;
                _tween = new Tween(_mainView, 0.2, Transitions.LINEAR);
                _tween.onUpdate = updateSlide;
                _tween.onComplete = slideComplete;
    
                switch(_side)
                {
                    case NORTH:
                        _tween.animate("y", height);
                        break;
                    case SOUTH:
                        _tween.animate("y", -width);
                        break;
                    case EAST:
                        _tween.animate("x", -height);
                        break;
                    case WEST:
                        _tween.animate("x", width);
                        break;
                }
    
                Starling.juggler.add(_tween);
                _open = true;
                visible = true;
            }
    
            /**
             * Begin the animation to hide the control.
             */     
            public function hide(callback:Function=null):void
            {
                _callback = callback;
                _tween = new Tween(_mainView, 0.2, Transitions.LINEAR);
                _tween.onUpdate = updateSlide;
                _tween.onComplete = slideComplete;
    
                switch(_side)
                {
                    case NORTH:
                    case SOUTH:
                        _tween.animate("y", 0);
                        break;
                    case EAST:
                    case WEST:
                        _tween.animate("x", 0);
                        break;
                }
    
                Starling.juggler.add(_tween);
                _open = false;
            }
    
    
            /**
             * If the control is moving (not in "uncover" mode), move the control into place, next to the main view.
             */         
            public function updateSlide():void
            {
                if (!_uncover)
                {
                    switch(_side)
                    {
                        case NORTH:
                            y = _mainView.y - height;
                            break;
                        case SOUTH:
                            y = _mainView.height - _mainView.y;
                            break;
                        case EAST:
                            x = _mainView.width - _mainView.x;
                            break;
                        case WEST:
                            x = _mainView.x - width;
                            break;
                    }
                }
            }
    
    
            /**
             * Perform any actions needed after the transition is done animating.
             */ 
            public function slideComplete():void
            {
                if (_callback != null)
                {
                    _callback();    
                }
    
                visible = _open;
            }
    
            public function get isOpen():Boolean
            {
                return _open;
            }
    
        }
    }