Solved

Forcing the swf to have focus

Posted on 2003-11-24
5
345 Views
Last Modified: 2010-04-03
Hi all.

I have a swf that has a print button, when clicked, it brings up the standard windows print dialogue box, once you've clicked ok or cancel there, is there a way I can force the swf to receive focus - because, what happens now, is the user first has to click anywhere in the swf, before the buttons become active, or click the button twice.

Thanks.
blu
0
Comment
Question by:blue-genie
  • 2
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
OBCT earned 60 total points
ID: 9816364
Blu,

I found this in the actionscript dictionary on Flash MX 2004. I'm not sure if it will set your swf as the main focus but it's worth a try.

Selection.setFocus()
Availability
Flash Player 5. Instance names for buttons and movie clips work only in Flash Player 6 and later.

Usage
Selection.setFocus("instanceName")

Parameters
instanceName A string specifying the path to the instance name of a button, movie clip, or text field.

Returns
An event.

Description
Method; gives focus to the selectable (editable) text field, button, or movie clip specified by instanceName. The instanceName parameter must be a string literal of the path to the instance. You can use dot or slash notation to specify the path. You can also use a relative or absolute path. If you are using ActionScript 2.0, you must use dot notation.

If null is passed, the current focus is removed.

Example
The following example gives focus to a text field associated with myVar, on the main Timeline. Because the instanceName parameter is an absolute path, you can call the action from any Timeline.

Selection.setFocus("_root.myVar");

In the following example, the text field associated with myVar is in a movie clip called myClip on the main Timeline. You can use either of the following two paths to set focus; the first is relative and the second is absolute.

Selection.setFocus("myClip.myVar");
Selection.setFocus("_root.myClip.myVar");

The only other way I am aware of is by using a third part tool. I personally use SWF Studio but there are alot of others around. The only problem is they aren't cheap so I'm not sure if your project is big enough to need such a tool.
I hope this helps.

Cheers

-OBCT
0
 
LVL 23

Expert Comment

by:Zeffer
ID: 9816530
so the answer is..

on the tail-end of your print-button code..

Selection.setFocus("_root");

z

0
 
LVL 39

Author Comment

by:blue-genie
ID: 9816738
nope, sorry Zeffer, that was the first thing i tried, it doesn't work.

OBCT, how do you do it in SWF studio, i'm packaging the final product in swf studio.
0
 
LVL 39

Author Comment

by:blue-genie
ID: 9816782
OBCT, nevermind, i just has a look at the previous version that's been put into swf studio, and the problem doesn't seem to exist.

I'm going to leave this open for a bit, see if anyone knows how to do it without a 3rd party tool.

ta.

blu
0
 
LVL 23

Expert Comment

by:Zeffer
ID: 9820312
try
Selection.setFocus("_parent");

z
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question