actionscript 3 - clear video before going to another frame -


hello im doing presentation has videos on it. watch videos have made buttons , found code bring external videos stage. problem when go next frame last video stays there. code have set videos on stage:

miguel_btn.addeventlistener(mouseevent.click,video_miguel); function video_miguel(event:mouseevent):void { var conexion10:netconnection= new netconnection(); conexion10.connect(null); var display10:netstream= new netstream(conexion10); display10.play("miguel_1.flv"); var video10:video=new video(); video10.attachnetstream(display10); video10.x= 150; video10.y= 250; stage.addchild(video10); display10.addeventlistener(asyncerrorevent.async_error,nomostrar10); function nomostrar10(event:asyncerrorevent):void { } }  

and trying removing them :

if (event.keycode == keyboard.right) {         nextframe();                 video10.clear(); } 

but new @ as3 , not work. thanks.

since didn't post entire code difficult determine problem. believe issue lies in problem keyboard event not firing. recommend trying following code see if resolves problem.

instead of calling video10.clear(); removed object entirely well.

import flash.events.mouseevent; import flash.events.keyboardevent; import flash.net.netconnection; import flash.media.video; import flash.net.netstream;  miguel_btn.addeventlistener(mouseevent.click, video_miguel); stage.addeventlistener(keyboardevent.key_down, handlekeydown);  var video10:video; var display10:netstream;  function video_miguel(event:mouseevent):void {      display10 = new netstream(new netconnection());     display10.play("miguel_1.flv");      video10 = new video();     video10.attachnetstream(display10);     video10.x = 150;     video10.y = 250;      stage.addchild(video10); }  function handlekeydown(ke:keyboardevent):void {     //keycode 39 right arrow key.     if(ke.keycode == 39) {         nextframe();     //we can remove video calling function below.         stage.removechild(video10);     } } 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -