Solved

Forcing the swf to have focus

Posted on 2003-11-24
5
342 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

863 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now