I am using Eclipse Helios to build the flash using MXML file.I am currently displaying a video in my flash.What i want is that when i double click on the video then an event has to occur,but unfortunately i am unable to get the double click event of the video on my web page.Here is my mxml code:
<?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>
here is my as file code:
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);
}
Please tell me why i am not getting the double click of video ,or is there any other way to get the work around.Any help will be appreciated.
Your code shouldn’t compile to begin with. Video is not an interactive object and has no property with the name “doubleClickEnabled”. I.e. there is no way to handle any mouse or gesture events (not only double click) on video. What you want to do is to put some interactive object under or above the video so that it can handle clicks, or put video into a container, which is itself an interactive object.