ScriptUI's Window mousemove event not fired in CS5 with swf
Hi!
I'm creating a ScriptUI Window and loading an swf file inside of it. Then I'm trying to listen to mousemove event with w.addEventListener('mousemove'...) as it is written in ScriptUI documentation. In Photoshop CS3 and CS4 all was working perfectly. Now it seems the mousemove event is not fired! I can still catch the event inside swf, of course, but I can't do it with ScriptUI in Photoshop CS5.
I need to catch it from Window object to make it possible to move that window with mouse. My code is included. It's actually, a common code block proposed by documentation.
Is something changed in CS5 comparing to the previous versions of Photoshop?
// bootstrapping code for running a SWF
$.evalSWF = function( swfFile )
{
if( swfFile.exists )
{
var btScript = 'var res = "palette{ properties: { resizeable: false, maximizeButton: false, borderless:true }, fp: FlashPlayer{ preferredSize: [' + width + ', ' + height + '] } }";\n';
btScript += "var w = null; w = new Window ( res ); \
w.opacity = 1.0; \
w.init = function() \
{ \
try \
{ \
this.fp.ExtendScript_init = function( initScript ) { return eval( initScript ); }\n\
this.fp.loadMovie ('" + swfFile + "'); \
w.addEventListener ('mousemove', function(event) { alert('!'); }, false); \ // doesn' work
} \
catch (e) \
{ \
alert ('Load Movie function failed: ' + e); \
} \
} \
w.onResize = function() \
{\
if( this.size != this.fp.size )\
this.fp.size = this.size;\
}\
w.margins = [0,0,0,0]; \
w.init(); \
w.addEventListener ('mousemove', function(event) { alert('!'); }, false); \ //doesn't work either
w.show();";var bt = new BridgeTalk;
bt.target = BridgeTalk.appSpecifier;
bt.body = btScript;
bt.onError = function(msg)
{
alert( "ExtendScript_start: " + msg.body );
}
if( BridgeTalk.appName == "photoshop" )
bt.send( 60 * 5 ); // send the message synchronously and wait for max. 5 minutes.
else
bt.send(); // send the message asynchronously
}
}var root = File( BridgeTalk.getAppPath( BridgeTalk.appSpecifier ) ).parent;
if( BridgeTalk.appName == "illustrator" )
root = root.parent.parent.parent;
root += "/Plug-Ins/Panels";
var swfFile = new File( root + "/" + project + "/" + "main.swf" );
var resolvedFile = swfFile.resolve();
if( resolvedFile != null )
swfFile = resolvedFile;
if( !swfFile.exists )
alert( swfFile + " does not exist" );
else
$.evalSWF(swfFile);
Thank you!
