Skip to main content
Participant
April 25, 2013
解決済み

Trying to go back to frame 1 at end of FLVPlayback video

  • April 25, 2013
  • 返信数 7.
  • 2373 ビュー

This should be super easy, but I've spent hours searching the web and trying different approaches and I can't get it to work.  Can anyone help?

I have 2 frames

1.  Frame 1: a  static image with a play button

2.  Frame 2: an flv video (FLVPlayback instance named FLVvideo)

The code I have allows the user to click the button on the first screen to start the video. 

When the video ends, I want it to automatically go back to frame 1.

On frame 1, I have AS3 code that does everything except go back to the first frame.  The  FLVvideo.addEventListener(VideoEvent.COMPLETE, moveOn); gives a #1009 error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at health_reform_2_fla::MainTimeline/frame1()

This is the code:

stop()

import fl.video.FLVPlayback;

import flash.events.Event;

import fl.video.VideoEvent;

play_button.addEventListener(MouseEvent.CLICK, fl_ClickToPlayVideo);

FLVvideo.addEventListener(VideoEvent.COMPLETE, moveOn);

function fl_ClickToPlayVideo(event:MouseEvent):void

{

    gotoAndStop(2);

}

function moveOn(event:VideoEvent):void {

     gotoAndStop(1);

}

このトピックへの返信は締め切られました。
解決に役立った回答 kglad

if FLVvideo doesn't exist until frame 2, that FLVvideo listener should be attached to frame 2.

返信数 7

Participating Frequently
April 26, 2013

Hey I think I can help. Try changing the following code:

FLVvideo.addEventListener(VideoEvent.COMPLETE, moveOn);

to this:

FLVvideo.addEventListener(Event.COMPLETE, moveOn);

kglad
Community Expert
Community Expert
April 26, 2013

VideoEvent.COMPLETE is the correct event.

kglad
Community Expert
Community Expert
April 25, 2013

if FLVvideo doesn't exist until frame 2, that FLVvideo listener should be attached to frame 2.