I am working on a video player in Flash CS4. I'm trying to build the player such that when the user moves their mouse over the flash object, the playback controls appear and, when the user moves the mouse out of the flash object, the controls disappear.
I managed to get some code put together that works in every browser but one: Internet Explorer. Well, it 'works' but only if you slowly move the mouse out on the left side of the flash object.
I have done quite a bit of Google searching for an answer, but I can't seem to find someone with a similar problem.
Code is as follows:
ActionScript Code:
_root.onLoad = function(){
_root.clip.skinAutoHide=true;
_root.clip.skinFadeTime=0;
}
_root.onRollOver = function () {
_root.clip.skinAutoHide=false;
}
_root.onRollOut = function () {
_root.clip.skinAutoHide=true;
_root.clip.skinFadeTime=0;
}
Website Code (Inserted where the flash should go):
var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if(hasRightVersion) { // if we've detected an acceptable version
// embed the flash movie
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,24,0',
'width', '280',
'height', '280',
'src', '01clip1',
'quality', 'best',
'pluginspage', 'http://www.adobe.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'noscale',
'wmode', 'transparent',
'devicefont', 'false',
'id', '01clip1',
'bgcolor', '#ffffff',
'name', '01clip1',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','sameDomain',
'movie', '01clip1',
'salign', ''
); //end AC code
} else { // flash is too old or we can't detect the plugin
var alternateContent = 'Alternate HTML content should be placed here.'
+ 'This content requires the Adobe Flash Player.'
+ 'Get Flash';
document.write(alternateContent); // insert non-flash content
}
Any insight would be appreciated.
Alright, I fixed it. The issue was that apparently the AS2 methods for working with mouseover/mouseout don't really work well in this instance. I update the flash to use AS3 and used the following code:
/*
Code lifted and slightly modified from:
http://board.flashkit.com/board/showthread.php?t=714795
*/
clip.skinAutoHide = false;
clip.skinBackgroundAlpha = 0;
clip.skin = "";
stage.addEventListener(Event.MOUSE_LEAVE, hideSkin);
stage.addEventListener(MouseEvent.MOUSE_MOVE, showSkin);
function showSkin(evt:Event=null):void {
clip.skinBackgroundAlpha = 0.30;
clip.skin = "SkinOverPlaySeekMute.swf";
}
function hideSkin(evt:Event=null):void {
clip.skinBackgroundAlpha = 0;
clip.skin = "";
}
I'm not entirely sure why it had to be done this way, but here's the code nonetheless for all you other people out there banging your head against your desk.
Cheers.