弗莱克斯' VideoDisplay 控件未打开流
我正在尝试使用 FlashDevelop 使 VideoDisplay
播放媒体。这是我的应用程序的来源:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.events.VideoEvent;
private function pause():void
{
if (moo_player.state == VideoEvent.PLAYING)
moo_player.pause(); else
if (moo_player.state == VideoEvent.PAUSED)
moo_player.play();
}
]]>
</mx:Script>
<mx:Panel>
<mx:VideoDisplay
source="bar.flv"
width="640"
height="480"
maintainAspectRatio="true"
id="moo_player"
autoPlay="true"
doubleClick="pause();"
doubleClickEnabled="true"
/>
</mx:Panel>
</mx:Application>
问题是当我构建应用程序并运行它时(不幸的是,不知道如何在没有 KMPlayer 或 Mozilla 的情况下运行它 - Flash Player 是一个插件据我所知)我没有视频。电影文件与应用程序的“Application.flv”位于同一目录中。但是,如果我重新加载应用程序(在播放器或浏览器中)几次,视频就会开始。
所以,这是我的问题:
VideoDisplay
有什么问题吗? 组件以及如何解决这个问题 ‘不玩’?有什么更好的方法吗 执行应用程序而不是运行 它在电影播放器或浏览器中?
PS:请不要因为我的知识匮乏而生气 - 我大约 30 分钟前开始使用 Flex。
I'm trying to make VideoDisplay
playing media with FlashDevelop. Here's the source of my application:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.events.VideoEvent;
private function pause():void
{
if (moo_player.state == VideoEvent.PLAYING)
moo_player.pause(); else
if (moo_player.state == VideoEvent.PAUSED)
moo_player.play();
}
]]>
</mx:Script>
<mx:Panel>
<mx:VideoDisplay
source="bar.flv"
width="640"
height="480"
maintainAspectRatio="true"
id="moo_player"
autoPlay="true"
doubleClick="pause();"
doubleClickEnabled="true"
/>
</mx:Panel>
</mx:Application>
The problem is when i build application and run it (unfortunately, got no idea how to run it without KMPlayer or Mozilla - Flash Player is a plugin afaik) i got no video. The movie file is in the same directory as application's "Application.flv" one. But if i reload application (within player or browser) a few times, video starts.
So, here are my questions:
what's wrong with
VideoDisplay
component and how to fix this
'non-playing'?what's the better way
to execute application than running
it within movie player or browser?
P.S.: please, do not get mad of my knowledge lacks - i began to use Flex nearly 30 minutes ago.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该使用 Spark 组件,而不是 MX 组件。试试这个:
You should be using Spark components, not MX components. Try this:
组件内部的视频显示存在一些问题。唯一在某些方面做得很差的柔性组件之一。请不要让它阻止您探索 Flex。
创建一个扩展它的自定义组件,使用以下代码创建一个名为 CustomVideoDisplay.as 的文件:
}
然后将其添加到您的根
标记中:对于您的视频组件,将其引用为:
如果这对您不起作用,请告诉我!
There's some issues with video display internally in the component. One of the only flex components that's kind of poorly done in some ways. Please don't let it discourage you from exploring Flex.
Create a custom component that extends it, create a file named CustomVideoDisplay.as with this code:
}
Then add this into your root
<application>
tag :And for your video component, refer to it as:
Let me know if this doesn't do the trick for you!
好吧,我想:我的播放器将在 Web 项目的客户端运行,并且在 FireFox 中,该代码每次运行七次都会成功运行。我认为这对于测试和实施来说已经足够了。
谢谢大家不辞辛苦!
Well, i thought: my player will be ran at client-side of web project, and in FireFox that code runs successfully each of seven runs. I think this would be enough for testing and implementation.
Thanks everyone for the trouble-taking!