Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
0

AS3 Full Screen script, video crashed

Explorer ,
Jun 25, 2013 Jun 25, 2013

I load external video with playback component (skin over play stop seek mute vol.swf), its working great but when I use 

fscommand("fullscreen", "true");

on my first scene (first keyframe in time), and after that when I reach my video scene. I got just black screen

1.jpg

2.jpg

TOPICS
ActionScript
14.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 30, 2013 Jun 30, 2013

use the netstream class:

var nc:NetConnection=new NetConnection();

nc.connect(null);

var ns:NetStream=new NetStream(nc);

var video:Video=new Video();

addChild(video);

video.attachNetStream(ns);

ns.play("yourvideo.flv");

Translate
Explorer ,
Jul 01, 2013 Jul 01, 2013

Thx boss u are great. Its working

But I have some more questions

Can we mention some size (height and width), position(x and y) and control (play, pause, streaming line and volume?)

for the video height and widht i try this, its working but how to get video position and control?

package  {

          import flash.display.SimpleButton;

          import flash.events.MouseEvent;

          import flash.media.Video;

          import flash.net.NetConnection;

          import flash.net.NetStream;

 

          public class clickbutton extends SimpleButton {

 

                    public function clickbutton() {

                              this.addEventListener(MouseEvent.CLICK, clickF);

                    }

 

                    private function clickF(e:MouseEvent):void{

                              var nc:NetConnection=new NetConnection();

                              nc.connect(null);

                              var ns:NetStream=new NetStream(nc);

                              var video:Video=new Video(320, 200);

                              this.parent.addChild(video);

                              video.attachNetStream(ns);

                              ns.play("video_test.flv");

                    }

          }

}

You can see, now its look like this

2.jpg

and also I got output error

Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095: flash.net.NetStream was unable to invoke callback onMetaData. error=ReferenceError: Error #1069: Property onMetaData not found on flash.net.NetStream and there is no default value.

                at clickbutton/clickF()

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 01, 2013 Jul 01, 2013

you should check the netstream class to see how to add video controls.

to remove the error and position your video:

l?

package  {

          import flash.display.SimpleButton;

          import flash.events.MouseEvent;

          import flash.media.Video;

          import flash.net.NetConnection;

          import flash.net.NetStream;

          public class clickbutton extends SimpleButton {

                    public function clickbutton() {

                              this.addEventListener(MouseEvent.CLICK, clickF);

                    }

                    private function clickF(e:MouseEvent):void{

                              var nc:NetConnection=new NetConnection();

                              nc.connect(null);

                              var ns:NetStream=new NetStream(nc);

                              var video:Video=new Video(320, 200);

video.x=(stage.stageWidth-320)/2;

video.y=(stage.stageHeight-200)/2;

ns.client=this;

                              this.parent.addChild(video);

                              video.attachNetStream(ns);

                              ns.play("video_test.flv");

                    }

private function onMetaData():void{

}

          }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 02, 2013 Jul 02, 2013

Cool its working boss

package {

                import flash.display.SimpleButton;

                import flash.events.MouseEvent;

                import flash.media.Video;

                import flash.net.NetConnection;

                import flash.net.NetStream;

                               

                                public class clickbutton extends SimpleButton {

                                                public function clickbutton() {

                                                                this.addEventListener(MouseEvent.CLICK, clickF);

                                                }

                                                private function clickF(e:MouseEvent):void{

                                                                var nc:NetConnection=new NetConnection();

                                                                nc.connect(null);

                                                                var ns:NetStream=new NetStream(nc);

                                                                var video:Video=new Video(320, 200);

                                                                video.x=(stage.stageWidth-320)/2;

                                                                video.y=(stage.stageHeight-200)/2;

                                                                ns.client=this;

                                                                this.parent.addChild(video);

                                                                video.attachNetStream(ns);

                                                                ns.play("video_test.flv");

                                }

                                private function onMetaData():void{

                                }

                }

}


How we can create some control buttons like...... play, pause, volume control, mute and stemming

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 02, 2013 Jul 02, 2013

check the netstream class to created controls.  it has play() and pause() methods for your play and pause buttons and it has a soundTransform property you can use to control your sound.

package {

                import flash.display.SimpleButton;

                import flash.events.MouseEvent;

                import flash.media.Video;

                import flash.net.NetConnection;

                import flash.net.NetStream;

                               

                                public class clickbutton extends SimpleButton {

var ns:NetStream;

  var previousVolume:Number = 1;

                                                public function clickbutton() {

                                                                this.addEventListener(MouseEvent.CLICK, clickF);

                                                }

                                                private function clickF(e:MouseEvent):void{

                                                                var nc:NetConnection=new NetConnection();

                                                                nc.connect(null);

                                                                ns=new NetStream(nc);

                                                                var video:Video=new Video(320, 200);

                                                                video.x=(stage.stageWidth-320)/2;

                                                                video.y=(stage.stageHeight-200)/2;

                                                                ns.client=this;

                                                                this.parent.addChild(video);

                                                                video.attachNetStream(ns);

                                                                ns.play("video_test.flv");

controlsF();

                                }

private function controlsF():void{

play_btn.addEventListener(MouseEvent.CLICK,playF);

pause_btn.addEventListener(MouseEvent.CLICK,pauseF);

muteToggle_btn.addEventListener(MouseEvent.CLICK,muteF);

// add volume listener here.  you'll need to decide how you want to control volume. 

}

function playF(e:MouseEvent):void{

ns.play();

}

function pauseF(e:MouseEvent):void{

ns.pause();

}

function muteF(e:MouseEvent):void{

if(ns.soundTransform.volume>0){

var st:SoundTransform=ns.soundTransform;

previousVolume=st.volume;

st.volume=0;

ns.soundTransform=st;

} else {

var st:SoundTransform=ns.soundTransform;

st.volume=previousVolume;

ns.soundTransform=st;

}

}

                                private function onMetaData():void{

                                }

                }

}


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 02, 2013 Jul 02, 2013

I make 3 buttons and give him instance name (play_btn, pause_btn, muteToggle_btn) but got some compiler errors

package {

                import flash.display.SimpleButton;

    import flash.events.MouseEvent;

                import flash.media.Video;

                import flash.net.NetConnection;

                import flash.net.NetStream;

                              

                public class clickbutton extends SimpleButton {

                                var ns:NetStream;

                                var previousVolume:Number = 1;

                               

                                public function clickbutton() {

                                                this.addEventListener(MouseEvent.CLICK, clickF);

                                }

                               

                                private function clickF(e:MouseEvent):void{

                                                var nc:NetConnection=new NetConnection();

                                                nc.connect(null);

                                                ns=new NetStream(nc);

                                                var video:Video=new Video(320, 200);

                                                video.x=(stage.stageWidth-320)/2;

                                                video.y=(stage.stageHeight-200)/2;

                                                ns.client=this;

                                                this.parent.addChild(video);

                                                video.attachNetStream(ns);

                                                ns.play("video_test.flv");

                                                controlsF();

                                }

                               

                                private function controlsF():void{

                                                play_btn.addEventListener(MouseEvent.CLICK,playF);

                                                pause_btn.addEventListener(MouseEvent.CLICK,pauseF);

                                                muteToggle_btn.addEventListener(MouseEvent.CLICK,muteF);

                                                // add volume listener here.  you'll need to decide how you want to control volume.

                                }

                                function playF(e:MouseEvent):void{

                                                ns.play();

                                }

                               

                                function pauseF(e:MouseEvent):void{

                                                ns.pause();

                                }

                               

                                function muteF(e:MouseEvent):void{

                                                if(ns.soundTransform.volume>0){

                                                                var st:SoundTransform=ns.soundTransform;

                                                                previousVolume=st.volume;

                                                                st.volume=0;

                                                                ns.soundTransform=st;

                                                } else {

                                                                var st:SoundTransform=ns.soundTransform;

                                                                st.volume=previousVolume;

                                                                ns.soundTransform=st;

                                                }

                                }

                               

                                private function onMetaData():void{

                                }

                }

}

3.jpg

4.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 04, 2013 Jul 04, 2013

1. those 3 buttons don't exist when your code executes.

2. import the soundtransform class, import flash.media.SoundTransform;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 04, 2013 Jul 04, 2013

there's another work-around found recently by another forum user.

use two different flvplayback components.  one acts as a parent for the other that plays the flv:

flv_pb_parent.addChild(flv_pb);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 09, 2013 Jul 09, 2013

Sorry to say boss how and where I can use this?

flv_pb_parent.addChild(flv_pb);

Now I use this code and got these complier errors

package {

                import flash.display.SimpleButton;

    import flash.events.MouseEvent;

                import flash.media.Video;

                import flash.net.NetConnection;

                import flash.net.NetStream;

                import flash.media.SoundTransform;

                public class clickbutton extends SimpleButton {

                                var ns:NetStream;

                                var previousVolume:Number = 1;

                                public function clickbutton() {

                                                this.addEventListener(MouseEvent.CLICK, clickF);

                                }

                                private function clickF(e:MouseEvent):void{

                                                var nc:NetConnection=new NetConnection();

                                                nc.connect(null);

                                                ns=new NetStream(nc);

                                                var video:Video=new Video(320, 200);

                                                video.x=(stage.stageWidth-320)/2;

                                                video.y=(stage.stageHeight-200)/2;

                                                ns.client=this;

                                                this.parent.addChild(video);

                                                video.attachNetStream(ns);

                                                ns.play("video_test.flv");

                                                controlsF();

                                }

                                private function controlsF():void{

                                                play_btn.addEventListener(MouseEvent.CLICK,playF);

                                                pause_btn.addEventListener(MouseEvent.CLICK,pauseF);

                                                muteToggle_btn.addEventListener(MouseEvent.CLICK,muteF);

                                                // add volume listener here.  you'll need to decide how you want to control volume.

                                }

                                function playF(e:MouseEvent):void{

                                                ns.play();

                                }

                                function pauseF(e:MouseEvent):void{

                                                ns.pause();

                                }

                                function muteF(e:MouseEvent):void{

                                                if(ns.soundTransform.volume>0){

                                                                var st:SoundTransform=ns.soundTransform;

                                                                previousVolume=st.volume;

                                                                st.volume=0;

                                                                ns.soundTransform=st;

                                                } else {

                                                                var st:SoundTransform=ns.soundTransform;

                                                                st.volume=previousVolume;

                                                                ns.soundTransform=st;

                                                }

                                }

                                private function onMetaData():void{

                                }

                }

}

5.jpg6.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 09, 2013 Jul 09, 2013

add the flvplayback component that plays your video to a parent flvplayback in your original setup that used the flvplayback.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 11, 2013 Jul 11, 2013

Sorry to say, I didn’t get you point

- do I have to add FLV play back component on my scene?

- Do I have to assign this FLV play back component any instance name or give any source file?

- If i use FLV play back component then how we can call this in over video button script?

7.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 11, 2013 Jul 11, 2013

use two different flvplayback components.  add a 2nd to your stage at 0,0 and assign it an instance name (eg, flv_pb_parent).   then add the following actionscript

flv_pb_parent.addChild(flv_pb);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 17, 2013 Jul 17, 2013

I use 2 FLVPlay back component and assign 1st FLVPlay back component instance name (flv_pb_parent). I didn’t give 2nd component instance name

8.jpg


flv_pb_parent.addChild(flv_pb);   this code where I have to use. This is my code which I use


package {

                import flash.display.SimpleButton;

    import flash.events.MouseEvent;

                import flash.media.Video;

                import flash.net.NetConnection;

                import flash.net.NetStream;

                import flash.media.SoundTransform;

                              

                public class clickbutton extends SimpleButton {

                                var ns:NetStream;

                                var previousVolume:Number = 1;

                               

                                public function clickbutton() {

                                                this.addEventListener(MouseEvent.CLICK, clickF);

                                }

                               

                                private function clickF(e:MouseEvent):void{

                                                var nc:NetConnection=new NetConnection();

                                                nc.connect(null);

                                                ns=new NetStream(nc);

                                                var video:Video=new Video(320, 200);

                                                video.x=(stage.stageWidth-320)/2;

                                                video.y=(stage.stageHeight-200)/2;

                                                ns.client=this;

                                                this.parent.addChild(video);

                                                video.attachNetStream(ns);

                                                ns.play("video_test.flv");

                                                controlsF();

                                }

                               

                                private function controlsF():void{

                                                play_btn.addEventListener(MouseEvent.CLICK,playF);

                                                pause_btn.addEventListener(MouseEvent.CLICK,pauseF);

                                                muteToggle_btn.addEventListener(MouseEvent.CLICK,muteF);

                                                // add volume listener here.  you'll need to decide how you want to control volume.

                                }

                                function playF(e:MouseEvent):void{

                                                ns.play();

                                }

                               

                                function pauseF(e:MouseEvent):void{

                                                ns.pause();

                                }

                               

                                function muteF(e:MouseEvent):void{

                                                if(ns.soundTransform.volume>0){

                                                                var st:SoundTransform=ns.soundTransform;

                                                                previousVolume=st.volume;

                                                                st.volume=0;

                                                                ns.soundTransform=st;

                                                } else {

                                                                var st:SoundTransform=ns.soundTransform;

                                                                st.volume=previousVolume;

                                                                ns.soundTransform=st;

                                                }

                                }

                               

                                private function onMetaData():void{

                                }

                }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 17, 2013 Jul 17, 2013

if there's no flv_pb you should be seeing an error message.  if you don't see an error message you're not using the code i suggested.

assign one of the components the instance name, flv_pb.

use the code i suggested.

position the parent where you want your video to appear and position flv_pb at 0,0

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 18, 2013 Jul 18, 2013

I assignee 1st FLVplayback component instance name (flv_pb_parent) and 2nd FLVplayback component instance name is (flv_pb)

9.jpg

and i try this code

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

package {

                import flash.display.SimpleButton;

                import flash.events.MouseEvent;

                import flash.media.Video;

                import flash.net.NetConnection;

                import flash.net.NetStream;

                import flash.media.SoundTransform;

                              

                public class clickbutton extends SimpleButton {

                                var ns:NetStream;

                                var previousVolume:Number = 1;

                               

                                public function clickbutton() {

                                                this.addEventListener(MouseEvent.CLICK, clickF);

                                }

                               

                                private function clickF(e:MouseEvent):void{

                                                flv_pb_parent.addChild(flv_pb);

                                                var nc:NetConnection=new NetConnection();

                                                nc.connect(null);

                                                ns=new NetStream(nc);

                                                var video:Video=new Video(320, 200);

                                                video.x=(stage.stageWidth-320)/2;

                                                video.y=(stage.stageHeight-200)/2;

                                                ns.client=this;

                                                this.parent.addChild(video);

                                                video.attachNetStream(ns);

                                                ns.play("video_test.flv");

                                                controlsF();

                                }

                               

                                private function controlsF():void{

                                                play_btn.addEventListener(MouseEvent.CLICK,playF);

                                                pause_btn.addEventListener(MouseEvent.CLICK,pauseF);

                                                muteToggle_btn.addEventListener(MouseEvent.CLICK,muteF);

                                                // add volume listener here.  you'll need to decide how you want to control volume.

                                }

                                function playF(e:MouseEvent):void{

                                                ns.play();

                                }

                               

                                function pauseF(e:MouseEvent):void{

                                                ns.pause();

                                }

                               

                                function muteF(e:MouseEvent):void{

                                                if(ns.soundTransform.volume>0){

                                                                var st:SoundTransform=ns.soundTransform;

                                                                previousVolume=st.volume;

                                                                st.volume=0;

                                                                ns.soundTransform=st;

                                                } else {

                                                                var st:SoundTransform=ns.soundTransform;

                                                                st.volume=previousVolume;

                                                                ns.soundTransform=st;

                                                }

                                }

                               

                                private function onMetaData():void{

                                }

                }

}

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

I got some compiler errors

10.jpg

I am sure I did some wrong

if you don’t mind can you check my project and solve this problem

http://delta-adv.com/nav/external_video.rar

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 18, 2013 Jul 18, 2013

use:

MovieClip(root).flv_pb_parent.addChild(flv_pb);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 19, 2013 Jul 19, 2013

i try this code

9.jpg

package {

                import flash.display.SimpleButton;

                import flash.events.MouseEvent;

                import flash.media.Video;

                import flash.net.NetConnection;

                import flash.net.NetStream;

                import flash.media.SoundTransform;

                import flash.display.MovieClip;

                              

                public class clickbutton extends SimpleButton {

                                var ns:NetStream;

                                var previousVolume:Number = 1;

                               

                                public function clickbutton() {

                                                this.addEventListener(MouseEvent.CLICK, clickF);

                                }

                               

                                private function clickF(e:MouseEvent):void{

                                                //flv_pb_parent.addChild(flv_pb);

                                                MovieClip(root).flv_pb_parent.addChild(flv_pb);

                                                var nc:NetConnection=new NetConnection();

                                                nc.connect(null);

                                                ns=new NetStream(nc);

                                                var video:Video=new Video(320, 200);

                                                video.x=(stage.stageWidth-320)/2;

                                                video.y=(stage.stageHeight-200)/2;

                                                ns.client=this;

                                                this.parent.addChild(video);

                                                video.attachNetStream(ns);

                                                ns.play("video_test.flv");

                                                controlsF();

                                }

                               

                                private function controlsF():void{

                                                play_btn.addEventListener(MouseEvent.CLICK,playF);

                                                pause_btn.addEventListener(MouseEvent.CLICK,pauseF);

                                                muteToggle_btn.addEventListener(MouseEvent.CLICK,muteF);

                                                // add volume listener here.  you'll need to decide how you want to control volume.

                                }

                                function playF(e:MouseEvent):void{

                                                ns.play();

                                }

                               

                                function pauseF(e:MouseEvent):void{

                                                ns.pause();

                                }

                               

                                function muteF(e:MouseEvent):void{

                                                if(ns.soundTransform.volume>0){

                                                                var st:SoundTransform=ns.soundTransform;

                                                                previousVolume=st.volume;

                                                                st.volume=0;

                                                                ns.soundTransform=st;

                                                } else {

                                                                var st:SoundTransform=ns.soundTransform;

                                                                st.volume=previousVolume;

                                                                ns.soundTransform=st;

                                                }

                                }

                               

                                private function onMetaData():void{

                                }

                }

}

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

and in this time i got these compiler errors

11.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 20, 2013 Jul 20, 2013

use MovieClip(root) to reference flv_pb_parent and flv_p:

MovieClip(root).flv_pb

MovieClip(root).flv_pb_parent

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 21, 2013 Jul 21, 2013

got compiler errors

12.jpg

Here it the code which I use

package {

                import flash.display.SimpleButton;

    import flash.events.MouseEvent;

                import flash.media.Video;

                import flash.net.NetConnection;

                import flash.net.NetStream;

                import flash.media.SoundTransform;

                import flash.display.MovieClip;

                              

                public class clickbutton extends SimpleButton {

                                var ns:NetStream;

                                var previousVolume:Number = 1;

                               

                                public function clickbutton() {

                                                this.addEventListener(MouseEvent.CLICK, clickF);

                                }

                               

                                private function clickF(e:MouseEvent):void{

                                                MovieClip(root).flv_pb;

                                                MovieClip(root).flv_pb_parent;

                                                var nc:NetConnection=new NetConnection();

                                                nc.connect(null);

                                                ns=new NetStream(nc);

                                                var video:Video=new Video(320, 200);

                                                video.x=(stage.stageWidth-320)/2;

                                                video.y=(stage.stageHeight-200)/2;

                                                ns.client=this;

                                                this.parent.addChild(video);

                                                video.attachNetStream(ns);

                                                ns.play("video_test.flv");

                                                controlsF();

                                }

                               

                                private function controlsF():void{

                                                play_btn.addEventListener(MouseEvent.CLICK,playF);

                                                pause_btn.addEventListener(MouseEvent.CLICK,pauseF);

                                                muteToggle_btn.addEventListener(MouseEvent.CLICK,muteF);

                                                // add volume listener here.  you'll need to decide how you want to control volume.

                                }

                                function playF(e:MouseEvent):void{

                                                ns.play();

                                }

                               

                                function pauseF(e:MouseEvent):void{

                                                ns.pause();

                                }

                               

                                function muteF(e:MouseEvent):void{

                                                if(ns.soundTransform.volume>0){

                                                                var st:SoundTransform=ns.soundTransform;

                                                                previousVolume=st.volume;

                                                                st.volume=0;

                                                                ns.soundTransform=st;

                                                } else {

                                                                var st:SoundTransform=ns.soundTransform;

                                                                st.volume=previousVolume;

                                                                ns.soundTransform=st;

                                                }

                                }

                               

                                private function onMetaData():void{

                                }

                }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 21, 2013 Jul 21, 2013

use the same solution of all display objects on your main timeline.  you're out of scope in that class.

MovieClip(root).whateverdisplayobject.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 22, 2013 Jul 22, 2013

Compiler Errors

13.jpg

here is the code

package {

                import flash.display.SimpleButton;

                import flash.events.MouseEvent;

                import flash.media.Video;

                import flash.net.NetConnection;

                import flash.net.NetStream;

                import flash.media.SoundTransform;

                import flash.display.MovieClip;

                              

                public class clickbutton extends SimpleButton {

                                var ns:NetStream;

                                var previousVolume:Number = 1;

                               

                                public function clickbutton() {

                                                this.addEventListener(MouseEvent.CLICK, clickF);

                                }

                               

                                private function clickF(e:MouseEvent):void{

                                                MovieClip(root).flv_pb;

                                                MovieClip(root).flv_pb_parent;

                                                var nc:NetConnection=new NetConnection();

                                                nc.connect(null);

                                                ns=new NetStream(nc);

                                                var video:Video=new Video(320, 200);

                                                video.x=(stage.stageWidth-320)/2;

                                                video.y=(stage.stageHeight-200)/2;

                                                ns.client=this;

                                                this.parent.addChild(video);

                                                video.attachNetStream(ns);

                                                ns.play("video_test.flv");

                                                controlsF();

                                }

                               

                                private function controlsF():void{

                                                MovieClip(root).play_btn;

                                                MovieClip(root).pause_btn;

                                                MovieClip(root).muteToggle_btn;

                                                play_btn.addEventListener(MouseEvent.CLICK,playF);

                                                pause_btn.addEventListener(MouseEvent.CLICK,pauseF);

                                                muteToggle_btn.addEventListener(MouseEvent.CLICK,muteF);

                                                // add volume listener here.  you'll need to decide how you want to control volume.

                                }

                                function playF(e:MouseEvent):void{

                                                ns.play();

                                }

                               

                                function pauseF(e:MouseEvent):void{

                                                ns.pause();

                                }

                               

                                function muteF(e:MouseEvent):void{

                                                if(ns.soundTransform.volume>0){

                                                                var st:SoundTransform=ns.soundTransform;

                                                                previousVolume=st.volume;

                                                                st.volume=0;

                                                                ns.soundTransform=st;

                                                } else {

                                                                var st:SoundTransform=ns.soundTransform;

                                                                st.volume=previousVolume;

                                                                ns.soundTransform=st;

                                                }

                                }

                               

                                private function onMetaData():void{

                                }

                }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 23, 2013 Jul 23, 2013

use:

     private function controlsF():void{

                                                  MovieClip(root).play_btn.addEventListener(MouseEvent.CLICK,playF);

                                                  MovieClip(root).pause_btn.addEventListener(MouseEvent.CLICK,pauseF);

                                                  MovieClip(root).muteToggle_btn.addEventListener(MouseEvent.CLICK,muteF);

                                                // add volume listener here.  you'll need to decide how you want to control volume.

                                }

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 28, 2013 Jul 28, 2013

I try this its working but having some small problem

When I run the my file first time I got this compiler error

14.jpg

15.jpg

After that when I click on the video button I got this output error (video is playing)

16.jpg

video button, pause button and mute button its working great but play button is not working
- when I click on the play button I got this output error

17.jpg

In the last when video is finished then got this compiler error

18.jpg

This is the code which I use

package {

                import flash.display.SimpleButton;

    import flash.events.MouseEvent;

                import flash.media.Video;

                import flash.net.NetConnection;

                import flash.net.NetStream;

                import flash.media.SoundTransform;

                import flash.display.MovieClip;

                public class clickbutton extends SimpleButton {

                                var ns:NetStream;

                                var previousVolume:Number = 1;

                                public function clickbutton() {

                                                this.addEventListener(MouseEvent.CLICK, clickF);

                                }

                                private function clickF(e:MouseEvent):void{

                                                MovieClip(root).flv_pb;

                                                MovieClip(root).flv_pb_parent;

                                                var nc:NetConnection=new NetConnection();

                                                nc.connect(null);

                                                ns=new NetStream(nc);

                                                var video:Video=new Video(320, 200);

                                                video.x=(stage.stageWidth-320)/2;

                                                video.y=(stage.stageHeight-200)/2;

                                                ns.client=this;

                                                this.parent.addChild(video);

                                                video.attachNetStream(ns);

                                                ns.play("video_test.flv");

                                                controlsF();

                                }

                                private function controlsF():void{

                                                MovieClip(root).play_btn.addEventListener(MouseEvent.CLICK,playF);

                                                 MovieClip(root).pause_btn.addEventListener(MouseEvent.CLICK,pauseF);

                                                 MovieClip(root).muteToggle_btn.addEventListener(MouseEvent.CLICK,muteF);

                                                // add volume listener here.  you'll need to decide how you want to control volume.

                                }                             

                                function playF(e:MouseEvent):void{

                                                ns.play();

                                }

                                function pauseF(e:MouseEvent):void{

                                                ns.pause();

                                }

                                function muteF(e:MouseEvent):void{

                                                if(ns.soundTransform.volume>0){

                                                                var st:SoundTransform=ns.soundTransform;

                                                                previousVolume=st.volume;

                                                                st.volume=0;

                                                                ns.soundTransform=st;

                                                } else {

                                                                var st:SoundTransform=ns.soundTransform;

                                                                st.volume=previousVolume;

                                                                ns.soundTransform=st;

                                                }

                                }

                                private function onMetaData():void{

                                }

                }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 29, 2013 Jul 29, 2013

use:

package {

                import flash.display.SimpleButton;

    import flash.events.MouseEvent;

                import flash.media.Video;

                import flash.net.NetConnection;

                import flash.net.NetStream;

                import flash.media.SoundTransform;

                import flash.display.MovieClip;

                public class clickbutton extends SimpleButton {

                                var ns:NetStream;

                                var previousVolume:Number = 1;

                                public function clickbutton() {

                                                this.addEventListener(MouseEvent.CLICK, clickF);

                                }

                                private function clickF(e:MouseEvent):void{

                                                MovieClip(root).flv_pb;

                                                MovieClip(root).flv_pb_parent;

                                                var nc:NetConnection=new NetConnection();

                                                nc.connect(null);

                                                ns=new NetStream(nc);

                                                var video:Video=new Video(320, 200);

                                                video.x=(stage.stageWidth-320)/2;

                                                video.y=(stage.stageHeight-200)/2;

                                                ns.client=this;

                                                this.parent.addChild(video);

                                                video.attachNetStream(ns);

                                                ns.play("video_test.flv");

                                                controlsF();

                                }

                                private function controlsF():void{

                                                MovieClip(root).play_btn.addEventListener(MouseEvent.CLICK,playF);

                                                 MovieClip(root).pause_btn.addEventListener(MouseEvent.CLICK,pauseF);

                                                 MovieClip(root).muteToggle_btn.addEventListener(MouseEvent.CLICK,mute F);

                                                // add volume listener here.  you'll need to decide how you want to control volume.

                                }                             

                                function playF(e:MouseEvent):void{

                                                ns.resume();

                                }

                                function pauseF(e:MouseEvent):void{

                                                ns.pause();

                                }

                                function muteF(e:MouseEvent):void{

                                                if(ns.soundTransform.volume>0){

                                                                var st:SoundTransform=ns.soundTransform;

                                                                previousVolume=st.volume;

                                                                st.volume=0;

                                                                ns.soundTransform=st;

                                                } else {

                                                                st=ns.soundTransform;

                                                                st.volume=previousVolume;

                                                                ns.soundTransform=st;

                                                }

                                }

                                private function onMetaData():void{ // this needs to be in the scope of your loader

                                }

private function onPlayStatus(eObj:Object):void{

}

                }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 30, 2013 Jul 30, 2013

Its working boss. U r great

Just 1 output error, is this ignorable?

19.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 30, 2013 Jul 30, 2013

yes, you can ignore it.

but try making it public.  i find those messages annoying:

public function onMetaData():void{ // this needs to be in the scope of your loader

                                }

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines