0
我使用Eclipse Helios使用MXML文件构建Flash。我目前在我的flash中显示一个视频。我想要的是,当我双击视频时,事件有发生,但不幸的是我不能让我的网络page.Here上的视频双击事件是我的MXML代码:无法双击Flash中的视频
<?xml version="1.0"?>
<!-- Publish Stream mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="Initialize();"
layout="absolute" paddingLeft="0" paddingTop="0" paddingBottom="0"
paddingRight="0" >
<!-- Script for PublishStream -->
<mx:UIComponent id="uiComp" visible="true" doubleClickEnabled="true" mouseEnabled="true"/>
<mx:Script source="test.as"></mx:Script>
</mx:Application>
这里是我的文件代码:
import mx.controls.Alert;
import flash.net.NetStream;
import flash.net.NetConnection;
private var _video : Video;
private var _serverName : String;
private var _connection : NetConnection;
private var _stream : NetStream;
public function Initialize():void
{
_connection = new NetConnection();
_connection.client = { onBWDone: function():void{ /*Alert.show('onBWDone', 'Alert Box', mx.controls.Alert.OK); */} };
_connection.objectEncoding = flash.net.ObjectEncoding.AMF0;
_connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
_connection.connect("server");
Alert.show("Initialise", 'Alert Box', mx.controls.Alert.OK);
}
//Status event handler
public function netStatusHandler(event:NetStatusEvent):void
{
Alert.show("hanlder", 'Alert Box', mx.controls.Alert.OK);
_stream = new NetStream(_connection);
_video = new Video();
_video.doubleClickEnabled = true;
_video.addEventListener(MouseEvent.DOUBLE_CLICK, doubleClickHandler);
_video.attachNetStream(_stream);
_stream.play("FlickAnimation.flv");
uiComp.addChild(_video);
}
private function doubleClickHandler(event:MouseEvent):void
{
Alert.show("Double Clicked", 'Alert Box', mx.controls.Alert.OK);
}
请告诉我为什么我没有获得双击视频,或者有任何其他方式来解决问题。任何帮助将appre ciated。
是的你是对的,我将视频添加到组件然后添加到该容器的双击事件,它的工作方式像魅力。感谢您的帮助。 – 2012-07-30 08:46:58