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

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

DaledeSilva
Posts: 893
Joined: Sun May 28, 2006 4:22 am
Location: Australia
Contact:

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

Post by DaledeSilva » Wed Oct 25, 2006 7:54 pm

Hello,

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 (http://blog.deconcept.com/swfobject/)

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?

Dale.
Last edited by DaledeSilva on Wed Oct 25, 2006 8:11 pm, edited 1 time in total.
My Plugins: PrettyPictures [v0.9.2], Forget Crossfade [v1.0], Behind Titlebars [v0.9], Filter Nodes [v1.0.1], View Mode [1.0], BPM.tapper [v1.0]
My Site: http://www.ublik-om.net

DaledeSilva
Posts: 893
Joined: Sun May 28, 2006 4:22 am
Location: Australia
Contact:

Post by DaledeSilva » Wed Oct 25, 2006 8:03 pm

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()
{
window.document.prettypictures.focus()
}
</SCRIPT >
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:
document.getElementById('prettypictures').focus()
but this has the same problem.


Dale.
My Plugins: PrettyPictures [v0.9.2], Forget Crossfade [v1.0], Behind Titlebars [v0.9], Filter Nodes [v1.0.1], View Mode [1.0], BPM.tapper [v1.0]
My Site: http://www.ublik-om.net

Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium
Contact:

Post by Steegy » Thu Oct 26, 2006 4:33 am

Does this work?

Code: Select all

<script language='Javascript'>
function windowChange()
{
document.getElementById('prettypictures').blur();
document.getElementById('prettypictures').focus();
}
</script>
(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.

Cheers
Steegy

Changed 2x a small /.
Last edited by Steegy on Thu Oct 26, 2006 4:38 am, edited 2 times in total.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto » Thu Oct 26, 2006 4:35 am

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
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

DaledeSilva
Posts: 893
Joined: Sun May 28, 2006 4:22 am
Location: Australia
Contact:

Post by DaledeSilva » Thu Oct 26, 2006 6:04 am

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)
{
document.getElementById('prettypictures').focus();
}
function windowOut(value)
{
document.getElementById('prettypictures').blur();
}

but it has the same problem as before

any other ideas :D ?

Jiri? ;)

thanks alot anyway..

Dale.
My Plugins: PrettyPictures [v0.9.2], Forget Crossfade [v1.0], Behind Titlebars [v0.9], Filter Nodes [v1.0.1], View Mode [1.0], BPM.tapper [v1.0]
My Site: http://www.ublik-om.net

jiri
Posts: 5390
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Post by jiri » Thu Oct 26, 2006 6:15 am

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...

Jiri

DaledeSilva
Posts: 893
Joined: Sun May 28, 2006 4:22 am
Location: Australia
Contact:

Post by DaledeSilva » Thu Oct 26, 2006 7:06 pm

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.

Dale.
My Plugins: PrettyPictures [v0.9.2], Forget Crossfade [v1.0], Behind Titlebars [v0.9], Filter Nodes [v1.0.1], View Mode [1.0], BPM.tapper [v1.0]
My Site: http://www.ublik-om.net

DaledeSilva
Posts: 893
Joined: Sun May 28, 2006 4:22 am
Location: Australia
Contact:

Post by DaledeSilva » Thu Oct 26, 2006 8:40 pm

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: http://www.mediamonkey.com/forum/viewtopic.php?p=141788
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.

thanks,

Dale.

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\"
Last edited by DaledeSilva on Sun Apr 06, 2008 1:31 am, edited 2 times in total.
My Plugins: PrettyPictures [v0.9.2], Forget Crossfade [v1.0], Behind Titlebars [v0.9], Filter Nodes [v1.0.1], View Mode [1.0], BPM.tapper [v1.0]
My Site: http://www.ublik-om.net

DaledeSilva
Posts: 893
Joined: Sun May 28, 2006 4:22 am
Location: Australia
Contact:

Post by DaledeSilva » Thu Oct 26, 2006 8:42 pm

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.

Dale.
My Plugins: PrettyPictures [v0.9.2], Forget Crossfade [v1.0], Behind Titlebars [v0.9], Filter Nodes [v1.0.1], View Mode [1.0], BPM.tapper [v1.0]
My Site: http://www.ublik-om.net

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo » Fri Oct 27, 2006 1:42 am

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

onBrowserFocus
if isNull(url) then
    ShowBrowser   
    url="mydoc.html"
Else
    ShowBrowser
End if
Image

DaledeSilva
Posts: 893
Joined: Sun May 28, 2006 4:22 am
Location: Australia
Contact:

Post by DaledeSilva » Fri Oct 27, 2006 2:56 am

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.

Dale.
My Plugins: PrettyPictures [v0.9.2], Forget Crossfade [v1.0], Behind Titlebars [v0.9], Filter Nodes [v1.0.1], View Mode [1.0], BPM.tapper [v1.0]
My Site: http://www.ublik-om.net

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo » Fri Oct 27, 2006 3:21 am

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 ;)
Image

DaledeSilva
Posts: 893
Joined: Sun May 28, 2006 4:22 am
Location: Australia
Contact:

Post by DaledeSilva » Fri Oct 27, 2006 3:52 am

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"

Dale.

ps.. DiddleDeeDoo... where in Oz are you?
My Plugins: PrettyPictures [v0.9.2], Forget Crossfade [v1.0], Behind Titlebars [v0.9], Filter Nodes [v1.0.1], View Mode [1.0], BPM.tapper [v1.0]
My Site: http://www.ublik-om.net

Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium
Contact:

Post by Steegy » Fri Oct 27, 2006 4:05 am

it's not detecting the mouse on the first click...
I can confirm this using MM 2.5.3RC4
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).

DaledeSilva
Posts: 893
Joined: Sun May 28, 2006 4:22 am
Location: Australia
Contact:

Post by DaledeSilva » Sat Oct 28, 2006 8:38 pm

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?

Dale.
My Plugins: PrettyPictures [v0.9.2], Forget Crossfade [v1.0], Behind Titlebars [v0.9], Filter Nodes [v1.0.1], View Mode [1.0], BPM.tapper [v1.0]
My Site: http://www.ublik-om.net

Post Reply