Solved

Forcing the swf to have focus

Posted on 2003-11-24
5
352 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Flash movie or gif/animation? 3 973
You Tube Videos not playing 9 143
Can't enable Flash on Chrome 32 Windows 7 any more 2 77
type of website 13 51
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 …
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
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): …
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

737 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