473,893 Members | 1,599 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 2699
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
7911
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
1575
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
12646
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
9982
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11243
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
10927
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
10469
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
9645
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...
0
6066
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4684
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
4280
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3289
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.