Copy link to clipboard
Copied
hi
I propose this code, it produces an animate cursor:
package
{
import flash.display.Sprite;
import flash.ui.Mouse;
import flash.ui.MouseCursorData;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.geom.Point;
import flash.geom.Rectangle;
public class hourglass extends Sprite
{
[Embed(source='immi/busy.png', mimeType = 'image/png')]
private var a_busy:Class;
public function hourglass()
{ var mcd:MouseCursorData = new MouseCursorData();
mcd.data = new Vector.<BitmapData>();
var b:Bitmap = new a_busy as Bitmap;
var h:uint = b.height;
for( var i:int = 0; i < int(b.width/h); i++ )
{ var bmp:BitmapData = divBmp(b,new Point(i*h,0)); mcd.data.push( bmp ); }
mcd.frameRate = 10;
mcd.hotSpot = new Point(h/2-1,h/2-1);
Mouse.registerCursor('hourglass',mcd);
}
private function divBmp(bmp:Bitmap,pos:Point):BitmapData
{
var imBase:BitmapData = new BitmapData(bmp.width,bmp.height,true,0);
imBase.draw(bmp);
var immy:BitmapData = new BitmapData(bmp.height,bmp.height,true,0);
immy.copyPixels(imBase,
new Rectangle(pos.x,pos.y,bmp.height,bmp.height),
new Point(0,0));
return immy;
}
}
}
where immi/busy.png is an image whit a certain number of square images
now with the code:
new hourglass;
Mouse.cursor = "hourglass";
we can activate the animate cursor, and it works correctly in an simple application of test where works alone, but if I use it in a real application, for example downloading a host file, only one of the frames are displayed.
It seems that don't find the temporal space to advance the frames.
any opinion? ![]()
thanks in advance
JeanPaul
Copy link to clipboard
Copied
i don't see a problem using an animated cursor during file loads. however, if you're also doing something (like a lengthy for-loop) that stops the stage from updating, that would cause a problem with all animation.
Copy link to clipboard
Copied
of course, i know that any loop removes space from the multitasking, and can also stop the system...but the download is an asyncronous operation that leaves a lot of space to the other elaborations and, however, it was only an example, the same problem happens if I make an upload, or I read in local file.
Copy link to clipboard
Copied
are you using flash pro cs5.5?
Copy link to clipboard
Copied
yes, with XP34 SO
Copy link to clipboard
Copied
i have no idea what xp34 so is. in any case, because there's no problem using an animated cursor during a file load and you're having a problem, someone will probably need to download your file to see what you're doing.
Copy link to clipboard
Copied
pardon
, no XP34 but XP32 (winXP32 operating system).
OK, perhaps I must to perform other tests before saying other
Copy link to clipboard
Copied
i'd recommend creating a test file that contains only the code you showed and only the additional code needed to download a file.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more