Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-17-2010, 02:09 AM   #1
Registered User
Join Date: May 2010
Posts: 3
Unhappy [AS3] return to frame 1 on flv playback completion


I have seriously tried my best (I believe) at getting this to work. Simple for most I suspect. But I just cannot get it to work the way it needs to work.

It is a simple play button on frame 1. Once the button is pressed the video plays. I need it to return to frame 1 on flv playback completion.

The best result I have gotten thus far is playback of the FLV with it not returning to frame 1.

Please shed some light, I am stressing and pulling my hair out not knowing what is wrong.

I don’t know if the VideoEvent function is working or not. When I do the declare the video_mc outside of a function the video plays in the background (you can only hear the audio). This is the reason I initially declared the video_mc variable inside of the MouseEvent function as this works fine. I am not sure if this is the correct way of doing it, but it works in my instance.

ActionScript Code:
stop(); import fl.video.VideoEvent; playBtn.addEventListener(MouseEvent.CLICK, startVideo); video_mc.addEventListener(VideoEvent.COMPLETE, onVideoComplete); function startVideo(event:MouseEvent):void {     var video_mc:video = new video();     addChild(video_mc);     trace("video_mc working"); } function onVideoComplete(event:VideoEvent) {     gotoAndStop(1);     trace("restart function working"); }

Thank for any assistance in advance.

dvine is offline   Reply With Quote
Old 05-18-2010, 04:56 AM   #2
Registered User
Join Date: May 2010
Posts: 3

OK guys. It looks like nobody knows how to get this working.

I have played a bit more but now I simply cannot get the flash piece to go back to frame 1 when the FLVPlayBack is completed. The audio issues has been corrected. I do not know how I did but something I changed fixed it.

Here is the AS on frame 1

ActionScript Code:
stop(); var play_btn = new myBTN(); play_btn.addEventListener(MouseEvent.CLICK, gotoNextFrame); addChild(play_btn); function gotoNextFrame(event:MouseEvent):void {     play_btn.alpha = .0;     gotoAndStop(2); }

Here is the AS on frame 2

ActionScript Code:
stop(); import fl.video.*; var video_mc:video = new video(); video_mc.addEventListener(VideoEvent.COMPLETE, onVideoComplete); addChild(video_mc); function onVideoComplete(event:VideoEvent) {     gotoAndStop(1); }

I hope somebody here knows how to get this working.
dvine is offline   Reply With Quote
Old 05-18-2010, 06:23 AM   #3
Registered User
Join Date: May 2010
Posts: 3

Nevermind guys. I realised what I was doing wrong. Because I created another instance/symbol of the flv component and created it as a movieclip, the flvplayback component was not handling the video so the event would not be recognised or whatever the correct terminology is.

Renamed the FLVPlayback component and changed the variable names in code like this.

Now all seems to be functioning correctly.

Frame 1

ActionScript Code:
stop(); var playBtn:myBTN = new myBTN(); playBtn.x = 290; playBtn.y = 172; playBtn.width = 45; playBtn.height = 55; playBtn.addEventListener(MouseEvent.CLICK, gotoNextFrame); addChild(playBtn); function gotoNextFrame(event:MouseEvent):void {     playBtn.visible = false;     gotoAndStop(2); }

Frame 2

ActionScript Code:
import fl.video.*; stop(); var myVideo:FLVPlayback  = new FLVPlayback (); myVideo.source = "myVideo.flv" myVideo.x = 0; myVideo.y = 0; myVideo.width = 600; myVideo.height = 400; addChild(myVideo); myVideo.addEventListener(VideoEvent.COMPLETE, onVideoComplete); function onVideoComplete(event:VideoEvent):void {     gotoAndStop(1); }

Just posted these details in case some flash/actionscript noob douche bag like me runs into the same problem.

On another note: The flv is about 13mb and the swf is 97kb. Should I be creating a pre-loader for the flv?

dvine is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT. The time now is 12:24 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.