Page 1 of 2

Using Adobe (Macromedia) Flash in MM - focus issue!

Posted: Wed Oct 25, 2006 7:54 pm
by DaledeSilva

I'm creatng a new script for media monkey which embeds an html page inside a dockable panel. Inside which is embedded a fullframe flash file.

I use swfobject to embed the flash file via javascript (so have no IE security problems related to activating it). - found here if you're interested (

however, I do have a focus issue that's only occuring in Media monkey.

if I open the html page in Internet Explorer or Firefox, I can have any other program in focus, but when I rollover flash in the browser window.. everything reacts accordingly and when I click, flash reacts as if it was in focus already (eg. does the onPress or onRelease commands).

however, in Mediamonkey, if I have focus in the tracklist or in the playlist or in the tree, my first click on the flash file will not do anything... though strangely enough.. the onRollover actions still work - (if I hold it down it will actually think that the mouse isn't even within the flash window anymore).

this problem is making the advanced useability controls that I'm including too difficult to use.

perhaps it is the way the window is created?
below is the code I'm using to create the panel and html window:
Sub CreatePanel

Dim path : path = SDB.IniFile.StringValue("PrettyPictures","FilePath")

if Pnl.IsNew then
Pnl.DockedTo = 3
Pnl.Common.Height = 200
end if
Pnl.Caption = "PrettyPictures"

Dim HtmlPnl : Set HtmlPnl = UI.NewActiveX(Pnl, "Shell.Explorer")
HtmlPnl.Common.Align = 5
HtmlPnl.Interf.Navigate path &"FlashPage.html"
SDB.Objects("PrettyPicturesPanel") = Pnl

Set Mnu = SDB.UI.AddMenuItem(SDB.UI.Menu_View,1,-1)
Mnu.Caption = "PrettyPictures Panel"
Mnu.shortcut = "Ctrl+Shift+a"
Mnu.Checked = Pnl.Common.Visible

Script.RegisterEvent Pnl, "OnClose", "PnlClose"
Script.RegisterEvent Mnu, "OnClick", "ShowPanel"

End Sub

also... it's interesting to note that if I open another program and have that in focus.. if I click directly from the other program into flash within mediamonkey.. it reacts 'correctly'... the problem is only seen if the focus is different "within" mediamonkey...

anyone have any idea if I'm doing anything wrong or if there's a work around.. or if it's an issue only the dev's are able to address in a future release?


Posted: Wed Oct 25, 2006 8:03 pm
by DaledeSilva
as another note;

I have tried tricking the swf file into gaining focus whenever rolled over via a javascript function.

whenever a button is rolled over a flash function is run which in turn calls a javascript function embedded within the html page.

here is the javascript function (the swf file is embedded with id="prettypictures"):
<SCRIPT Language='Javascript'>
function windowChange()
testing this over and over by simply using it, I have found that this actually works... but only the first time it occurs.. :(

so clicking in the tracklist once and then clicking on a button in flash will work the first time.. but never after that.

not sure if this is a flaw with "focus()" or if it is part of the related problem.

I also tried:
but this has the same problem.


Posted: Thu Oct 26, 2006 4:33 am
by Steegy
Does this work?

Code: Select all

<script language='Javascript'>
function windowChange()
(I think this is the best way to use the code: XHTML -> the new standard)

If it doesn't work, then maybe Jiri will be able to help you.


Changed 2x a small /.

Posted: Thu Oct 26, 2006 4:35 am
by trixmoto
This is probably because "prettypictures" still has the focus, as there are two layers of focus. Focusing between the webpage and the tracklist is different from focusing within the webpage. Maybe you need to have a similar event to blur when the mouse leaves the button (on the mouseout event)?

EDIT: Well, Steegy's managed to post whilst I was writing mine! He has the same idea, but is doing it in a better place - try his idea! :D

Posted: Thu Oct 26, 2006 6:04 am
by DaledeSilva
thanks alot for coming to my aid, guys.
unfortunately it doesn't work...

I have now tried this (after trying steegy's suggestiong):
function windowIn(value)
function windowOut(value)

but it has the same problem as before

any other ideas :D ?

Jiri? ;)

thanks alot anyway..


Posted: Thu Oct 26, 2006 6:15 am
by jiri
I don't why it doesn't work well, but have you tried it in the internal MM webbrowser (i.e. the control that appears instead of tracklist)? I wonder how it will work there...


Posted: Thu Oct 26, 2006 7:06 pm
by DaledeSilva
Thanks Jiri,

I did a test, simply modifying trixmoto's browsebyart script to load my page instead (in place of the tracklist) and it has the same problem.

that is, with these javascript functions trying to control focus on the player it still only works the first time... exact same behaviour as in a panel.

would it be helpful if I made up a script and demo flash file for you to test? (if you are so inclined)
I'll include both dockable panel and node version.


Posted: Thu Oct 26, 2006 8:40 pm
by DaledeSilva
hello again...

I've create a script which creates both a dockable panel and a node html page and I've uploaded it here:
this thread and testing file have been replaced by this:
I've included some notes in the header regarding analysing what you're seeing...
but in short...

click on something in the playlist or the node tree.. then roll over the button in the flash window. it reacts appropriately... now click na dhold down.. it thinks the mouse isn't there anymore... then click and hold again... the second click is what it should do the first time.

Also... because there is now a dockable panel and a normal html window.. it's possible to have two on screen at once.. and so I found that while the focus doesn't jump from the playlist to the flash window on first click.. there is no problem jumping between the two different html windows on first click.



ps. in the .vbs file... this line might need to be change depending on where you have installed media monkey... (I didn't want to modify the ini file just for a test)
path = "C:\Program Files\MediaMonkey\Scripts\Auto\html-and-flash\"

Posted: Thu Oct 26, 2006 8:42 pm
by DaledeSilva
BTW... put it in your "scripts/auto" directory.

also.. I included the .fla file for editing the flash element but that's just if you're curious... you wont 'need' to because I've already got it working witht he javascript functions in the html file which you can edit.


Posted: Fri Oct 27, 2006 1:42 am
by DiddeLeeDoo
Not really sure if it's related, but I tried various ways to have .html pages displayed inside MM, but dropped the project due MM force you back to the 'start' page instead of where you left it.

Is that what you try to find a 'work-around' for maybe?

BTW, would be nice with a function like...

Code: Select all

if isNull(url) then
End if

Posted: Fri Oct 27, 2006 2:56 am
by DaledeSilva
tthe onBrowserfocus idea you mention would probably be pretty useful... though it's not what I need.

I'm already faking something like that in the flash file I posted up a few posts up...

what I'm trying to do is get a mouse click to not only focus the browser window but be applied in the flash window with the one click (which happens usually but not when coming from the tracklist, playlist, or node tree.


Posted: Fri Oct 27, 2006 3:21 am
by DiddeLeeDoo
I've been clicking everywhere, and to me that tester seems to be solid as a rock. Cannot get it to fail, no matter where I click, from nodes, playlists, now playing...

Using MM v2.5.5.980.

Only failure I could find, where when MM being busy reading tracks. It could then take a second before the flash reacted. I'm left with a feeling that I have misunderstood something ;)

Posted: Fri Oct 27, 2006 3:52 am
by DaledeSilva
ah.. I didn't realise there was a new version out.. I've install it now and tested and the problem's definitely still there.

here's how to see it:
  • - in your "View file menu".. make sure "now playing" is turned on.
    - click on a file in that list so that it is selected.
    - move you mouse over the "BUTTON TEST" without clicking at all (note how it performs it's rollover action flawlessly.
    - now click directly on the "BUTTON TEST" and HOLD DOWN.
    - while holding down, you will notice it says "not pressed or moused over" and "mouse OUTSIDE window"
it's not detecting the mouse on the first click...

now that the window's focussed, if you click and hold again it will detect properly and say "being pressed" and "mouse inside window"


ps.. DiddleDeeDoo... where in Oz are you?

Posted: Fri Oct 27, 2006 4:05 am
by Steegy
it's not detecting the mouse on the first click...
I can confirm this using MM 2.5.3RC4

Posted: Sat Oct 28, 2006 8:38 pm
by DaledeSilva
Thanks Steegy... I guess it looks like it's due to the way Mediamonkey's made and is in a sense, a bug...

can't think of any other workarounds that might help fix it though...

DEVS: any chance of it being addressed in a future release?