Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Play FLV movie and take layer off screen when movie ends - How?

Status
Not open for further replies.

southbeach

Programmer
Jan 22, 2008
879
US
Using Adobe Flash CS4 ...

I just imported a .F4V file to .fla file - This is the first time I ever attempted this and it was as easy as pie. Since I am not an experienced flash nor AS developer, I simply chose one of the available skins.

Next is to put it up on my blog page but I am at a stand still with how to make movie go away once it finishes playing.

The FLA file has but one frame, I have pressed F9 but there is no AS at all.

I have a component named FLVPlayback in my library - My guess is that this component is the skin I chose which is responsible for loading and playing the movie itself.

Q. How do I (or can I) attach AS to this component?
Q. Could you offer sample code or point me to a tutorial?

Thanks!





--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
The best way to write scripts is to use external class files and not to use the timeline at all. But in this case may be easier for you to write scripts on the timeline.

To interact with FLVPlayback component, first you have to give it a name, but what do you want to do with FLVPlayback exactly?

Kenneth Kawamoto
 
I have a number of FLV movies; these movies are listed in a table (MySQL) where I intend to, at random, play a movie as the home page is opened.

I want to open and play the movie on a layer stacked on top of my normal content. I would like to close/hide the layer once the movie is done. If I could execute an AJAX call from within flash it would be perfect.

The AJAX call must be done once the movie is done ... I may want to use a SKIP button which in turn will call the same AJAX routine.

Does this make sense? If my thoughts are off and there is a better way to do this I am all earls ...

thanks,






--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
OK - I clicked on the FLVPlayback and named the instance ThePlayer (left hand side property box), I then clicked on frame 1 (time line only one layer) and pressed F9 to edit AS; once there, I typed trace(ThePlayer); and saved the movie ...

What's next?



--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
I ran the movie but I see nothing out of the ordinary ... What am I looking for?

oldnewbie, thanks for the link, will read through it ...


--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
You should get the Output.

"Test Movie" is within the Flash IDE, do not run the SWF outside the Flash IDE.

Also make sure you're typing the script in the frame. Your Actions panel tab should say "ACTIONS - FRAME".

Kenneth Kawamoto
 
When I run the movie (within the IDE), I notice nothing out of the ordinary ... The tab labeled "output" next to timeline shows but one line [object FLVPlayback] ...

I then ran the debug and I get this
Code:
Attemping to launch and connect to Player using URL W:\[URL unfurl="true"]www\media\intro\intro.swf[/URL]
[SWF] W:\[URL unfurl="true"]www\media\intro\intro.swf[/URL] - 126231 bytes after decompression
[object FLVPlayback]
[SWF] W:\[URL unfurl="true"]www\media\intro\SkinUnderAll.swf[/URL] - 32428 bytes after decompression

The movie plays fine. I may want to adjust its position and size later but not important now.

Thanks,


--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
> The tab labeled "output" next to timeline shows but one line [object FLVPlayback]

Yes that's what you need :) I just wanted to make sure you named the component correctly.

FLVPlayback Component dispatches the Event called "complete" when the video is finished, so the next step is to add an "Event Listener" to the Component and do something when the Event happens.
Code:
import fl.video.VideoEvent;

thePlayer.addEventListener(VideoEvent.COMPLETE, videoComplete);

function videoComplete(e:VideoEvent):void {
	trace("Video has finished playing.");
}



Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top