how to embed youtube on my flash site?
Copy link to clipboard
Copied
How do I embed a youtube video on my flash website (using flash cs3 AS2). I have tried importing video but after entering the url it keeps saying falied to load FLV:
I'm not sure thats is the right way to do it. All tutorials on the web seem to be about HTML.
Copy link to clipboard
Copied
This works with a tiny little snippet:
function containYoutube(youtubevar, depthLevel) {
this.createEmptyMovieClip("youtubecontainer",depthLevel);
this.youtubecontainer.loadMovie("http://www.youtube.com/v/"+youtubevar);
}
containYoutube("PXu6AKePXkQ",this.getNextHighestDepth());
You can now just enter the Youtube internal ID and chose your depth.
Much fun
Florian
Copy link to clipboard
Copied
Yippmaster, would it be possible for you to paste in some actual working sample code? I see here you have put it generic instructional variables but that does not help someone like me who needs to see an ACTUAL EXAMPLE of what the correct code should look like.
I pasted your code exactly and got syntax errors on lines 2 and 3, which are these lines:
this.createEmptyMovieClip("youtubecontainer",depthLevel);
this.youtubecontainer.loadMovie("http://www.youtube.com/v/"+youtubevar);
Copy link to clipboard
Copied
Hi Nate,
if you paste the above code in an AS2 Flash CS3 Programm without any changes onto an empty Frame - > it works.
Regards
Florian
(Example here:
Copy link to clipboard
Copied
WOAH MY GOD. Sorry about that, I guess I pasted it wrong. Thank you!
Is it difficult to change the player's look?
I had a perfectly good player working and playing YT vids, but YT went and changed something and now it doesn't work anymore.
Copy link to clipboard
Copied
My old player was Toobplayer, but the author of that component has recently accidentally destroyed his own player. I guess he's working on it now.
So, this is a good solution. Thanks again.
Is there a way to SCALE THE MOVIE PLAYER?
Copy link to clipboard
Copied
Hi Nate,
the full exmplanation is available at google
http://code.google.com/apis/youtube/player_parameters.html
So the example line
http://www.youtube.com/v/VIDEO_ID&color1=0x2b405b&color2=0x6b8ab6&fs=1
shows you exactly what to do
To go back to my example simply change the youtubevar which calls the function to the whole expression:
containYoutube("PXu6AKePXkQ&color1=0x2b405b&color2=0x6b8ab6&fs=1",this.getNextHighestDepth());
And happy experimenting!
About scaling:
I couldn't find a paramter to receive a scaled version directly.
So I think not - only with more complex stuff.
Florian waves
Copy link to clipboard
Copied
thank you so much!!
Copy link to clipboard
Copied
Hi Nate.
I've just been playing about with sticking Youtubes into my flash site. I've opted to use the code as outlined in this thread as it works spot on. I was also looking for a way to set the scale (this code seems to load as a basic square, something to do with youtube perhaps?) and found myself working through a long line of suggestions and nothing has worked so far. The colour and boarder options have been pretty good though.
But how about this as an option, dont edit with code, do it the old fashioned way, hands on. I've set up a separate layer for each Vid, on each layer I've drawn out a small square (something to represent the shape of the youtube vid). Convert this shape a movie clip and within this place a second layer with the code on it. then come out and test.
You'll notice the vid plays to the far right of the little box you drew, no problem and now this box is the handle to move the vid about, when it's in place you can go back inside the movie clip and set alpha of this handle to 0%. But while you're working with it it's good to have it pink or something.
The youtube video is now linked with the handle and both are relative, you can now play with the scale of your handle and the scale of your video will do the same. Not the best solution by but it certainly made my day.
Thanks to all in this thread as I'd be truly stuck if you hadn't bothered.
All the best and sorry if this is all too wordy.
Copy link to clipboard
Copied
P.S.
Does anyone know what the code would be when clicking a button on the same page that holds the youtube vid, that tells flash to put away the youtube movie as it crashes the site when the flash file tries to continue to another page. Too much going on it would appear. You can still hear the video being played even though you skip to a new page in the falsh movie.
Many Thanks,
Dan
Copy link to clipboard
Copied
Sorry for pastin twice (well erased now so not anymore)
Copy link to clipboard
Copied
thanks for your help. I'll try to get the code running at the weekend

Copy link to clipboard
Copied
Does anyone know how this would work in action script 3?
Best wishes,
Copy link to clipboard
Copied
Good Day
Does anyone know How do I embed a youtube video on my flash website, i'm using flash CS5 and ActionScript 2???!!
I've seen several video tutorials on youtube and other websites about this, but they only work with a window of 480px for 385px (4:3),
which doesn't allow the fullscreen option on the lower bar of the video, because the player still had a silver bar not a black one !!!!
This is the one i've been using!!! http://www.youtube.com/watch?v=wfU5Hj3uKZ4
I would like to use a widescreen window (16:9; 16:10), like the ones youtube curently uses, 360p; 480p;720p.
I would very much appreciate any help you can give me!!!
Thank you

