Copy link to clipboard
Copied
Found this post when searching for an answer, but didn't find much elsewhere so I'll post my quick and ugly solution here. I'm sure it can be vastly improved, but I didn't have much more than 5 minutes.
Note - setting .visible to false just ended up causing the autohide transition to occur over and over, so instead I'm just temporarily moving the whole sprite offscreen.
(AS3, using CS5 component... note that 'player' is the FLVPlayback instance):
//### force 'autohide' when mouse inactive
var time
...Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Found this post when searching for an answer, but didn't find much elsewhere so I'll post my quick and ugly solution here. I'm sure it can be vastly improved, but I didn't have much more than 5 minutes.
Note - setting .visible to false just ended up causing the autohide transition to occur over and over, so instead I'm just temporarily moving the whole sprite offscreen.
(AS3, using CS5 component... note that 'player' is the FLVPlayback instance):
//### force 'autohide' when mouse inactive
var timer:Timer = new Timer(1500, 0);
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();
var skinSprite:DisplayObject;
var prevMouseX:Number;
var prevMouseY:Number;
function onTimer(e:TimerEvent):void {
//get skinSprite if we haven't already
if(!skinSprite) {
var child:DisplayObject;
for(var i:Number = 0; i < player.numChildren; i++) {
child = player.getChildAt(i);
if(i == 2) { //this is the skinSprite
skinSprite = child;
}
}
}
//check to see if mouse hasn't moved since last timer event
if(skinSprite && mouseX == prevMouseX && mouseY == prevMouseY) {
skinSprite.y = -1000;
}
prevMouseX = mouseX;
prevMouseY = mouseY;
}
stage.addEventListener(MouseEvent.MOUSE_MOVE, stage_onMouseMove);
function stage_onMouseMove(e:MouseEvent):void {
if(skinSprite) {
skinSprite.y = 0;
}
}
Copy link to clipboard
Copied
You sir rock. This works perfectly.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more