在Flex / flash中嵌入Vimeo视频

时间:2008-10-23 05:48:39

标签: flex vimeo

是否可以在Flex中嵌入 Vimeo 视频?

当我尝试在<mx:SWFLoader/>中嵌入this link时,它不会出现任何内容。

1 个答案:

答案 0 :(得分:1)

我能做的最好的就是这个。使用Vimeo Api显示img并将img链接到视频。

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="black" >
<mx:Script>
<![CDATA[
    import flash.net.navigateToURL;
    import flash.net.URLRequest;


    private var xml:XML = new XML();
    private var loadXML:URLLoader = new URLLoader();

    private function carregar(string:String):void{
    //carregando XML adicionando o evento COMPLETE
    loadXML.load(new URLRequest("http://vimeo.com/api/clip/"+string+".xml"));
    loadXML.addEventListener(Event.COMPLETE, lista);
    }

    //função Listar
    private function lista(event:Event):void {
    xml = new XML(event.target.data);
    img.source = xml.clip.thumbnail_large;
    img.addEventListener(MouseEvent.CLICK, abrir);
    }

    private function abrir(event:MouseEvent):void{

        var req:String = "http://vimeo.com/moogaloop.swf?clip_id="+xml.clip.clip_id;
        var request:URLRequest = new URLRequest(req);
        navigateToURL(request,"_blank");
    }
]]>
</mx:Script>
<mx:TextInput x="209" y="55" width="182" id="codVimeo"/>
<mx:Button x="398" y="55" label="Carregar" click="carregar(codVimeo.text)"/>
<mx:Image x="113" y="94" width="361" height="318" id="img"/>
<mx:Label x="113" y="57" text="Código Vimeo:" color="#FFFFFF"/>
</mx:Application>