magoproduction

magoproduction

Need some help to embed vimeo video inside my flash as3 project. If anyone could paste, show or whatever a tutorial step by step would be very helpfull. I understand i need this Api from vimeo, I've already requested it. and I red the example code, but i need some help to make it works. Anyone?

Ryan Hefner

Ryan Hefner Staff

Hey Magoproduction,

You can reference the VimeoPlayer class here that will help you load a Vimeo Player (Moogaloop) into your Flash project. Let me know if you run into any issues with the code, or have any additional questions.

vimeo.com/api/docs/moogaloop

Thanks,
Ryan

micatosafaris

micatosafaris

Instructions are vague, I've tried pasting your code into flash, and as external .as file, as I get "Packages Cannot be nested" error. I have no clue how to set this up.

Ryan Hefner

Ryan Hefner Staff

Hey micatosafaris,

You need to make sure that that VimeoPlayer.as file is in the root of your source directory, or the same directory as your FLA. If you want to put it in a different directory, com/vimeo, or something, you will need to update the VimeoPlayer.as file and have the package set to com.vimeo.

Please let me know if you run into any further issues.

Thanks,
Ryan

magoproduction

magoproduction

Hi Ryan, thank you very much for your answer, is any chance to get the code with some different color o signal to understand wich parts i should change for my info. Should I create a mc and apply the code into it?

Ryan Hefner

Ryan Hefner Staff

Hey magoproduction,

Basically, you can download the VimeoPlayer.as file and access it like you would any other object in flash.

player = new VimeoPlayer([YOUR OAUTH KEY], [clip_id], [width], [height] );

Basically, you would be creating a new VimeoPlayer object and assigning it to 'player' (note you need to declare the 'player' object earlier in the class). You also need to supply your oauth_key, the clip_id you want to load and the width and height you want the player to be.

I hope that helps. Please let me know if you run into any other issues.

Thanks,
Ryan

Scott turnbull

Scott turnbull

micatosafaris on my personal account here:

I still get the nesting error, maybe you could provide proper method for calling the VimeoPlayer.as?

Scott turnbull

Scott turnbull

Ok, I've managed to avoid error, here's the line that sets oauth_key etc, I think I did something wrong here,

public function VimeoPlayer("key", 16620162, 408, 219, fp_version:int = 10) {

Ryan Hefner

Ryan Hefner Staff

Hey Scott,

You shouldn't be setting these values in the function declaration. You need to pass in those values when you instantiate a new VimeoPlayer (please reference the code snippet above).

Here is a link to a very quick example of how the VimeoPlayer.as class is used:

dev.ryanhefner.com/moogaloop/vimeo_flash_embed/Document.as

Please let me know if you run into any issues once you have updated your project to reference the class properly.

Thanks,
Ryan

Scott turnbull

Scott turnbull

Sorry about all this, the above snippet you gave me, does this call the API? Do I put htis into the FLA? Looks like the code in the .AS.

In the FLA it tells me Package is unexpected.

Ryan Hefner

Ryan Hefner Staff

Hey Scott,

Yes, we are using classes to manage our code. The reference that I sent you would be the main class defined for the document/MovieClip/FLA that you are working with. It would need to reside in the same directory as your FLA. Here is a good reference for object oriented programming that might help you understand how to structure this into your project:

adobe.com/devnet/actionscript/articles/oop_as3.html

Please let us know if you run into any issues once you have your project structured properly.

Good luck,
Ryan

Scott turnbull

Scott turnbull

Ok, none of this is helping, here is the code on Frame1,
stop();
import VimeoPlayer;
var player:VimeoPlayer = new VimeoPlayer("90a97fd38a241ae7b5c22ee17e113b01", 16620162, 408, 219);
this.addChild(player);

Ready to pack it in on this. So simple yet not working

VideoSpectra

VideoSpectra Plus

Below is the code I'm using. Though I am not getting an error in this but its showing nothing at all when testing file. Just a blank screen. Kindly look in to this matter on urgent basis.

package com.vimeo.example {

import com.vimeo.api.VimeoPlayer;

import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;


public class ExampleProject extends Sprite{

// Elements
private var player : VimeoPlayer;


public function ExampleProject() {
// constructor code
super();
init();
}

public function init() : void
{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;

player = new VimeoPlayer("key", clip_id, 720, 405);
this.addChild(player);
}
}

}

Thanks in advance.

Scott turnbull

Scott turnbull

Ok so that FLA will not open, I'm using PC, but I put all files into a folder on server, embedded SWF into an index.html file and i at least now get flash to crash, IDK.
micato.com/vimeo/

Ryan Hefner

Ryan Hefner Staff

Glad to hear Scott! Let me know if you run into any other issues with the player now that you have it working.

j.m.quigley

j.m.quigley

Hey guys I was following this thread up to the point where Scott says 'Got it working' but didn't explain what he did.

I, too, am unable to open the FLA in either CS3 or CS4.

What am I missing?

micatosafaris

micatosafaris

If Ryan sent you the same example in a ZIP, just put the Document.as, VimeoPlayer.as in same directory as your own FLA, then in the DOcument.as file, swap out the oauth_code, ID, W, H with appropriate values.

In your FLA, only import VimeoPlayer

That's all I did and mine worked.

j.m.quigley

j.m.quigley

Scott sent over some good advice:

Just take the Document.as and VimeoPlayer.as files and put them in same directory as your FLA, then within the FLA use this code where you want to call your video.

import VimeoPlayer;
var player:VimeoPlayer = new VimeoPlayer("API Customer ID", Video ID, Width, Height);
this.addChild(player);

And now I see it kind of draw the player, but it remains blank, and it hides the rest of my site.

I made a blank FLA, added the code mentioned above, and published it. The same thing happened. I'm uploading to the URL i indicated in my 'my applications' to get my oauth key, so I know it's not like I'm running the swf locally...

Same problem with the blank FLA- I see it kind of 'draw' a box, but then nothing appears.

Ryan Hefner

Ryan Hefner Staff

Hey Jonathan,

Could you please provide a link to your site so we can check it out?

Thanks,
Ryan

j.m.quigley

j.m.quigley

Yeah I sure can. So I've got the file with the sample code located here:
quigleydevelopment.com/vimeo/test/

The vimeo video is instantiated once you click the 'alumnae' tab. I don't know why but it seriously impacts the functionality of the rest of the site.

Under the 'contact' tab I have a YouTube embedded. My goal is to have a similarly embeded vimeo player.

A more functional copy of the site is available here:
quigleydevelopment.com/vimeo/test/index2.swf

Index2 is with the vimeo code disabled.

I have the sample code with replaced oauth and id values in my root, and I have an empty movieclip on the stage. When i instantiate the player I add it as a child to the empty movieclip on the stage.

That's exactly how i do the YouTube embedding, which as you can see works (I know they're very different APIs) but when i try to simply add the player to the stage by using this.addchild(player); the whole site crashes and freaks out.

Ryan Hefner

Ryan Hefner Staff

Hey Jonathan,

I would love to explore this more, but I am running into too many errors on your site in order to do so. I would recommend that you install the Debugger version of the Flash Player to help make sure that your SWFs aren't throwing any errors. Once those have been resolved, I can help look into the issue of Moogaloop loading weird into your site.

adobe.com/support/flashplayer/downloads.html

Thanks,
Ryan

j.m.quigley

j.m.quigley

Yeah I see that now. Out of concern for my clients' privacy I moved the files over to my private server and stripped out a lot of material for posting on this forum.

I did, however, get a blank FLA to work with nothnig but the above code, so at least I know there's not a problem with my oAuth or other values.

I will follow up with a cleaned up version if I can't get this to work now that I see how bad the bugs are.

Thank you for all your help.

Ryan Hefner

Ryan Hefner Staff

No problem Jonathan. Definitely let us know if you run into any issues with it once you have the other issues cleaned up.

Thanks,
Ryan

TV-iConcept

TV-iConcept Plus

Hi, (sorry for my bad english)
I need for your help to use VimeoPlayer in Flash Website.
I tested your package .zip, but I can't open the .FLA. I have FlashCS4 on Mac. I need it because I don't understand the methode. I have put the VimeoPlayer.as and the Document.as behind my .fla project, I have modified the Document.as with my values :
player = new VimeoPlayer(9964f76987afc9074e254b45411c0594, 17111310, 275, 156);
I have create a clip objet, put it on my timeline, give the name : player. And on a picture in my timeline I have put this code :
import Document;
var player:VimeoPlayer = new VimeoPlayer("API Customer ID", Video ID, Width, Height);
this.addChild(player);

It is doesn't work. I have nothing : message error=
1084: Erreur de syntaxe : rightparen est attendu devant ID.

Can you give me the process ? thank you !

Ryan Hefner

Ryan Hefner Staff

Hey TV-iConcept,

Once you have updated the Document.as file with your oauth key, clip_id, width and height, all you need to do is create a FLA and set the Document Class to Document.as. That should be it.

Let us know if you run into any issues once you have created the new FLA that you can work with in your version of Flash.

Thanks,
Ryan

TV-iConcept

TV-iConcept Plus

Hello Ryan,
Thank's for your response. But, sorry, it doesn't work. I think I make a syntax error.

I have create a .FLA document to test with just one picture witch have this code :

import Document;
var player:VimeoPlayer = new VimeoPlayer("API Customer ID"," Video ID", "Width", "Height");
this.addChild(player);

I 've set the document class to :

Document

I've create a document .as with : "Document.as" as name
And I've put this lines in the .as :

package
{
import flash.display.MovieClip;
import flash.system.Security;

public class Document extends MovieClip
{
private var player : VimeoPlayer;

public function Document() : void
{
Security.allowDomain('*');

stage.align = 'TL';
stage.scaleMode = 'noScale';

player = new VimeoPlayer("9964f76987afc9074e254b45411c0594", "17111310", "275", "156");
this.addChild(player);

player.x = 0;
player.y = 0;
}
}
}

When I test I have this error message :

Document.as, line 8; 1151 Conflit dans la définition player dans l'espace de nom internal

What is the meaning ? Whre is my mistake ?
Thank's

Ryan Hefner

Ryan Hefner Staff

Hey TV-iConcept,

Assuming that you are using the files from the ZIP file, all you should need to do is create a FLA and set the Document Class (or Class in the Public settings) to Document. Also make sure that your FLA is set to use AS3 and Flash Player 10 for your publish settings as well.

Without being able to see the directory structure, or the files that you are using, it's hard to really troubleshoot this. Let me know if you run into any issues with the embed once you are able to work through the bugs that you are having now.

Thanks,
Ryan

Simon Macreedy

Simon Macreedy

Hello,
I would like to embed the Vimeo player to my flash web site.
I have looked at the files and documentation on this site, as well as several blog posts.
The problem is no page/discussion/video seems to be able to accurately describe what exactly the procedure is for having a Vimeo player pop up on a flash website.

My idea was:
To have a button that when selected would trigger and embedded one of my Vimeo videos.

Question: Is this possible?

Question: Are there any videos that explain how to use Mogaloop in flash?

I have downloaded several .as files from here vimeo.com/api/docs/moogaloop but there seems to be no information on what exactly I am supposed to do with them.

Ryan Hefner

Ryan Hefner Staff

Hey Simon,

You should be able to use the VimeoPlayer.as class as is and just include that in your project. Make sure that the VimeoPlayer.as file is in the same directory as your FLA so that Flash can find it when publishing. Or, place it in it's own vimeo directory (note you'll have to update the namespace and library paths if you want to reference the file in another directory).

To help, here is a ZIP file that contains a very basic example that should help you out:

dev.ryanhefner.com/moogaloop/vimeo_flash_embed/vimeo_moogaloop_flash_api_example.zip

Please let us know if you run into any issues.

Thanks,
Ryan

Simon Macreedy

Simon Macreedy

Hey I tried that but I got an error

"1084 syntax error : expecting rightbracket before OAUTH."

What does this mean?

Upsidown World

Upsidown World Plus

i'm getting this error

TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@47ac4821 to VimeoPlayer.

at flash.display::MovieClip/gotoAndStop()
at chris/clickSection()

Upsidown World

Upsidown World Plus

ok... i got it! but now i can't get the movie clip to go away when i go to other pages in my site

any help would be greatly appreciated!

Ryan Hefner

Ryan Hefner Staff

Hey Upsidown World,

Are you removing the VimeoPlayer object from the stage when you go to another page?

Thanks,
Ryan

Upsidown World

Upsidown World Plus

i guess that's what i'm missing. i'm pretty green in flash how do tell flash to remove an object?

Upsidown World

Upsidown World Plus

i get get the video to go away but the audio is still playing in the background...

i tried this... so that when i click home it goes to home and removes the child object... but i still get audio

home.addEventListener(MouseEvent.CLICK, hidevimeo);

function hidevimeo(event:MouseEvent) {
removeChild(player);}

Upsidown World

Upsidown World Plus

ok so i added this...

var sTransform:SoundTransform = new SoundTransform(1,0);
sTransform.volume = 0;
SoundMixer.soundTransform = sTransform;

now everything goes away but it won't come back when i go to the reel again!! i'm starting to think this is the wrong direction...

Simon Macreedy

Simon Macreedy

Can someone please help me?
Do I have to upload the files to my website for it to work or can I test it on my desktop?
The video just does not load for me are there any video demos explaining how to do this?

radley

radley

@Simon - it appears that some part of Vimeo's AS3-embed player is hosted on a development server (trunk.ryan.vimeows.com) which is down at the moment.

Give it a few...

Simon Macreedy

Simon Macreedy

Thanks Radley, can you explain how I am supposed to use Ryan's basic example am I supposed to upload it to my server as is?

Ryan Hefner

Ryan Hefner Staff

Hey Simon,

This should be fixed now. Let me know if you run into any issues. Also, did you participate in the beta when we were rolling out our new Flash Player back in August or so? Just curious.

Thanks,
Ryan

radley

radley

@Simon To use his example, just open the example in Flash CS#, change the properties in Documents.as, and publish.

Simon Macreedy

Simon Macreedy

@Radley thanks I tried that but I got a compile error in flash it says..

"1084 syntax error : expecting rightbracket before.." followed but a long sequence of letters and numbers.

Simon Macreedy

Simon Macreedy

Hello Ryan, I did not take part in Augusts Beta, do I need to be a plus member for this to work?

Here is the code we used in the document.as

package
{
import flash.display.MovieClip;
import flash.system.Security;

public class Document extends MovieClip
{
private var player : VimeoPlayer;

public function Document() : void
{
Security.allowDomain('*');

stage.align = 'TL';
stage.scaleMode = 'noScale';

player = new VimeoPlayer("key", "clip ID", 400, 300);
this.addChild(player);

player.x = 0;
player.y = 0;
}
}
}

Basically once I edited that .as code above (in Dreamweaver) I then publish the FLA project in Flash ACS3 and I get the compile 1084 error am I supposed to edit the Document.as in Flash or Dreamweaver??

I keep getting this error:

Error

/vimeo_moogaloop_flash_api_example/Document.as, Line 17 1084: Syntax error: expecting rightparen before... "Consumer Key".

Ryan Hefner

Ryan Hefner Staff

Hey Simon,

It shouldn't matter which editor you use. Although, just to be safe, I would probably recommend Flash or TextMate to edit the AS files. Looking at the code, everything seems to be right. Although, clip_id should be a Number, not String, but that wouldn't throw the error that you are receiving.

I think you'll just have to go through the code and make sure that everything is right. The example should work fine once you update the key, clip_id, width and height, but let me know if you continue to run into issues with it. If so, I would recommend that you pull down the ZIP file again and try editing it in Flash maybe.

Hope this helps,
Ryan

Simon Macreedy

Simon Macreedy

Hello Ryan,

Thanks for the advice, perhaps I need to fill out the info in my application correctly?

Can someone please tell me what I need to write here?

Application Callback URL: ?

And

Application URL:?

TNGNT

TNGNT

Hi everyone!
I also need help with this.

I'm using the code as posted before.
I'm saving the Document.as (with my data) in the same directory as the .fla as well as VimeoPlayer.as

I have tried it both online and locally, but nothing happens.
I get no errors, but no player either. Just a blank page.
I'm using this code to call the video on the frame it's supposed to be located (with my own values inserted):

import VimeoPlayer;
var player:VimeoPlayer = new VimeoPlayer("API Customer ID", Video ID, Width, Height);
this.addChild(player)

Why doesn't the player appear?...
Thanks!

DIAMOND GRINDER

DIAMOND GRINDER

Hello Ryan -

I am so close with this (I think), but I keep getting the Vimeo "Sorry there was a problem loading..." message.

Any ideas?

Jacob Andrén

Jacob Andrén

Hello Ryan,

I´m developing a flash site with Moogaloop in it.
As far as I understand I will need a Consumer Key.
Can I test my application locally without a the Consumer Key? Because a don´t no the final url for the application.

Thank's

Brad Dougherty

Brad Dougherty Staff

Hi Jacob,

You can just fill in a temporary URL for now, and then update it when you know the final one.

Michael Bird

Michael Bird Plus

As I test, I get the 1084 Syntax error: expecting rightparen before f466b.... " Weird thing is that as it restates my consumer code, it starts two characters in ("VimeoPlayer(28f466b9...."). Is there a problem with my consumer code?

Brad Dougherty

Brad Dougherty Staff

Make sure you wrap the consumer key in quotes since it's a string.

Michael Bird

Michael Bird Plus

Thanks Brad. Now getting 1083: Syntax error: package is unexpected." when I re-run it. Am beginning to think I'm too novice to be attempting this.

carlos ceia

carlos ceia

How do you remove a instance of the vimeoPlayer? do you have any documentation on the public methods of moogaloop? whenever i remove a video playing, it will keep on playing (i can hear the sound).

is there a public method to close the netstream?

Michael Bird

Michael Bird Plus

I haven't got mine to spawn on my swf yet, but I took note of Upsidown World's post above because they seem to have gotten it. I have a regular mp4 stream on my site currently that had the same issue and I suspect I'll be back looking at Upsidown World's code when I get this up and running.

Alex Judd

Alex Judd

Hi everyone - OK there seem to be two points in this post that are confusing everyone (took a bit of time to get what everyone was on about) so here they are for Clarity.

1. Demo zip file from Ryan

The .fla source file is Adobe CS5 so will not open if you have an earlier version such as CS3 or CS4

2. Why does the demo zip file FLA have nothing on the timeline?

The demo FLA is simply there to read the two .as files that are in the same directory, namely the Document.as which makes an instance of the player and the VimeoPlayer.as which contains all the functions.

3. So how the hell does my FLA file know to talk to these .AS files?

That's the clever bit - if you change the Document class of the FLA file to the name of the .AS file that you want it to inherit, then it reads it automatically.

4. OK that bit above makes some sense but how do I do that?

In Flash, open the existing FLA, or make your own Actionscript 3.0 FLA file, and click File -> Publish Settings -> Flash Tab -> ActionScript version and then the Settings button

You can now see the Document class (field at the top) for the FLA and you want to enter hear the name of the Class file you want it to use.

In Ryan's demo case this is 'Document' but for my own example I created a file called Demo.as, so mine was 'Demo'

Publish your FLA and you will now see that it starts throwing some output into the Output window. If you want to really check add a

trace('testing');

line or similar to the Document.as file after the

public function Document(): void
{

lines and you will see this gets printed out too so we are really cooking here.

Hope that helps!!

Alex

Kevin Nield

Kevin Nield

Hey there,
Thanks for clarifying. I still get nothing even after adding 'trace('testing'); after
public function...
A lot of people have asked, but I can't seem to find any reply--do you have to have this simple example uploded to the web for it to work? I've been coming back to this forum for a couple of weeks. I don't want to try more complicated solutions until I can actually see the simple one work and it never does.
Thanks,
Nivek

Benjamin Prince

Benjamin Prince

I am having a little trouble getting the api up and running too...my problem appears to be the security sandbox.

This is what I'm getting in my debugger:

Warning: Ignoring invalid tag for domain 'none' in policy file at vimeo.com/crossdomain.xml

*** Security Sandbox Violation ***
SecurityDomain 'api.vimeo.com/moogaloop_api.swf?oauth_key=[key]&clip_id=[id]&width=942&height=530&fullscreen=0&fp_version=10'; tried to access incompatible context 'localhost/ATOM0001_HomepageFlash/';

Does this have something to do with the fact I'm testing it on my local server? Do I need to upload my files to the server they will eventually be running off of?

Any help/ideas are appreciated.

Thanks.

beshart

beshart Plus

Thx Jovica. tried it, but now I get
Infinity
Error #2044: Unhandled IOErrorEvent:. text=Error #2124: Loaded file is an unknown type.
;-((

Jovica Aleksic

Jovica Aleksic

Hi beshart.
Is this error thrown by the Loader instance? If so, do you have http:// in front of the url? (before api.vimeo.com/moogaloo_api.swf, that is)
Could you post the code where you use the Loader class to load the swf?

beshart

beshart Plus

Hi Jovica.

If I drop the http, I don't get the 'infinity'-mention, but the error remains. My code:

function startIntro():void
{
Security.allowDomain("api.vimeo.com");
var intro_loader:Loader = new Loader();
var intro_request = new URLRequest("api.vimeo.com/moogaloo_api.swf?clip_id="; + intro_clip_id + "&server=vimeo.com" + "&width=" + intro_width + "&height=" + intro_height + "&show_title=0&autoplay=1&show_byline=0&show_portrait=0&color=ffffff&fullscreen=1");
intro_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler_intro);
intro_loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler_intro);
intro_loader.load(intro_request);
}

Jovica Aleksic

Jovica Aleksic

well, i'm not sure I can follow, but you should definitely be loading WITH the http:// in front, it's the forum that drops it when you type a full url here..

Also, I never used the &server param, maybe that's something you should drop..

This is what I use:

[...]

// remember that the next url does start with "";, but this forum doesn't show it!
public static const MOOGALOOP_URL:String = "api.vimeo.com/moogaloop_api.swf";;
[...]
url = MOOGALOOP_URL + "?fp_version=9&oauth_key="+VimeoAuth.CONSUMER_KEY+"&clip_id="+clip_id + "&width=" + w + "&height=" + h + "&fullscreen=1" + (loaderParams.queryParams ? '&'+loaderParams.queryParams : '');

loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, handleLoadingError, false, 0, true);
loader.load(new URLRequest(url));
[...]

I am pretty sure you don't need the oauth_key, but you could register your app with vimeo and have a key too. (I shied away from doing it long time myself, but it was actually very simple, and now I simply use the key. One day it might become mandatory anyway so it's best to use it)

Kyle Levitan

Kyle Levitan

Ryan,

Thank you for you patience and helping us all embed Vimeo videos. I'm fairly new to AS3, but I was able to properly embed mine, however, I am trying to load a swf that contains my video within a previously loaded swf . I am having a problem with the initial swf because of:

Debugger: "TypeError:Error #1009:Cannon access a property or method of a null object reference. at Document()"

Flash Output: Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.

I believe it has to deal with the fact I can't add a var loader within the video swf so that the initial swf can listen for a MouseEvent.CLICK possibly because of the "Document" class.

I'm having a hard time explaining this also because most of my success and failures have been a result of trial and error. I apologize for any confusion. I would really appreciate your suggestions.

Thank you,
Kyle

Kousoulides

Kousoulides

Stop bothering. Embeding Vimeo into Flash is DEAD.
IT worked a month ago. Now it's dead. I cannot find a page that has VIMEO into Flash.

Either VIMEO stopped supporting FLASH AS3 or they changed the CODES...

Either way.. IT SUCKS. :(

Kousoulides

Kousoulides

Embeding in AS3 via VIMEO is DEAD.

Please FIX it.

All sites I know that Have embeded VIMEO in Flash are DEAD

DEAAAAAAAD!
:)
Fix it.

Brad Dougherty

Brad Dougherty Staff

We've added new stuff, but the old stuff should still work. Do you have an example that we can look at?

BananaFingers

BananaFingers

Ive basically got this going in my site now but the player wont go away when i go to a different frame. Does anybody have any idea how to make the player and sound dissapear when you leave the frame?

Please Help, this is doing my head in.

Ryan Hefner

Ryan Hefner Staff

Hey BananaFingers,

It sounds like you are looking to remove the player from the stage. You can do the following:

[insert name of player object].destroy();
this.removeChild([insert name of player object]);

You'll have to set that up in whatever function is initiating the advancement of the timeline.

NOTE: You'll have to create a new player object if you want to display video again later in your project timeline.

Please let us know if you run into any issues destroying the player object.

Thanks,
Ryan

BananaFingers

BananaFingers

Hi Ryan,

Thanks for the reply, i tried that code on the frame that you go to after the video page but it didnt work for some reason. Instead i used:

removeChild(player);
SoundMixer.stopAll();

This seems to work but the output box is throwing out the following errors:

TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/removeChild()
at VimeoInSiteTest3_fla::content_1/frame1()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at VimeoPlayer/mouseMove()

Im not sure what these mean or how to stop them, can you shed any light on it?

Cheers,

Tom.

Ryan Hefner

Ryan Hefner Staff

Hey Tom,

I am not sure which version of the VimeoPlayer class you are using, but I would highly recommend that you pull down our Player API project from GitHub and use the version within that repo for your project.

Here's the link to the VimeoPlayer.as file in the repo:

github.com/vimeo/player-api/blob/master/actionscript/src/com/vimeo/api/VimeoPlayer.as

Within that version of the VimeoPlayer class, there is a "destroy" method that should resolve the issues you are having. Please let us know if that's not the case.

Thanks,
Ryan

BananaFingers

BananaFingers

Hi Ryan,

Ive changed over to the new VimeoPlayer.as file you directed me to, i havent put any code in for destroying it yet because i just wanted to see if it would load ok. Now i am getting a compiler error on line 1 of the new VimeoPlayer.as file -

5001: The name of package 'com.vimeo.api' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file.

Any ideas about this, it just feels like ive taken a step backwards.

Thank you in advance,

Tom.

Ryan Hefner

Ryan Hefner Staff

Hey Tom,

You need to have that class within a folder structure like the following:

com/vimeo/api/VimeoPlayer.as

Either that, or just remove the com.vimeo.api from the top of the VimeoPlayer class where the package is defined. Although, I recommend using proper folder structure when organizing your classes.

Please let me know if you run into any issues once you have the file location resolved.

Thanks,
Ryan

BananaFingers

BananaFingers

Hi Ryan,

Thanks for trying to help me out with this, im pretty new to as3 and its all been a bit trial and error. I have now got to a point where the test site looks like it is working as it should and seems to run fine but im still getting errors in the output box:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at VimeoInSiteTest5_fla::content_1/frame1()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at VimeoInSiteTest5_fla::content_1/frame3()
at flash.display::MovieClip/gotoAndStop()
at VimeoInSiteTest5_fla::MainTimeline/mouseDownHandler2()

and many more TypeError: Error #1009's very similar to these triggered when i click on a button to go to a different frame.

Ive just made a very basic site to test this in, are these errors something to do with the script ive got in the other movieclips?

Sorry to keep hassling you about this, it feels like im getting close.

Cheers,

Tom.

BananaFingers

BananaFingers

Hi again Ryan,

Also just found that these errors only start appearing when i have used the code:

player.destroy();
this.removeChild(player);

i have used this code on the other frames which appear on the same timeline as the frame which calls Document to play vimeo.

Cheers,

Tom.

Walter Zenga

Walter Zenga

@ Ryan

CS5?? yeah, must be latest shit, ... Have to buy it the next days because I want to deal with moogaloop api example
I'm really mad about this. There was another guy who asked why he couldnt open the fucking file - you declared that its based on fucking oop. All the whacky attempts of a documentation are heavy frustrating. What a hairy piss.
I will tell my clients to löoad their stuff on youtube. This vimeo crab sucks

Walter Zenga

Walter Zenga

tried 2 days to embed this moogaloop crab - without any success. Now I tested a youtube template and I got it in 5 minutes.

Ryan Hefner

Ryan Hefner Staff

Hey Walter,

Sorry you are experiencing issues. There is really nothing in the FLA that you need. Except having to declare the Document Class. I have also included the ANT scripts that allow you to use the FlexSDK for compiling in TextMate or Eclipse.

Sorry you're having so many issues with the example. I can post up a CS4 version of the FLA, but if you need to know how to apply a document class to your FLA, then I don't think that's going to help you out all that much.

Was there a specific area that was making this difficult? Please let us know and hopefully we can help you out.

Thanks,
Ryan

Ryan Hefner

Ryan Hefner Staff

Hey Walter,

One more thing. You will need to specify add the Source Path in the FLA as well. Other than that, everything is based on the classes in the project.

Please let us know if you run into more issues.

Thanks,
Ryan

Razvan Gradinaru

Razvan Gradinaru

I am using a free flash component that i include in my flash project to embed vimeo videos. it even lets me add more videos and make like a playlist. It's a lot easier this way. It was to tricky for me to do it in as3 myself. You can get it here: flashxml.net/youtube-vimeo-player.html

BRAU Perez Marti

BRAU Perez Marti Plus

Hi, (sorry my english, i am from argentina) i´ve read all your comments, and i am still having troubles to get this done.

Please Ryan, as i see you helped others checking out their URL, if you can check my testing at martireel.com.ar/vimeo/vimeo1.html

I will be thankfull.

Ryan Hefner

Ryan Hefner Staff

Hey Braulio,

I just checked out your example. It looks like the request is being made for our player. Are you sure you are adding the movieclip you're loading it into to the Stage?

Also, if you are using the VimeoPlayer class, we apply a mask around the player. So if you are moving the moogaloop object and not the mask, you could be running into issues there.

Let me know if this solves the issue for you. Hopefully it's something simple.

Thanks,
Ryan

Gary Stasiuk

Gary Stasiuk

Even though this is now 25 days old now, I am building a site and the player loads fine. I may suggest adding a container Sprite and have the player load into that container. That way the mask over the player is always correct and then you can tween the container via alpha or scale or location. A good rule of thumb is to leave a working asset alone and add addition interactive elements to a parent container.

Fercho Salazar

Fercho Salazar

hello Ryan

output in flash cs5:

Error opening URL 'trunk.ryan.vimeows.com/crossdomain.xml';
Error opening URL 'trunk.ryan.vimeows.com/moogaloop/crossdomain.xml';
Error opening URL 'trunk.ryan.vimeows.com/moogaloop_api.swf?server=trunk.ryan.vimeows.com&fp_version=10&oauth_key=e2fceba8b01b5c2ac91ada16********&clip_id=25332164&width=400&height=300&fullscreen=0';
Error #2044: IOErrorEvent no controlado: text=Error #2035: No se encuentra la dirección URL.

why??

I'm using. fla as:

import VimeoPlayer;
var player:VimeoPlayer = new VimeoPlayer("e2fceba8b01b5c2ac91ada16********", 25332164, 408, 219);
this.addChild(player)

and VimeoPlayer.as : github.com/vimeo/player-api/blob/master/actionscript/src/com/vimeo/api/VimeoPlayer.as

regards!

Ryan Hefner

Ryan Hefner Staff

Hey Fercho,

That's really weird. It looks like it's attempting to make a request to the wrong server. Could you please confirm that you have the latest VimeoPlayer.as file from GitHub. Actually, if you could make sure that you have downloaded the entire project and test with that, that would be awesome.

Hopefully refreshing your files should do the trick. If not, let us know and we'll see what we can do.

Thanks,
Ryan

Ryan Hefner

Ryan Hefner Staff

Hey Fercho,

No, our player uses AS3 exclusively, so there's no way to use it within an AS2 project. Hopefully you're able to get it working with the updated class.

Please let us know if you run into any other issues with the example, player or API.

Thanks,
Ryan

Rumbling Skies

Rumbling Skies

Hi Ryan,

Thanks for the great support you're providing here. Also great you're providing source code instead of crappy compiled, blackbox solutions!

I'm wondering if it's possible to directly load the video stream. So I'm not looking to load the Moogaloop player, but use my own videoplayer, which simply creates a NetStream and NetConnection instance and loads that video.

Thing is that I want to use the video as a full screen background video, so there shouldn't be any videocontrols there.

Cheers,
Erik

Brad Dougherty

Brad Dougherty Staff

Hi Erik,

Sorry, but you'll have to use our player to play Vimeo videos. We do not support using third-party players.

Alan Burns

Alan Burns

Please help! I have been following all of this thread and I still cant get it to work. One person had the same problem as me but they didn't get a reply.

I have updated the Document.as file with my oauth_key, clip_id, width and height, saved it then I have entered the action script on frame 1.

var vimeo_player = new VimeoPlayer([YOUR_APPLICATIONS_CONSUMER_KEY], 2, 400, 300);
vimeo_player.addEventListener(Event.COMPLETE, vimeoPlayerLoaded);
addChild(vimeo_player);

I obviously updated all the relevant info in the action script, the .as files are saved in the same folder as my .fla but when I run it I just get a blank screen, no errors just a blank screen. I have published it and tested it but both have the same result. I haven't put it on a server yet.

Please help, I have carefully read through this entire thread and followed instructions exactly but still just a blank screen. Help would be greatly appreciated.

Ryan Hefner

Ryan Hefner Staff

Hey Alan,

The Document.as file is meant to be set as the Document Class in your FLA, not referenced on Frame 1. You can set this in the ActionScript settings for your FLA.

Please let us know if you need any help getting this setup, or if this resolves your issue.

Thanks,
Ryan

Andrew Smart

Andrew Smart Plus

Hi

Anyone got any ideas here... I'd like to embed my vimeo video inside a PDF, which can't be done BUT I found that if I use the embed vimeo inside flash > export as a SWF > import that into the PDF it kind of works. The probelm being that when you click to watch the video inside the PDF Adobe Acrobat asks if it is safe to access the vimeo URL, you click on 'accept' but you have to click on accept several times before the video plays. Any ideas on overriding this in Acrobat?

James Powers

James Powers Plus

Why is all of this so complicated?

Anyone know of a simple tutorial on how to embed Vimeo videos onto a flash based website?

Ryan Hefner

Ryan Hefner Staff

Hey James,

What issue are you running into? Do you have experience using classes in Flash? Let us know and hopefully we can get you up and running with it.

Thanks,
Ryan

Andrzej Kozioł

Andrzej Kozioł

Why embeding vimeo i so difficult. Why nobody can't write isntruction step by step. I built my flash website by myself, i embeded YOUTUBE in 5 minutes, but VIMEO... I spend 3 hours and nothing.

Boguz

Boguz

i am having the same problem.
I have searched everywhere who to do it. It seems to me that there is some information, but it's not simple to follow for an unexperienced user like me.
Any chance someone could help?

I have a page where the main content are 4 Video (the same here in my Vimeo account about the 4 Elements).
I would like to embed a video in each page of the website (which is 100% in flash CS5 AS3), but i don't understand how to do it...

Any help would be GREATLY appreciated! =)

VideoSpectra

VideoSpectra Plus

I want to include a vimeo video in my flash website...I have downloaded the VimeoPlayer.as and Documents.as. But Not able to understand how do I use them in my flash file....All of the links which are mentioned above as example file are not working. could anyone help me with sample file with similar kind of project... Its kind of urgent

Thanks in advance.

Fahim Akhter

Fahim Akhter

Hey ryan,

The embedded video is loaded perfectly fine and it seems to work as soon as I press play I get a couple of seconds of video. And then everything goes black. The progress event stops firing too. Any ideas on that?

and the same code seems to be working when I do it in flash builder but not from flash. From flash I always see the player. I click and it disappear never an error though this is the output :

readyHandler
[1370951681.5] LivePass: Initializing Conviva LivePass version 2.64.0.68610
playHandler

Gonnei Studio

Gonnei Studio

hello I need help,
I want to create a flash video gallery that plays embedded vimeo files. With some help on the Vimeo forums I have all but completed this with one small hurdle I have yet to overcome.

My problem is that when I click on a button to play a different video, the previous video does not unload and the audio will continue to play over the newly clicked video. I need to be able to unload the previous video upon loading the one in which the corresponding button is clicked. I hope that makes sense.

Gonnei Studio

Gonnei Studio

as3 attached my code, I have two buttons on the scene, everything works pretty much explained above

Gonnei Studio

Gonnei Studio

import flash.system.Security;
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.events.MouseEvent;
var moogaloop:Sprite = new Sprite(); // the video player
var player_width:int=800;
var player_height:int=385;
button01.addEventListener(MouseEvent.CLICK, onBtn01Clicked);
button02.addEventListener(MouseEvent.CLICK, onBtn02Clicked);
function onBtn01Clicked(event:MouseEvent):void {
startLoad('73188398');
}
function onBtn02Clicked(event:MouseEvent):void {
startLoad('73295674');
}
function startLoad(clip_id:String):void
{

Gonnei Studio

Gonnei Studio

Security.allowDomain("bitcast.vimeo.com");
Security.loadPolicyFile("vimeo.com/moogaloop/crossdomain.xml";);
var v_loader:Loader = new Loader();
var v_request:URLRequest = new URLRequest("api.vimeo.com/moogaloop_api.swf?clip_id="; + clip_id + "&server=vimeo.com" + "&width=" + player_width + "&height=" + player_height + "&show_title=0&show_byline=0&show_portrait=0&color=ffffff&fullscreen=1");
v_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
v_loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
v_loader.load(v_request);
}
function onCompleteHandler(e:Event):void
{
// Position the player where you want it
moogaloop.x = 245;
moogaloop.y = 125;
moogaloop.addChild(e.currentTarget.content);

Gonnei Studio

Gonnei Studio

// Create the mask for moogaloop
var v_mask:Sprite = new Sprite();
with( v_mask.graphics ) {
beginFill(0x000000, 1);
drawRect(moogaloop.x, moogaloop.y, player_width, player_height);
endFill();
}

addChild(v_mask);
moogaloop.mask = v_mask;

addChild(moogaloop);
}
function onProgressHandler(e:ProgressEvent):void
{
var percent:Number = e.bytesLoaded / e.bytesTotal;
trace(percent);
}

This conversation is missing your voice. Please join Vimeo or log in.