アドビ
製品

トップ

  • Adobe Creative Cloud
  • Creative Cloudグループ版
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • SiteCatalyst

教育向け

  • 学生・教職員個人向け
  • 小・中・高等学校機関
  • 高等教育機関

Adobe Creative Cloud

  • Adobe Creative Cloudとは?

デザインと写真処理

  • Photoshop
  • Illustrator
  • InDesign
  • Adobe Muse
  • Lightroom
  • Elementsファミリー

ビデオ

  • Adobe Premiere Pro
  • After Effects

Web開発&HTML5

  • Edgeツール&サービス [新規ウィンドウで開く]
  • Dreamweaver
  • ゲーム [新規ウィンドウで開く]
  • モバイルアプリ

Adobe Marketing Cloud

  • Adobe Marketing Cloudとは?
  • 分析
  • Webエクスペリエンスマネジメント
  • 広告管理
  • テストとターゲティング
  • ソーシャルマーケティング

Analytics

  • SiteCatalyst
  • Adobe Discover
  • Insight

Target

  • Test&Target
  • Recommendations

Social

  • Adobe Social

Experience Manager

  • CQ
  • Scene7

Meida Manager

  • AdLens

ドキュメントサービス

  • Acrobat
  • FormsCentral [新規ウィンドウで開く]
  • SendNow [新規ウィンドウで開く]
  • Acrobat.com [新規ウィンドウで開く]

パブリッシング

  • Digital Publishing Suite

  • すべての製品を見る
ビジネスソリューション

Digital Media

  • Creative Cloudグループ版
  • ユーザー事例
  • Digital Media事例

ビジネスニーズ別

  • 分析
  • デジタルパブリッシング
  • ドキュメント管理
  • 広告管理
  • ソーシャルマーケティング
  • テストとターゲティング
  • ビデオ編集と公開
  • Web開発 [新規ウィンドウで開く]
  • Webエクスペリエンスマネジメント
  • すべてのビジネスニーズを見る

Digital Marketing

  • Adobe Marketing Cloud
  •  
  • Digital Marekting事例

業種別

  • 放送業界
  • 教育機関
  • 金融機関
  • 行政機関
  • 出版
  • 小売
  • 全業種を見る
サポートとラーニング

サポート

  • サポートホーム
  • サポートプログラム
  • 製品ヘルプ
  • ダウンロードとインストールヘルプ
  • Adobe Creative Cloud メンバーシップサポート
  • サポートお問い合わせ

ラーニング

  • ラーニングとチュートリアル
  • マーケター向けトレーニングサービス [新規ウィンドウで開く]
  • Photoshopマガジン
  • デザインマガジン
  • Focus In(ビデオ制作者向け)
  • Adobe Developer Connection
  • アトリエ(初心者向け写真編集)
  • Adobe Marketing Center
  • Adobe Marketing Cloud Japan Blog [新規ウィンドウで開く]
  • 認定制度
ダウンロード
  • 体験版
  • Adobe Flash Player
  • Adobe Reader
  • Adobe AIR
  • すべてのダウンロードを見る
会社情報
  • 採用情報
  • 投資家の皆様へ(英語)
  • プレスルーム
  • プライバシー
  • 企業の社会的責任(CSR)
  • ショーケース
  • お問い合わせ
  • その他の会社情報
ご購入
  • 個人・プロフェッショナル向け製品
  • 学生・教職員向け製品
  • 小中規模ビジネス向け製品
  • ライセンスについて
  • キャンペーン情報
  • Adobe Marketing Cloudお問合せ [新規ウィンドウで開く]
  • 販売パートナー
検索
 
情報 サインイン
サインインの目的 お客様のアカウントや体験版ダウンロード、製品の拡張機能、コミュニティエリアへのアクセスなどを管理するため
ようこそ、さん
My Adobe
注文状況
ユーザー情報
マイアカウント
製品およびサービスの登録状況
サインアウト
カート
プライバシー My Adobe
アドビ
製品 セクション 購入   検索  
ソリューション会社情報
サポートラーニング
サインイン サインアウト プライバシー My Adobe
先行予約の提供開始予定日Date. 商品が発送されるまで、クレジットカードには課金されません。提供開始の予定日は変更される場合があります。 先行予約の提供開始予定日Date. ダウンロードの準備が整うまで、クレジットカードには課金されません。提供開始の予定日は変更される場合があります。
個数:
(消費税を含む )
ご購入には学生・教職員個人版の購入資格の確認が必要です。
小計 (税込)
キャンペーン ( 税込)
送料( 税込)
消費税
Calculated at checkout
合計 ( 税込)
カートの中身を見る
Adobe Developer Connection [ADC] / Flash Player デベロッパーセンター /

Working with native mouse cursors in Flash Player 10.2

by Thibault Imbert

Thibault Imbert
  • Adobe
  • ByteArray.org

Content

  • Understanding native bitmap cursors
  • Implementing native mouse cursors
  • Native cursor demo
  • Where to go from here

Created

8 February 2011

ページ ツール

Facebookでシェア
Twitterでツイート
LinkedInでシェア
ブックマーク
印刷

この記事に設定されたタグ

ActionScriptcustomizationFlash PlayerFlash Professionalgamingmobile

必要条件

この記事に必要な予備知識

Prior experience working in the Flash Professional authoring environment is required. Basic familiarity with writing ActionScript 3 code is also recommended.

ユーザーレベル

中級

必要な製品

  • Flash Professional (Download trial)
  • Flash Player 10.2

The release of Adobe Flash Player 10.2 introduces a compelling new feature called native mouse cursors. You can now use bitmap-based mouse cursors that run at the OS level rather than inside the display list in Adobe Flash Player. In this article, you'll learn how to leverage this new capability using minimal coding.

Understanding native bitmap cursors

Since the introduction of Flash Player 5, developers have been able to use methods such as InteractiveObject.startDrag and Mouse.hide to customize the appearance of cursors in games and applications. However, the previous implementation had the following limitations:

  • Display object implementations of cursors are limited to the dimensions of the Stage. The custom cursor isn't fully visible when the user places their cursor near the borders of the Stage.
  • Display object cursors are very resource-intensive when rendered in Flash Player because the entire Stage must be re-rendered at a very high frame rate. The use of the updateAfterEvent method can lead to high CPU usage.
  • If the SWF file becomes frozen for a few milliseconds for any reason, the animation of the cursor is also blocked—which users may interpret as an unresponsive application.
  • In general, the responsiveness of display object cursors are sluggish. In comparison, native mouse cursors look and perform better when the user interacts with an application.

Fortunately, leveraging the new native mouse cursor feature does not require writing a lot of code. You'll need to use slightly more ActionScript to implement simple Mouse.hide and startDrag functionality. The code is fairly straightforward and the visual effects are worth the effort required to customize the cursor or animate it.

Implementing native mouse cursors

When implementing native mouse cursors, you'll use several properties that are very concise and efficient. The primary functionality is performed by the MouseCursorData object that is located in the flash.ui package.

The following three properties control the MouseCursorData object:

  • MouseCursorData.data: A vector of BitmapData objects used to display the cursors.
  • MouseCursorData.hotSpot: The value of the registration point of the cursor, stored as a Point object.
  • MouseCursorData.frameRate: The frame rate used to animate a sequence of bitmap images. This property allows you to create animated cursors.

After you've created a MouseCursorData object, use the Mouse.registerCursor method to assign it to the Mouse object. Once the Mouse object has been registered, you can pass the alias to the Mouse.cursor property.

Note: By passing a vector of BitmapData objects, you can specify a series of bitmap cursors in order to create a native animated cursor.

Examine the following code example:

// Create a MouseCursorData object var cursorData:MouseCursorData = new MouseCursorData(); // Specify the hotspot cursorData.hotSpot = new Point(15,15); // Pass the cursor bitmap to a BitmapData Vector var bitmapDatas:Vector.<BitmapData> = new Vector.<BitmapData>(1, true); // Create the bitmap cursor // The bitmap must be 32x32 pixels or smaller, due to an OS limitation var bitmap:Bitmap = new zoomCursor(); // Pass the value to the bitmapDatas vector bitmapDatas[0] = bitmap.bitmapData; // Assign the bitmap to the MouseCursor object cursorData.data = bitmapDatas; // Register the MouseCursorData to the Mouse object with an alias Mouse.registerCursor("myCursor", cursorData); // When needed for display, pass the alias to the existing cursor property Mouse.cursor = "myCursor";

It is important to remember that the bitmap files used for the cursors should not exceed 32 × 32 pixels, due to an OS limitation. Attempts to pass a larger bitmap will fail silently.

At any time, you can stop using the current bitmap cursor and switch back to display the default OS cursor. To achieve this, use one of the constant values of the MouseCursor class, as shown below:

Mouse.cursor = MouseCursor.AUTO;

The previous example created a simple static bitmap cursor; the next example creates an animated cursor. The process is easy—simply supply multiple bitmap images and then specify the frame rate of the cursor animation, as follows:

// Create a MouseCursorData object var cursorData:MouseCursorData = new MouseCursorData(); // Specify the hotspot cursorData.hotSpot = new Point(15,15); // Pass the cursor's bitmap to a BitmapData Vector var bitmapDatas:Vector.<BitmapData> = new Vector.<BitmapData>(3, true); // Create the bitmap cursor frames // Bitmaps must be 32 x 32 pixels or less, due to an OS limitation var frame1Bitmap:Bitmap = new frame1(); var frame2Bitmap:Bitmap = new frame2(); var frame3Bitmap:Bitmap = new frame3(); // Pass the values of the bitmap files to the bitmapDatas vector bitmapDatas[0] = frame1Bitmap.bitmapData; bitmapDatas[1] = frame2Bitmap.bitmapData; bitmapDatas[2] = frame3Bitmap.bitmapData; // Assign the bitmap data to the MouseCursor object cursorData.data = bitmapDatas; // Pass the frame rate of the animated cursor (1fps) cursorData.frameRate = 1; // Register the MouseCursorData to the Mouse object Mouse.registerCursor("myAnimatedCursor", cursorData); // When needed for display, pass the alias to the existing cursor property Mouse.cursor = "myAnimatedCursor";

By setting the MouseCursorData.frameRate property and passing a series of BitmapData objects, Flash Player automatically creates an animated cursor that plays at the specified frame rate. This happens automatically, so you do not need any additional code to animate the cursor.

Native cursor demo

The following demo shows examples of a native static cursor and native animated cursor. The bottom button resets to the default OS cursor.

Flash playerがありません Flash 10が必要ですか? Flash 10が必要ですか?

Note: You must have Flash Player 10.2 installed to view this behavior.

Where to go from here

Whether you develop games or RIAs, the native mouse cursor feature makes it easier to customize cursors than ever before. Additionally, the new implementation enhances the appearance and responsiveness of an application while reducing the CPU load required to move and redraw the cursor on the Stage.

Check out Mihai Corlan's article, Working with native custom cursors in Flash, on the Adobe Flash Platform blog to research further.

Acknowledgments

The native cursor example uses icons from the Silk Icons 1.3 set by Mark James.

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License

More Like This

  • Stage3Dの仕組みを学ぶ
  • Getting started with stage video
  • What's new in Flash Player 11
  • Flash Player 10.1 demos and interviews

製品

  • Adobe Creative Cloud
  • Creative Cloudグループ版
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • Digital Publishing Suite
  • Elementsファミリー
  • SiteCatalyst
  • 教育向け

ダウンロード

  • 体験版
  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR

サポート

  • ヘルプ&サポート
  • 注文と返品
  • ダウンロードに関するヘルプ
  • ユーザー登録に関するヘルプ

ラーニング

  • トレーニング
  • Adobe TV
  • デザインマガジン
  • Photoshopマガジン
  • Focus In(ビデオ制作者向け)
  • Adobe Developer Connection [ADC]
  • 初心者向け写真編集
  • Adobe Marketing Cloud Japan Blog

ご購入

  • 個人・プロフェッショナル向け製品
  • 学生・教職員向け製品
  • 小中規模ビジネス向け製品
  • ライセンスについて
  • キャンペーン情報
  • 販売パートナー

会社情報

  • プレスルーム
  • パートナープログラム
  • 企業の社会的責任(CSR)
  • 採用情報
  • 投資家の皆様へ(英語)
  • イベント
  • 法的事項
  • セキュリティ
  • お問い合わせ
地域を選択してください 日本(変更)
地域を選択してください 閉じる

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2013 Adobe Systems Software Ireland Ltd. All rights reserved.

利用条件 | プライバシー | Cookie

Reviewed by TRUSTe: site privacy statement