AboutFlex.net

flex,air,flash …

This example shows you how to change the cursor using an image, in this case a png;

This movie requires Flash Player 9

the application:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="500" height="300" viewSourceURL="srcview/index.html">
	<mx:Script>
		<![CDATA[
			import mx.managers.CursorManager;

			[Embed(source="assets/cursor1.png")]
            [Bindable]
			public var Cursor1:Class;      

			[Embed(source="assets/cursor2.png")]
            [Bindable]
			public var Cursor2:Class;      

			[Embed(source="assets/cursor3.png")]
            [Bindable]
			public var Cursor3:Class;      

			[Embed(source="assets/cursor4.png")]
            [Bindable]
			public var Cursor4:Class;      

			[Embed(source="assets/cursor5.png")]
            [Bindable]
			public var Cursor5:Class;      

			private function changeCursor(e:MouseEvent):void{
				CursorManager.setCursor(e.currentTarget.source);
			}
			private function restoreCursor(e:MouseEvent):void{
				CursorManager.removeAllCursors();
			}		     

		]]>
	</mx:Script>

	<mx:Image mouseOver="{changeCursor(event)}" mouseOut="{restoreCursor(event)}" x="314" source="{Cursor1}" verticalCenter="5"/>
	<mx:Image mouseOver="{changeCursor(event)}" mouseOut="{restoreCursor(event)}"  x="274" source="{Cursor2}" verticalCenter="5"/>
	<mx:Image mouseOver="{changeCursor(event)}" mouseOut="{restoreCursor(event)}"  x="154" source="{Cursor3}" verticalCenter="5"/>
	<mx:Image mouseOver="{changeCursor(event)}" mouseOut="{restoreCursor(event)}"  x="234" source="{Cursor4}" verticalCenter="5"/>
	<mx:Image mouseOver="{changeCursor(event)}" mouseOut="{restoreCursor(event)}"  x="194" source="{Cursor5}" verticalCenter="5"/>

</mx:Application>

  1. programlama Said,

    css Cursor examples , Properties , Attribute - - http://css-lessons.ucoz.com/cursor-css-examples.htm

Add A Comment