开发者

YouTube video loaded into Flash MovieClip, can I get width and height?

I'm trying to load a YouTube video on a flash MovieClip using url http://www.youtube.com/v/4nRNoXT_gUc that returns the video with player directly.

开发者_开发问答

the video is loaded and i can manage it with his player, the problem is when i try to position it no the stage, because I don't know his width until it starts.

I've tested it with Event.ENTER_FRAME but when the video starts it return width = 10000 how can i do to know his width or height?


You can retrieve the movie's nominal width and height through the loader's contentLoaderInfo object. Just try the following :

trace(loader.contentLoaderInfo.width);

The nominal width and height of your movie is 640x480. You will notice, however, that the movie is being scaled down (probably by YouTube, would need to be confirmed).

Also, be aware that what is returned by YouTube is an AVM1Movie object. An AVM1Movie object is an SWF that was compiled under ActionScript 2 (in YouTube's case, most likely Flash version 8). The interaction that is possible with an AVM1Movie object is much more limited than that of a regular AS3-based swf file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜