06-14-2006, 04:11 PM
|
#1
|
|
pancake batter
Join Date: Dec 2003
Location: Calgary Canada
Posts: 260
|
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!
|
|
|
06-14-2006, 04:23 PM
|
#2
|
|
Registered User
Join Date: Mar 2006
Location: IL
Posts: 70
|
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.
|
|
|
06-14-2006, 09:13 PM
|
#3
|
|
pancake batter
Join Date: Dec 2003
Location: Calgary Canada
Posts: 260
|
So it take it the secret is to not use the component?
__________________
Hey! I like potatos!
|
|
|
06-15-2006, 12:59 AM
|
#4
|
|
Site Contributor
Join Date: Jun 2006
Posts: 3,160
|
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.
|
|
|
06-18-2006, 09:13 PM
|
#5
|
|
Registered User
Join Date: Jun 2006
Posts: 8
|
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.
|
|
|
06-19-2006, 12:02 AM
|
#6
|
|
Site Contributor
Join Date: Jun 2006
Posts: 3,160
|
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.
|
|
|
06-19-2006, 03:58 AM
|
#7
|
|
Registered User
Join Date: Jun 2006
Posts: 8
|
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.
|
|
|
06-21-2006, 05:53 PM
|
#8
|
|
pancake batter
Join Date: Dec 2003
Location: Calgary Canada
Posts: 260
|
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!
|
|
|
06-27-2006, 05:02 AM
|
#9
|
|
Registered User
Join Date: Jun 2006
Posts: 3
|
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...
|
|
|
06-27-2006, 05:27 AM
|
#10
|
|
Site Contributor
Join Date: Jun 2006
Posts: 3,160
|
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";
}
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 02:17 PM.
///
|
|