actionscript 3 - code is not working for rewinding a dynamically added video -


i have loaded flv video dynamically as3 library. want rewind it, code not working. showing:

scene 1, layer 'layer 1', frame 1, line 64 1119: access of possibly undefined property playheadtime through reference static type flash.media:video..

here code. not find problem. great.

stage.displaystate = stagedisplaystate.full_screen;  import flash.media.video;  import fl.video.flvplayback; var connection:netconnection = new netconnection(); var stream:netstream; var speed:number; var seekpoint:number; var rewind:boolean ; var  forward:boolean ; var video:video = new video(1130,510); var metaobj:object = new object();  function onmetadata(data:object):void {  }  connection.connect(null); stream = new netstream(connection); stream.client = metaobj; metaobj.onmetadata = onmetadata; video.attachnetstream(stream); addchild(video); stream.play("sequence 01_1.flv"); video.x = 0; video.y = 0; rw.addeventlistener(mouseevent.mouse_down,  rw_click); function rw_click(event:mouseevent):void  {          trace("startforward called");         speed = speed +10;         trace("seekspeed: " + speed);         seekpoint = video.playheadtime;         trace("initial playhead time: " + seekpoint);         video.stop();         rewind = false         forward= true;         //video.addeventlistener(event.frame_constructed,onconstructframe);      }   function onconstructframe(event:event):void     {          if(forward)         {             if(video.playheadtime >= seekpoint)             {                 trace("before seek cal.: " + seekpoint);                 seekpoint = seekpoint + speed;                 trace("after seek cal.: " + seekpoint);                 video.seek(seekpoint);                /* if(seekpoint > ftime)                 {                     forward=false;                   //  video.removeeventlistener(event.frame_constructed,onexitframe);                 }*/             }          }     } 

the videoclass don't have property playheadtime. have time-property of netstream-object. further there no seek-method. both available in flvplayback-component. should use play(name, time)

if working netstreamand `video' can use this:

... if(stream.time >= seekpoint) //in seconds {      trace("before seek cal.: " + seekpoint);      seekpoint = seekpoint + speed;      trace("after seek cal.: " + seekpoint);      stream.play("sequence 01_1.flv", seekpoint);      /* if(seekpoint > ftime)      {           forward=false;           //  video.removeeventlistener(event.frame_constructed,onexitframe);      }*/ } ... 

greetings andré


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -