onebyoneblog » Flash Player 10.2 With FlashDevelop (and a quick Cursor Manager)

# onebyoneblog

life, liberty, and the pursuit of actionscript

Devon O. Wolfgang

## Flash Player 10.2 With FlashDevelop (and a quick Cursor Manager)

For that large population of you out there using FlashDevelop for pure AS3 development, here’s a quick overview on how to start publishing to the beta version of Flash Player 10.2:

1. Install the beta player into the browser of your choice (i.e. Chrome).
2. Download the most recent build of the Flex SDK (4.5.0.18623 at the time of writing this) and unzip it to the location of your choice.
3. Now, because FlashDevelop currently only supports up to Flash Player 10.1, it will look for the playerglobal.swc in the path [FLEX SDK]/frameworks/libs/player/10.1. To get around this, simply copy the ’10.2′ directory, paste it in the same place and rename it ’10.1′. In other words, you should wind up with two directories located at [FLEX SDK]/frameworks/libs/player, ’10.1′ and ’10.2′, both containing the same playerglobal.swc file.
4. Now fire up FlashDevelop (3.3.2 is available, by the way, in case you may have missed it) and create a new AS3 Project in the directory of your choice.
5. Most likely you won’t want to use the beta Flex SDK for all your AS projects, so, rather than change the Flex SDK Location in the global program settings, open up the project settings dialog box. Be sure you’re targeting Flash Player 10.1 in the output panel then pop open the Compiler Options panel. In the Custom Path to Flex SDK box, browse to the new SDK you downloaded and saved. Finally, in the Additional Compiler Options box add the line ‘-swf-version=11′ (with no quotes). At this point you’re ready to roll with one last point to keep in mind.
6. You won’t be able to preview your 10.2 .swf files in an external player, pop up or new tab, so, rather than using the ‘Test Movie’ button to compile your output (as I, personally, most often do), you’ll have to just use the ‘Build Project’ button then preview the generated index.html file within the bin directory of your project directory within the browser in which you’ve installed with the 10.2 player.

Of course now you’ll probably want to play around with the new 10.2 player capabilities, so here’s a quick CursorManager test I put together to check out the new Native Cursor potential of the latest player.

This CursorManager.as file embeds a couple .png files – one with an open hand and one with a closed hand and registers the bitmap data of those two images as MouseCursorData.

    package ui.cursors {

    	import flash.display.BitmapData;
    	import flash.ui.Mouse;
    	import flash.ui.MouseCursor;
    	import flash.ui.MouseCursorData;

    	public class CursorManager {

    		public static const HAND_OPEN:String 		= "handOpen";
    		public static const HAND_CLOSED:String 		= "handClosed";
    		public static const AUTO:String			= MouseCursor.AUTO;

    		[Embed(source = 'assets/grab_closed.png')]	private static const CLOSED:Class;
    		[Embed(source = 'assets/grab_open.png')]	private static const OPEN:Class;

    		public function CursorManager() {
    			// do not instantiate -
    			// use static init() method
    		}

    		public static function init():void {
    			initCursors();
    		}

    		private static function initCursors():void {
    			var c1:Vector.<BitmapData> = new <BitmapData>[new OPEN().bitmapData];
    			var mcd1:MouseCursorData = new MouseCursorData();
    			mcd1.data = c1;
    			Mouse.registerCursor(HAND_OPEN, mcd1);

    			var c2:Vector.<BitmapData> = new <BitmapData>[new CLOSED().bitmapData];
    			var mcd2:MouseCursorData = new MouseCursorData();
    			mcd2.data = c2;
    			Mouse.registerCursor(HAND_CLOSED, mcd2);
    		}
    	}
    }

The Main.as file simply creates a draggable Sprite instance which changes cursor on mouse over and mouse down (to drag):

    package {

    	import flash.display.Sprite;
    	import flash.events.Event;
    	import flash.events.MouseEvent;
    	import flash.filters.DropShadowFilter;
    	import flash.ui.Mouse;
    	import ui.cursors.CursorManager;

    	/**
    	 * Quick example of implementing a Cursor Manager in Flash Player 10.2
    	 * @author Devon O.
    	 */

    	[SWF(width='640', height='480', backgroundColor='#666666', frameRate='31')]
    	public class Main extends Sprite {

    		private var _square:Sprite;

    		public function Main():void {
    			if (stage) init();
    			else addEventListener(Event.ADDED_TO_STAGE, init);
    		}

    		private function init(event:Event = null):void {
    			removeEventListener(Event.ADDED_TO_STAGE, init);

    			CursorManager.init();
    			initObject();
    		}

    		private function initObject():void {
    			_square = new Sprite();
    			_square.graphics.beginFill(0x006600);
    			_square.graphics.drawRect(0, 0, 150, 150);
    			_square.graphics.endFill();
    			_square.x = (stage.stageWidth - _square.width) >> 1;
    			_square.y = (stage.stageHeight - _square.height) >> 1;
    			_square.addEventListener(MouseEvent.ROLL_OVER, onOver);
    			_square.addEventListener(MouseEvent.ROLL_OUT, onOut);
    			_square.addEventListener(MouseEvent.MOUSE_DOWN, onDown);
    			_square.addEventListener(MouseEvent.MOUSE_UP, onUp);
    			_square.filters = [ new DropShadowFilter(2, 90, 0x000000, 1, 4, 4, 1, 3) ];
    			addChild(_square);
    		}

    		private function onDown(event:MouseEvent):void {
    			Mouse.cursor = CursorManager.HAND_CLOSED;
    			_square.startDrag();
    			stage.addEventListener(MouseEvent.MOUSE_UP, onStageUp);
    		}

    		private function onStageUp(event:MouseEvent):void {
    			stage.removeEventListener(MouseEvent.MOUSE_UP, onStageUp);
    			_square.stopDrag();
    		}

    		private function onUp(event:MouseEvent):void {
    			Mouse.cursor = CursorManager.HAND_OPEN;
    		}

    		private function onOver(event:MouseEvent):void {
    			Mouse.cursor = CursorManager.HAND_OPEN;
    		}

    		private function onOut(event:MouseEvent):void {
    			Mouse.cursor = CursorManager.AUTO;
    		}
    	}
    }

And compiled, that will give you the below (of course you’ll need Flash Player 10.2 installed to view it):

Hope that might help out. Now to play around with a little StageVideo action.

Published on December 4, 2010 12:53 pm.
Filed under: Actionscript, Flash

## 6 Comments »

1. Jeremy Daley says:
   December 4, 2010 at 10:27 pm

   good post man. you could also advise that someone set their flashdevelop “output options” tab: “Test Movie” field to “Open document…” and then just target “bin/index.html” … that is if they have their browser set to option html files by default.

2. Devon O. says:
   December 5, 2010 at 12:45 am

   Good point Jeremy. I thought about that after I wrote the post, but was too lazy to go back and edit it. I’m glad someone brought that up. :)

3. Philippe says:
   December 6, 2010 at 1:21 pm

   Great introduction.

   You can actually test & debug directly in FlashDevelop: the SDK includes all FP10.2 players – ActiveX, Plugin and Standalone which is used by FD.

4. Stepan says:
   January 10, 2011 at 4:28 am

   Hi. Just have played a bit with 10.2, set up the project to work with 10.2 playerglobal.swc and compiled Release Build. Then opened with 10.2 standalone debugger (explicitly found the exe from 4.5 SDK and opened). But the player tells keeps telling me “MouseCursorData not found”. Any ideas? Thanks.

   Stepan.

5. Devon O. says:
   January 10, 2011 at 5:49 am

   Hello Stepan. Have you tried running the .swf file in a browser with the 10.2 player installed?

6. Targeting Flash Player 10.2 with FlashDevelop 3 « jonathanasdf says:
   February 9, 2011 at 11:55 pm

   [...] figure out how to get FlashDevelop to compile to 10.2. A quick google shows that there was only a single post on how to achieve this, and it was a very crude workaround: what if I needed to juggle a couple of [...]

RSS feed for comments on this post. / TrackBack URI

## Leave a Reply

Click here to cancel reply.

Name (required)

Mail (will not be published) (required)

Website

## Devon O. Wolfgang

Technical Reviewer of “The Essential Guide to Flash CS4 AIR Development”

Contributing Author of “Flash AS3 for Interactive Agencies”

Senior Software Engineer at Meez

Starling Particle Editor

Published on March 21, 2010 12:56 am.
Filed under: Life

## Logical Or Assignment Bug in ASC2

So, here’s something to keep an eye on if switching to AIR 3.8[...]

Published on August 25, 2013 3:06 am.
Filed under: Actionscript, AIR Tags: ASC2.0

## Starling Filter Collection

Building up a collection of filters for the Starling framework[...]

Published on July 5, 2013 3:25 am.
Filed under: Actionscript Tags: agal, starling

## Warp Filter for Starling

Another filter for the Starling framework[...]

Published on May 26, 2013 2:56 am.
Filed under: Actionscript, Flash Tags: agal, starling

## Promises Promises

What it boils down to is handling asynchronous tasks [...] in a clean, intelligent fashion [...]

Published on March 18, 2013 2:16 am.
Filed under: Actionscript Tags: asynchronous

## Starling ‘God Ray’ Filter

While cruising the internet today looking for interesting things to try out I ran across this fun little GPU Gem[...]

Published on March 10, 2013 7:37 am.
Filed under: Actionscript

## Alpha in Starling Filters and Basic Branching in AGAL

In plain English to create a circular mask we would want to do something like this[...]

Published on December 9, 2012 4:11 am.
Filed under: Actionscript Tags: agal, starling

## Starling, Nape Physics, and PhysicsEditor

A look at using the PhysicsEditor tool for Nape and Starling [...]

Published on November 25, 2012 3:42 am.
Filed under: Actionscript

## Playing With a Couple Game Ideas

Just a couple game fragments, really[...]

Published on September 16, 2012 4:42 am.
Filed under: Actionscript, Flash, Games Tags: away3d, starling

## One More Filter For Starling

Another filter for the Starling framework[...]

Published on September 10, 2012 5:06 am.
Filed under: Actionscript, Flash, Games Tags: starling

## Filters in Starling

Using and writing filters in the Starling framework[...]

Published on September 8, 2012 8:26 am.
Filed under: Actionscript, Flash Tags: agal, starling

## Towards a Better Scratch

Perhaps it was too much Meat Beat Manifesto in the late 80′s [...]

Published on June 23, 2012 8:16 am.
Filed under: Actionscript, Flash

## Learning AGAL with AGALMacroAssembler and OpenGL Examples

So the other day I sat down and thought to myself: self, it’s high time you learn you some of this new fancy pants AGAL[...]

Published on June 3, 2012 6:57 am.
Filed under: Actionscript, Flash Tags: agal, agalmacroassembler, glsl, opengl, stage3d

## UV Scrolling in Starling

Obviously this could come in pretty darned handy for space games, side scrollers, etc, etc[...]

Published on May 7, 2012 7:37 am.
Filed under: Actionscript, Flash Tags: stage3d, starling

## Drawing on Stuff in Away3D 4.0

So, Easter Day, I thought I’d sit down and make a little ‘Paint on an Egg and Send it to Your Friend’ app.

Published on April 8, 2012 11:31 pm.
Filed under: Actionscript, Flash Tags: away3d

## Santabot: A Unity3D Flash Game

All right, so a Christmas game like “Santabot vs. The Flying Saucers from Mars” may be a day late[...]

Published on December 26, 2011 6:22 am.
Filed under: Actionscript

## Magnify – a jQuery Plugin

Let me begin by saying right up front, I have not given up on Flash[...]

Published on December 11, 2011 2:33 am.
Filed under: Actionscript Tags: javascript, jquery

1 2 3 4 5 6 … 11 »

- ## Category

  - Actionscript (92)
  - AIR (16)
  - Flash (87)
  - Games (3)
  - Liberty (13)
  - Life (52)

- ## Bitcoin Tip Jar

  Like this? Donate Bitcoin to Devon O. at:
  1Bu6PagwVm21gC5r8rPNNaVaAUS57TAf12

- ## Links

  - Actionsnippet
  - BOP Secrets
  - ByteArray.org
  - Flash Develop
  - Gaijin Design
  - Gnosis Archive
  - Jackson Dunstan
  - Just Another Rant
  - Last.fm
  - Nothingness
  - onebyone schwag!
  - onebyonedesign
  - Portfolio
  - Twitter
  - Wonderfl
  - Z Mag