将鼠标光标更改为位图(Flex 4)? [英] Change mouse cursor to a bitmap (Flex 4)?

查看:127
本文介绍了将鼠标光标更改为位图(Flex 4)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Flex 4中,如何将光标更改为运行时中确定的位图图像?我见过的所有示例都使用CursorManager.setCursor将游标设置为编译时指定的类。



我想要做的是将光标更改为位图数据由上下文决定的位图。

解决方案

 包光标
{
import flash.display.BitmapData;
import flash.display.PixelSnapping;

导入mx.core.BitmapAsset;

public class RuntimeBitmap1 extends BitmapAsset
{

public static var staticBitmapData:BitmapData;

public function RuntimeBitmap1()
{
super(staticBitmapData);





$ b用法:

  var bitmapData:BitmapData = new BitmapData(50,50,false,0x88888888); 
RuntimeBitmap1.staticBitmapData = bitmapData;
cursorManager.setCursor(RuntimeBitmap1,0);


In Flex 4, how can I change the cursor to a Bitmap image determined at runtime? All the examples I've seen use CursorManager.setCursor to set the cursor to a class specified at compile time.

What I want to do is change the cursor to a bitmap whose bitmapData is determined by the context.

解决方案

package cursor
{
import flash.display.BitmapData;
import flash.display.PixelSnapping;

import mx.core.BitmapAsset;

public class RuntimeBitmap1 extends BitmapAsset
{

    public static var staticBitmapData:BitmapData;

    public function RuntimeBitmap1()
    {
        super(staticBitmapData);
    }
}
}

Usage:

var bitmapData:BitmapData = new BitmapData(50, 50, false, 0x88888888);
RuntimeBitmap1.staticBitmapData = bitmapData;
cursorManager.setCursor(RuntimeBitmap1, 0);

这篇关于将鼠标光标更改为位图(Flex 4)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆