5 Replies Latest reply on Jan 28, 2015 10:26 AM by kglad

    How to create/popup a model dialog window over the vedio

    Johninus Level 1

      There are button, picture box, text, link etc. in the dialog.

       

      If I put everything in another layer with new movieClip, it seems I have to change all the x and y for each control in the movieClip when the dialog is popup. e.g.

       

      import fl.video.*;

       

      videoPlayer.autoRewind = false;

      videoPlayer.addEventListener(fl.video.VideoEvent.PAUSED_STATE_ENTERED,showText);

      videoPlayer.addEventListener(fl.video.VideoEvent.STOPPED_STATE_ENTERED,showText);

                                                             

      function showText(event:fl.video.VideoEvent):void {

           //move each control

          textWindow.x = 275;

          textWindow.y = 200;

       

          btn_1.x = 255;

          btn_1.y = 200;

       

          btn_2.x = 235;

          btn_2.y = 200;

          

           ................................

      }

       

      textWindow.resumeButton.addEventListener(MouseEvent.MOUSE_UP,playVideo);

       

      function playVideo(event:MouseEvent):void {

          textWindow.y = -500;

          videoPlayer.play();

      }

        • 1. Re: How to create/popup a model dialog window over the vedio
          kglad Adobe Community Professional & MVP

          position once and then use addChild and removeChild to add and remove your modal window and buttons.

          • 2. Re: How to create/popup a model dialog window over the vedio
            Johninus Level 1

            Thanks, how about this? But it didn't show up when calling the function:

             

            test1.fla:

            btn_msgbox.addEventListener(MouseEvent.CLICK, showmsgbox);

            function showmsgbox(event:MouseEvent):void

            {

                var msgbox:MessageBox = new MessageBox();

                msgbox.visible = true;

                msgbox.x = fullscreen_btn.x;

                msgbox.y = fullscreen_btn.y;           

            }

             

            MessageBox.as:

             

            package

            {

             

                import flash.display.Sprite;

                import flash.text.TextField;

             

                public class MessageBox extends Sprite

                {

             

                    function MessageBox():void

                    {

             

                        var msgbox:Sprite = new Sprite();

             

                        // drawing a white rectangle

                        //msgbox.graphics.beginFill(0xFFFFFF); // white

                        msgbox.graphics.beginFill(0x00000A);

                        msgbox.graphics.drawRect(0,0,300,20);

                        // x, y, width, height;

                        msgbox.graphics.endFill();

             

                        // drawing a black border

                        msgbox.graphics.lineStyle(2, 0x000000, 100);

                        // line thickness, line color (black), line alpha or opacity;

                        msgbox.graphics.drawRect(0,0,300,20);

                        // x, y, width, height;

             

                        var textfield:TextField = new TextField();

                        textfield.text = "Hi there!";

             

                        addChild(msgbox);

                        addChild(textfield);

                    }

                }

            }

             

            http://edutechwiki.unige.ch/en/AS3_example_Message_Box

            • 3. Re: How to create/popup a model dialog window over the vedio
              kglad Adobe Community Professional & MVP

              you're not going to see any text unless you change the font color or the sprite's fill.

               

              and you probably want to add the textfield to msgbox.

               

              and you're not adding msgbox to the display in your fla.

               

              and you don't need to use the visible property.  just use addChild and removeChild.

              1 person found this helpful
              • 4. Re: How to create/popup a model dialog window over the vedio
                Johninus Level 1

                I change the code but it still dosen't work. Can you please adjust it or give me a example? Thanks.

                 

                 

                btn_msgbox.addEventListener(MouseEvent.CLICK, showmsgbox);

                 

                function showmsgbox(event:MouseEvent):void

                {

                    var msgbox:MessageBox = new MessageBox();   

                    trace("create");

                }

                • 5. Re: How to create/popup a model dialog window over the vedio
                  kglad Adobe Community Professional & MVP

                   

                  btn_msgbox.addEventListener(MouseEvent.CLICK, showmsgbox);

                   

                  function showmsgbox(event:MouseEvent):void

                  {

                      var msgbox:MessageBox = new MessageBox();  

                      addChild(msgbox);

                  }