473,804 Members | 2,280 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cross Broswer Q - How to force flash to have focus...

25 New Member
I want to have the flash document have focus when the page initially loads...so the user can use the mouse scroll wheel to zoom in and out on the map that is on stage...(withou t having to click inside the browser window first)...

Now, I have already gotten this to work with IE by using the following code...

[HTML]<body onLoad="window. document.eXfX.f ocus();">[/HTML]

But like I said, this only works in IE, and I cannot find any information on forcing focus in other browsers...and I do not know how I would decide which browser is being used...I'm fairly new to JS so bare with me...
May 13 '08 #1
7 2695
acoder
16,027 Recognized Expert Moderator MVP
Can you show the HTML code that displays the Flash content?
May 14 '08 #2
paulcybulski
25 New Member
[html]
<body onLoad="window. document.eXfX.f ocus();">
<script type="text/javascript" src="swfobject. js"></script>
<div id="flashconten t">
<a href="http://www.macromedia. com/go/getflashplayer" target="_blank" >Click here to download Macromedia Flash Player to view the content of the page! Once the install is complete click Refresh to view this page.</a>
</div>
<script type="text/javascript">
var so = new SWFObject("blah .swf", "eXfX", "100%", "100%", "8", "#ffffff");
so.write("flash content");
</script>
</body>
[/html]
May 14 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
"eXfX" (the second parameter to SWFObject) is the ID, not the name of the object/embed element, so you want to use document.getEle mentById("eXfX" ).focus().
May 14 '08 #4
paulcybulski
25 New Member
"eXfX" (the second parameter to SWFObject) is the ID, not the name of the object/embed element, so you want to use document.getEle mentById("eXfX" ).focus().
that code only works in IE...unfortunat ely FF doesn't treat it the same way and you still have to click the swf to give it focus...
May 14 '08 #5
acoder
16,027 Recognized Expert Moderator MVP
From this technote it appears that this only works in IE, so you'll have to use the first solution.
May 14 '08 #6
paulcybulski
25 New Member
From this technote it appears that this only works in IE, so you'll have to use the first solution.
so there is no way to do this in FF? Nothing that I have tried has worked!!!
May 15 '08 #7
acoder
16,027 Recognized Expert Moderator MVP
Well, there is a way, but it's probably not what you're looking for.

There are two ways to give focus to the Flash movie.

* Have the user click in the Flash movie Add a button to the first frame of the movie that the user must click in order to continue (an "Enter", "Start" or "Login" button, for example). Any subsequent key presses can be detected by Flash.
* Use JavaScript to give focus to Flash The JavaScript focus() method can automatically give focus to the Flash movie when the HTML page containing it loads.

Note: This method only works on Windows versions of Internet Explorer.
If you see the note, using JavaScript to give focus to Flash only works in IE. For other browsers, use the first solution.
May 16 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

5
7893
by: annagel | last post by:
I am looking for a way to force a Tkinter window into focus on a system level. I know the force focus method should bring one window of my application into focus, but it seems I need to have some part of my application already in focus on a system level to make this work. If for example I am entering text at the command line and call a force_focus on my root window the call will not return till I click on a window in my application. The...
6
1638
by: VisionSet | last post by:
I need to persist some objects across page navigations, I am under the impression that on each new page a new set of top level objects are provided so I don't know where, how or if I can persist my own objects. Any advice please? TIA, Mike W
1
1572
by: nitinpatel1117 | last post by:
i have a website, which as flash elements on the screen. I've tested it on all the major broswers, IE 6 & 7, firefox v1 & 2, opera, safari. Works perfect on all these broswers, However, i tested on windows XP, and now just found out that a part of the flash element does not work on firefox v2 when the user has windows vista OS. All other broswer on vista are fine, just Firefox seems to be affected. Same vesion of firefox on Vista and...
17
12636
by: M O J O | last post by:
Hi, How can I force a form to the foreground no matter what application is in front? Thanks! M O J O
0
10599
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10347
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10090
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9173
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7635
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5531
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3832
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.