2 Replies Latest reply on Jan 25, 2011 4:13 PM by klebba

    StrobeMediaPlayback loaded externally into all-Flash Microsite?

    klebba

      I'm hoping to leverage the StrobeMediaPlayback as an external asset in my microsite, however it appears that it hasn't been designed for this kind of usage. Am I missing something, or is this a limitation?

       

      Thanks in advance!

       

      Casey

        • 1. Re: StrobeMediaPlayback loaded externally into all-Flash Microsite?
          Andrian Cucu Adobe Employee

          Hi Casey,

           

          The sizing of the player can controlled by removing the stage resize event handler (_stage.addEventListener(Event.RESIZE, onStageResize);) in StrobeMediaPlayback.as and by adding your sizing logic instead.

           

          We didn't had to support this kind of use cases, but I think that you should be able to separate the sizing logic in a way which this can exposed as an API for other developers from our community. If you do so, please share this with us.

           

          -Andrian

          1 person found this helpful
          • 2. Re: StrobeMediaPlayback loaded externally into all-Flash Microsite?
            klebba Level 1

            Thanks for your reply Andrian,

             

            I've managed to make a modification that suits my immediate needs, however I don't believe it's an ideal implementation. I'll share my code below for anyone curious -- hopefully someone can improve upon it (for example the player isn't moved to the top of the display list during fullscreen mode, this may be up to the implementation and not the player itself, I'm not sure)

             

            Thanks,

             

            Casey

             

            ----------------------------------------------

             

            Added setSize() and supporting properties:

            ----------------------------------------------

             

            public var autoFitToStage:Boolean = true;

            public var position:Point = new Point();

            public var containerWidth:Number;

            public var containerHeight:Number;

             

            public function setSize(width:int, height:int):void

            {

            //set container width & height

            containerWidth = width;

            containerHeight = height;

             

            //turn off autoFitToStage

            autoFitToStage = false;

             

            //resize

            onStageResize();

            }

             

            Modified onFullScreen:

            ----------------------------------------------

            private function onFullScreen(event:FullScreenEvent):void

            {

            if (_stage.displayState == StageDisplayState.NORMAL)

            {

            //## Modified -- restore the position if autoFitToStage is off

            if(!autoFitToStage) {

            this.x = position.x;

            this.y = position.y;

             

            return;

            }

            //##

            if (controlBar)

            {

            // Set the autoHide property to the value set by the user.

            // If the autoHide property changed we need to adjust the layout settings

            if (controlBar.autoHide!=configuration.controlBarAutoHide)

            {

            controlBar.autoHide = configuration.controlBarAutoHide;

            layout();

            }

            }

            Mouse.show();

            }

            else if (_stage.displayState == StageDisplayState.FULL_SCREEN)

            {

            if (controlBar)

            {

            // We force the autohide of the controlBar in fullscreen

            controlBarWidth = controlBar.width;

            controlBarHeight = controlBar.height;

             

            controlBar.autoHide = true;

            // If the autoHide property changed we need to adjust the layout settings

            if (controlBar.autoHide!=configuration.controlBarAutoHide)

            {

            layout();

            }

            }

            addChild(mainContainer);

            mainContainer.validateNow();

             

            //## Modified - position the player in the top left corner during fullscreen viewing

            if(!autoFitToStage) {

            position = new Point(this.x, this.y)

            var g2l:Point = this.globalToLocal(position);

             

            this.x = g2l.x;

            this.y = g2l.y;

             

            return;

            }

            //##

            }

             

            }

             

            Modified onStageResize():

            ----------------------------------------------

             

                            private function onStageResize(event:Event = null):void

            {

            var width:Number;

            var height:Number;

             

            //restore the setSize dimensions if autoFitToStage is off and the display state isn't fullscreen

            if(!autoFitToStage && _stage.displayState == StageDisplayState.NORMAL) {

            width = containerWidth;

            height = containerHeight;

            } else {

            width = _stage.stageWidth;

            height = _stage.stageHeight;

            }

             

            // Propagate dimensions to the main container:

            mainContainer.width = width;

            mainContainer.height = height;

             

            // Propagate dimensions to the control bar:

            if (controlBar != null)

            {

            if ( configuration.controlBarMode != ControlBarMode.FLOATING

            || controlBar.width > width

            || _stage.stageWidth < MAX_OVER_WIDTH

            )

            {

            controlBar.width = width;

            }

            else if (configuration.controlBarMode == ControlBarMode.FLOATING)

            {

            controlBar.width = MAX_OVER_WIDTH;

            }

            }

            }