Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Extensions and Plugins > Components

Reply
 
Thread Tools Rate Thread Display Modes
Old 06-14-2006, 04:11 PM   #1
BluegillMedia
pancake batter
 
BluegillMedia's Avatar
 
Join Date: Dec 2003
Location: Calgary Canada
Posts: 260
Default multiple FLV one player

Sorry, this might be a really basic question but I can't seem to find the answer with my searches.

How do I tell my video component to load different FLVs?
(I want to have a menu that will tell the player which video to play).

Is there a way to do this all on one frame of do i have to create a different frame with a player with a different video in it (which is what I typically have done but figured there must be a better way).

Is this possible in both flash 7 and flash 8?
__________________
Hey! I like potatos!
BluegillMedia is offline   Reply With Quote
Old 06-14-2006, 04:23 PM   #2
guitarman5000
Registered User
 
Join Date: Mar 2006
Location: IL
Posts: 70
Default

i don't really know much about components, but i do know that they can be hard to modify and control. what i do know is that if you make your own interface (which isn't as hard as it may seem) i think it would be easier to use multiple videos. in fact, there's a really really good series of video tutorials at gotoAndLearn.com. if you follow those tutorials, i think once you get started you'll be able to modify it to load movies based on the click of a button as opposed to just automatically loading a movie when the swf loads.
guitarman5000 is offline   Reply With Quote
Old 06-14-2006, 09:13 PM   #3
BluegillMedia
pancake batter
 
BluegillMedia's Avatar
 
Join Date: Dec 2003
Location: Calgary Canada
Posts: 260
Default

So it take it the secret is to not use the component?
__________________
Hey! I like potatos!
BluegillMedia is offline   Reply With Quote
Old 06-15-2006, 12:59 AM   #4
Mazoonist
Site Contributor
 
Mazoonist's Avatar
 
Join Date: Jun 2006
Posts: 3,160
Send a message via AIM to Mazoonist
Default

Create a new flash file. Drag an instance of the FLVPlayback component onto the stage. Give it an instance name. I chose "myPlayer" for a name. Now all you have to do is create a couple of buttons, one for each video you want to load. For simplicity's sake, I'll give them instance names of video1_btn and video2_btn. You'll have to make sure there's a couple of corresponding FLV files in the same folder as your app. Make sure you save the app to that same folder, also, as it won't work if it's just "untitled1" or whatever.

Create an actions layer on the main timeline, click on frame 1, press F9, enter the following code:

Code:
video1_btn.onRelease = function() {
      myPlayer.contentPath = "first_video_filename.FLV";
}
video2_btn.onRelease = function() {
      myPlayer.contentPath = "second_video_filename.FLV";
}
So if you think the secret is to not use components, I beg to differ. The above is really simple, no? And it worked fine for me. Give it a try.
Mazoonist is offline   Reply With Quote
Old 06-18-2006, 09:13 PM   #5
jathomas
Registered User
 
Join Date: Jun 2006
Posts: 8
Question I was having the same problem, now I'm having a different one!

I'm also using a FLVPlayBack component, and this solution works for me, thanks!!!

The only problem is, I'm trying to load different FLV's by having the user click on thumbnails that are in a scroller. Once I nest the thumbnails into another movie clip, this code doesn't work anymore. What can I do?

Last edited by jathomas; 06-18-2006 at 10:11 PM.
jathomas is offline   Reply With Quote
Old 06-19-2006, 12:02 AM   #6
Mazoonist
Site Contributor
 
Mazoonist's Avatar
 
Join Date: Jun 2006
Posts: 3,160
Send a message via AIM to Mazoonist
Default

Hey, JA,

When you've got movie clips that are nested, just the name of the object won't do as a reference anymore; you've got to specify a path to it as well. There are two types of target paths: absolute and relative. In other words, either

this._parent.myPlayer.contentPath = "filename.FLV";

OR

_root.myPlayer.contentPath = "fileName.FLV";

The first is a relative path, the second is an absolute one. Either one should work okay, and which to use is simply a matter of personal preference. Your file structure or object names may vary from the above, though, so here's a tip: In the actions panel, there's a little icon that looks like a bullseye. It's an "insert target path" button. When you click it, you'll get a dialog box in which you can navigate your document like a tree, find the object you want to target with code, and then click either "absolute" or "relative" at the bottom, and it'll give you the proper path. Absolute means "works from anywhere" and relative means "works from here" (that is, from wherever you happen to be writing code currently). Hope all that helps.

Thanks for the reply. I was starting to wonder if anyone was out there.
Mazoonist is offline   Reply With Quote
Old 06-19-2006, 03:58 AM   #7
jathomas
Registered User
 
Join Date: Jun 2006
Posts: 8
Thumbs up Like a charm!

Quote:
Originally Posted by Mazoonist
Thanks for the reply. I was starting to wonder if anyone was out there.
I know what ya mean! You've saved me a good deal of trouble, at least a couple of hours, the least I can do is drop you a line and let you know it worked. I'm relatively new to AScript, so I often don't know what direction to look in when my stuff don't work!

If you want to see what I'm working on, it is at animationjason.com, and should be MUCH further along soon, once I implement the thumbnail navigation you helped me with.
jathomas is offline   Reply With Quote
Old 06-21-2006, 05:53 PM   #8
BluegillMedia
pancake batter
 
BluegillMedia's Avatar
 
Join Date: Dec 2003
Location: Calgary Canada
Posts: 260
Default

Thanks for the help guys. As it turns out I ended up hand scripting a video interface. It allowed me to put my play buttons in the corner based on the browser size (not the flash movie size) which left the movie clean in the middle of the browser. It took a bit more time, but I think it was worth it.

I will however use the code above when I have less time (which is usually the case).
__________________
Hey! I like potatos!
BluegillMedia is offline   Reply With Quote
Old 06-27-2006, 05:02 AM   #9
birstein
Registered User
 
Join Date: Jun 2006
Posts: 3
Default

Quote:
Originally Posted by Mazoonist
Create a new flash file. Drag an instance of the FLVPlayback component onto the stage. Give it an instance name. I chose "myPlayer" for a name. Now all you have to do is create a couple of buttons, one for each video you want to load. For simplicity's sake, I'll give them instance names of video1_btn and video2_btn. You'll have to make sure there's a couple of corresponding FLV files in the same folder as your app. Make sure you save the app to that same folder, also, as it won't work if it's just "untitled1" or whatever.

Create an actions layer on the main timeline, click on frame 1, press F9, enter the following code:

Code:
video1_btn.onRelease = function() {
      myPlayer.contentPath = "first_video_filename.FLV";
}
video2_btn.onRelease = function() {
      myPlayer.contentPath = "second_video_filename.FLV";
}
So if you think the secret is to not use components, I beg to differ. The above is really simple, no? And it worked fine for me. Give it a try.
This does not work for me. If I click Video 1 button it will play the first video but when I click Video 2 button nothing happens. If I exit SWF and start again and click Video 2 button first, it will play just fine but when I click Video 1 button, nothing happens. Any ideas? i can't imagine what I'm doing wrong...instructions are so simple...
birstein is offline   Reply With Quote
Old 06-27-2006, 05:27 AM   #10
Mazoonist
Site Contributor
 
Mazoonist's Avatar
 
Join Date: Jun 2006
Posts: 3,160
Send a message via AIM to Mazoonist
Default

Hey birstein,
Only thing I can think of that it might be is this:

Are you using simple buttons, or are you using the component buttons? Because sometimes the component buttons goof up if you set onRelease handlers for them, because they weren't designed to work that way. Either:

1. Use simple buttons. Make a shape onstage and convert to button symbol. Your onRelease handlers stay the same. --or--

2. Go ahead and use the component buttons. But re-write the handlers like this:
Code:
video1.clickHandler = function() {
    myPlayer.contentPath = "first_video_filename.flv";
}
video2.clickHandler = function() {
    myPlayer.contentPath = "second_video_filename.flv";
}
Mazoonist is offline   Reply With Quote
Reply


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Maximize stand-alone movie player across multiple monitors briansage Projectors and CDs 22 04-21-2006 11:41 AM
Placing Multiple .swf file in 1 media player efficiently ipropa ActionScript 1.0 (and below) 0 07-03-2005 09:30 PM
Placing Multiple .swf file in 1 media player efficiently ipropa ActionScript 2.0 0 07-02-2005 03:28 PM
Flash player detection on website with multiple entry points cruiserparts ActionScript 1.0 (and below) 0 05-25-2005 05:43 PM


All times are GMT. The time now is 11:57 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.