4 Replies Latest reply on Jan 6, 2010 7:26 AM by Montgomery Kern

    Flash Embed

    Montgomery Kern

      Hello I am working on a swf that calls a flv embed to play. I am calling a default image at the begining before the video starts. Does anyone know if it is possible to control the z index or level of this image in actionscript. My problem is when the image shows up it is showing up over my flash video controls and they are not visible. So after the movie is over it shows the image and the controls are there just hidden behind this image now.

       

      Thanks in advance

      M

        • 1. Re: Flash Embed
          M_Bakker

          If the image is a part of your SWF movie (not in the actual webpage) then you can change the childIndex. This can be compared to the z-index in CSS: the order of components. Check the documentation on DisplayObjectContainer.

           

          Good luck,

           

          Michiel

          • 2. Re: Flash Embed
            Montgomery Kern Level 1

            This is my code can you show me where and how i would set the child index

             

            import fl.video.*;
            import flash.display.*;
            import flash.events.Event;
            import flash.net.URLRequest;

             

            // Set Variables
            var flvControl:FLVPlayback = display;
            var flvSource:String = "http://c0524322.cdn.cloudfiles.rackspacecloud.com/Marco_HD_Movie_01.mov";

             

            // Load image...
            var defaultImage:Bitmap;
            var defaultImagePath:String = "http://www.marcoislandmarriott.com/images/beachgrl.jpg";
            var defaultImageLoader:Loader = new Loader();
            defaultImageLoader.load(new URLRequest(defaultImagePath));

             

            // Determine when to show the image...
            function enterFrameHandler(event:Event):void
            {
               // If the video is stopped on frame 1, show the image
               defaultImage.visible = display.playheadTime < 0.2;
            }
            // Handle image positioning when loaded...
            function defaultImageHandler(event:Event):void
            {
               // Position with video...
               defaultImage = event.currentTarget.content as Bitmap;
               defaultImage.x = display.x;
               defaultImage.y = display.y;
               addChild(defaultImage);
              
               // Monitor the video
               addEventListener(Event.ENTER_FRAME, enterFrameHandler);
            }
            defaultImageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, defaultImageHandler);

             

            // Load the video...
            flvControl.autoPlay = true;
            flvControl.autoRewind = true;
            flvControl.scaleMode = VideoScaleMode.NO_SCALE;
            flvControl.source = flvSource;

            • 3. Re: Flash Embed
              M_Bakker Level 1

              You could try addChildAt() to add your image:

               

              addChildAt(defaultImage, 0); // first argument is the DisplayObject, second is the index (starting from 0 if I'm not mistaken).
              

               

               

              Good luck,

               

              Michiel

              • 4. Re: Flash Embed
                Montgomery Kern Level 1

                Thank you very much your solution worked for me nicely.

                 

                I really appreciate you taking the time to assist me with this.

                 

                 

                 

                Warmest Regards

                Monte