Checking For Focus
The flash animations at MTV.com do not start playing until the browser has the focus. In other words, if you go to mtv.com, and the switch to another program, window, or tab then the animations will not start loading until you switch back to mtv.com. Seems like a good idea, so how could i accomplish that?
i know that the control has a gotFocus event, I suppose I could write some javascript to check for this, and then play the movie. The only reason I ask is because a quick review of the html source code on mtv.com did not show anything like that.
Any suggestions?
Ultrashock Forums > Flash > Flash Newbie
Posted on: 2004-11-22
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Focus Problems On Return Focus To Html Window
Hi all
Im wondering if anybody has come across this problem before while developing with flash and javascript/HTML. Basically I have created a flash interface which accepts user input in the form of keystrokes - left arrow, up arrow etc....
This works fine in the standalone flash player - but when the movie is published into a html page and it loads up the keystrokes don't have any effect unless I a) click first on the flash movie within the html page or b) use JavaScript to catch the onLoad event in the html body tag and manually set focue to the movie using document.keyFocusCheck.focus();.
Ok, I've got this far and its working fine - im loading my html windo and setting focus to my flash movie(nad my keystrokes work straight off)- however here is my problem. If I alt+tab away from my html window and then alt+tab back to my window - my keystrokes don't work again unless I click first in the flash window - I've tried lots of different ways to reset focus to my flash file (eg. Putting an onFocus event handler in my html pages' body tag) but to no avail - I am wondering if it is actually possible to catch the focus event once the html window has lost its focus and then had it returned as everything I have tried doesn't work!
I have included a sample 'dumbed down' version for you guys to check out - if anybosy could point me in the right dirrection of offer any help that would be massively appreciated.
Thanks in advance
DotsC
Browser Focus Vs Flash Focus
If your swf extends the height of the browser, the standard browser scrollbar appears.
If you just opened your site, and have NOT clicked inside the browser, on your swf area, the browser will scroll vertically with the up/down keys.
If you click your swf in the browser, the up/down keys no longer register with the Browser, and you cannot scroll vertically.
Is anyone aware of a way to remedy this problem? My first thoughts are maybe sending external interface commands to a javascript function to simulate the up/down scroll, but I'm not positive if javascript can control a browsers scrollbar, and whether there are problems cross-browsers with that.
Multiple Movieclips Focus / Out Of Focus
Hi!
I'm currently creating a website for a school project, and have some questions regarding this:
I have a website with 6 different links, and a background (7 mc's).
*When the website loads I want the whole page to be in focus
*when I rollover one of the links I want the rest of the movieclips/links incl. background to go out of focus (blur out)
*when the mouse is over the background I want the whole page to be in focus again (no blurring)
When the site loads everything is in focus, this is correct.
problem is; I have to rollover all of the movieclips before the function 'starts'..
example: the website loads, everything is in focus. I rollover one of the links, nothing happens. Then when I go back to the background, the link blurs, which would be fine if I pointed my mouse at another link, but when I point it at the background, I want everything to be in focus again.
For now I have an actionscript inside every movieclip (including the background mc) similar to this:
stop ();
//importere filter
import flash.filters.BlurFilter;
import mx.transitions.Tween;
import mx.transitions.easing.*;
var filter:BlurFilter = new BlurFilter(0, 0, 3);
var filterArray:Array = new Array();
filterArray.push(filter);
//funksjon
skjermbilder.filters = filterArray;
skjermbilder.blurred = 0;
this.onRollOver = function(){
var tw1:Tween = new Tween(skjermbilder, "blurred", Strong.easeOut, skjermbilder.blurred, 0, 1, false);
tw1["onMotionChanged"] = function() {
filter.blurX = skjermbilder.blurred*5;
filter.blurY = filter.blurX;
skjermbilder.filters = filterArray;
}
};
this.onRollOut = function(){
var tw1:Tween = new Tween(skjermbilder, "blurred", Strong.easeOut, skjermbilder.blurred, 1, 1, false);
tw1["onMotionChanged"] = function() {
filter.blurX = skjermbilder.blurred*5;
filter.blurY = filter.blurX;
skjermbilder.filters = filterArray;
}
};
PLEASE HELP!!
Lage.
Multiple Movieclips Focus / Out Of Focus
Hi!
I'm currently creating a website for a school project, and have some questions regarding this:
I have a website with 6 different links, and a background (7 mc's).
*When the website loads I want the whole page to be in focus
*when I rollover one of the links I want the rest of the movieclips/links incl. background to go out of focus (blur out)
*when the mouse is over the background I want the whole page to be in focus again (no blurring)
When the site loads everything is in focus, this is correct.
problem is; I have to rollover all of the movieclips before the function 'starts'..
example: the website loads, everything is in focus. I rollover one of the links, nothing happens. Then when I go back to the background, the link blurs, which would be fine if I pointed my mouse at another link, but when I point it at the background, I want everything to be in focus again.
For now I have an actionscript inside every movieclip (including the background mc) similar to this:
stop ();
//importere filter
import flash.filters.BlurFilter;
import mx.transitions.Tween;
import mx.transitions.easing.*;
var filter:BlurFilter = new BlurFilter(0, 0, 3);
var filterArray:Array = new Array();
filterArray.push(filter);
//funksjon
skjermbilder.filters = filterArray;
skjermbilder.blurred = 0;
this.onRollOver = function(){
var tw1:Tween = new Tween(skjermbilder, "blurred", Strong.easeOut, skjermbilder.blurred, 0, 1, false);
tw1["onMotionChanged"] = function() {
filter.blurX = skjermbilder.blurred*5;
filter.blurY = filter.blurX;
skjermbilder.filters = filterArray;
}
};
this.onRollOut = function(){
var tw1:Tween = new Tween(skjermbilder, "blurred", Strong.easeOut, skjermbilder.blurred, 1, 1, false);
tw1["onMotionChanged"] = function() {
filter.blurX = skjermbilder.blurred*5;
filter.blurY = filter.blurX;
skjermbilder.filters = filterArray;
}
};
PLEASE HELP!!
Lage.
Focus In And Focus Out Problem
Hi all, first time i enter this forum and have my first question about flash mx.
I cut my image into few parts, and within each part, I want to do some focus in, focus out action. So when user pointing on the part, it will shining or some other things and when focus out, it will return to original style.
I try to convert the image into symbol, and using rollover and rollout function, but the outcome is very poor and Im hardly to point to correct spot.
Anybody can help me please ?
Focus Color/Focus MC
I looked for answers on Help and on forums, but i still couldnt make it work. Ok. First. i tried and change focusrect color and it is not working. This is the script i used:
_focusRect = true;
globalStyleFormat.focusRectInner = 0xFF0000;
globalStyleFormat.focusRectOuter = 0xFF0000;
globalStyleFormat.applyChanges();
Im using Flash MX Professional 2004 and I publish it on Flash 6 with Actionscript Ver1. Im guessing its somehow related to this scripting and flash versions. Second, Im having a hard time trying to focus on a button inside an MC. I put this script on a maintimeline frame:
_root.mc1.text1.selection.setFocus();
This are the links to the FLA and SWF:
http://www.freewebs.com/kieserr/add.fla
http://www.freewebs.com/kieserr/add.swf
Please help. Thanks
Focus Color/Focus MC
I looked for answers on Help and on forums, but i still couldnt make it work. Ok. First. i tried and change focusrect color and it is not working. This is the script i used:
_focusRect = true;
globalStyleFormat.focusRectInner = 0xFF0000;
globalStyleFormat.focusRectOuter = 0xFF0000;
globalStyleFormat.applyChanges();
Im using Flash MX Professional 2004 and I publish it on Flash 6 with Actionscript Ver1. Im guessing its somehow related to this scripting and flash versions. Second, Im having a hard time trying to focus on a button inside an MC. I put this script on a maintimeline frame:
_root.mc1.text1.selection.setFocus();
This are the links to the FLA and SWF:
http://www.freewebs.com/kieserr/add.fla
http://www.freewebs.com/kieserr/add.swf
Please help. Thanks
Focus Color/Focus MC
I looked for answers on Help and on forums, but i still couldnt make it work. Ok. First. i tried and change focusrect color and it is not working. This is the script i used:
_focusRect = true;
globalStyleFormat.focusRectInner = 0xFF0000;
globalStyleFormat.focusRectOuter = 0xFF0000;
globalStyleFormat.applyChanges();
Im using Flash MX Professional 2004 and I publish it on Flash 6 with Actionscript Ver1. Im guessing its somehow related to this scripting and flash versions. Second, Im having a hard time trying to focus on a button inside an MC. I put this script on a maintimeline frame:
_root.mc1.text1.selection.setFocus();
This are the links to the FLA and SWF:
http://www.freewebs.com/kieserr/add.fla
http://www.freewebs.com/kieserr/add.swf
Please help. Thanks
Checking The URL
My good friend Benjamin Crebo my programming buddy o' pal would like to ask you good folks at flashkit how you check the URL from a flash movie, probably to check wether its in the right place on the server incase someone downloads it and tries to nick it.
Thanks
Jim
Checking For NaN
Hi,
I would like to check whether a variable contains a number. I thought I could do it like this:
Code:
myString = "123abc";
if(Number(myString) == Number.NaN)
trace("not a number");
however that doesn't work. I've tried various methods. Frustratingly, even if 'trace(Number(mystring))' returns 'NaN', the if statement still doesn't work.
Anyone know how to do this???
thx - n.
Checking Url By PHP
Hi,
I am tryingto check the url of my swf which is embeded in a HTML as following:
Code:
$referer = getenv("HTTP_REFERER");
print "&myVar=".$referer;
In flash, I have a var call myVar but it doesn't appear any change when the PHP have run.
Does anyone know what's wrong is it?
URL(10kb):
http://ddlam2.uhome.net/trying/send.html
Checking In
Went to [Getting Started] and all I could find was Fsh4.
Looking for good beginner tuts for Fsh5
Tnx
Checking
Yeah, as above. At the beginning of your root movie set _level0.loaded=0; In your movie loading in on level1 on the first frames set up a loop with the main script -
_level1.loadedBytes = _level1.getBytesLoaded();
_level1.totalBytes = _level1.getBytesTotal();
if (_level1.loadedBytes<_level1.totalbytes) {
gotoAndPlay ("loop");
} else {
_level0.loaded=1;
stop();
}
where loop is the label for the previous frame. This will return the variable _level0.loaded to 1 when the movie has loaded. Obviously your button script will probably read
on(release){
if (_level0.loaded==0){
loadMovie("movie",1);}
}
This will only load the movie if it has not been entirely loaded already.
I'm not sure exactly what your trying to do, you might have to take the stop(); out if you want your loaded movie to play and replace it with a gotoAndPlay
Anyway...Hopefully, this will point you in the right direction and you can work the rest out for youself .
Let me know if you have any probs.
Al.
Checking A URL
does anyone know of a way to check if a URL exists? Kind of like checking if a movie clip exists by putting:
if (movieClip){
//this code will execute as long is movieClip exists
}
only with a URL instead of an object or variable?
Checking For An Ace
I have an insurance button so that if the dealers first showing card is an ace then they have an insurance option.
The problem is its working so that if the dealers first 2 cards are on the table (ones showing, ones not) then the insurance button will show. Ive tried loads of variations and cant get it to check for just the one card. My actionscript knowledge isnt the best so its proberly just me being thick.
The insurance code is under function 'checkForBlackJack' and the buttons alpha is set to 0 under function 'initHand' both in the first frame of the movie
Can any one help
Checking For The Least Value?
Hello,
I've got few variables I'd like to check the value of, then depending on which one is the least value, do an action.
In other words I've got like
_root.distance1
_root.distance2
_root.distance3
_root.distance4
_root.distance5
and depending on which one is closest (lowest), that object would react. But my question is really just how do I check the value (some sort of array??) and then how do I tell it to do something (just a simple goto will be fine) depending on which one is closest?
Thanks!
Checking When Going Below 10
Hello,
I am making another program for my class to use, helping their subtraction.
I have a spinner which produces a number, then they click a button to multiply it to another. The product is then taken away from 501 (bit like darts). And this all works really well and has no problems.
However, how can I get the program to stop and celebrate when the falling number (501) gets to 10 or below?
Help please!!!
Cheers
Chris
Checking For...
I was wondering how you would check during a hittest to see if what your hitting has a certain variable atatched to it.
Say, occasionally when I hit the mc "bob" he's happy, so bob.happy = true. but some time he's not, so bob.happy = false
How would I check for this during a hittest?
Am I being clear enough?
Keep Checking For A Var?
I’m looking for a way for my Flash movie to look for a var sent from my html page and keep looking until it has been received. Atm I’m using this if statement:
if (var1==undefined) {
prevFrame();
}
Is there a better way of achieving this? Hopefully without using two frames?
Thanks!
Checking If A Key Is Down?
Hi, I'm trying to make a code that checks if the enter key is down, then a function will run every second.
I've tried:
ActionScript Code:
if (key.isDown(key.ENTER) {setInterval(rectDecrease,1000);}
How would I make flash constantly check this instead of just once?
Md5 Self Checking
Hi, my company has developed a flash game for use in a casino. In order to get approved I need to be able to have the swf's run an md5 hash check on themselves every time they are run, in order to proof against hacking.
Does anyone have any idea how to do this? Any help would be greatly appreciated as there are deadlines involved.
Thanks.
On Focus?
Is there an equivalent to onFocus in Flash's action script?
I am designing a cdrom in Flash and it has a background music loop. When clicking on one of the buttons in the flash movie, it opens up a new browser window in the foreground, putting the flash in the background, and stopping the background music. I am looking for a varible check that will start the music again once the browser window is closed and the flash window is once again in the foreground...
thanks in advance
Focus ?
hi can any one tell me weather we can have
onfocus or onblur option like javascript
i have a problem
what i want is that i have 2 text boxes
when i enter some text into first text box and come out of it or press TAB the value which is entered in the first text box should get assigned to the second text box.
thanks a lot
Set Focus
hi
in a frame i have three input text box say t1,t2,t3
,as soon as i load the frame how do i make the cursor to go and wait or blink in the t2 text box.
bye
geethanandh
Set Focus
hi
in a frame i have three input text box say t1,t2,t3
,as soon as i load the frame how do i make the cursor to go and wait or blink in the t2 text box.
bye
geethanandh
FOCUS Help..
Seems today is not my day....
i can't find the way to make that:
How can I make a simple thing like assigning
focus to single line of input text.
I have input text called user_id
I want the cursor blinking on the input
text line when loaded the frame where input is.
Thankx in advance for ur help
Focus
how can I make an image get out of focus and come back to focus without just inseting the focused image, then suddenly the one out of focus and finally again the first one?
thanks
How Do You Focus A .swf?
I got the text.focusrect to focus an input box, but the user has to click the flash movie in order to focus the .swf.
Is there an actionscript, or javascript, that will bring the .swf to the front... enabling the user to type in the textfield once the page is loaded?
Thanks....
Set Focus
Someone please help...
I have some text fields on a registration form, and I am trying to set the focus, so when one uses the tab key, the focus shifts from last name to first name, to address, to telephone... How do I do this. I have tried the following code, and it does not work: Is there a central place to put the code, or does each text field have to have a portion of the code? What is the best way to accomplish this?
Thanks
on (keyPress "<TAB>") {
if (selection.getFocus == "SSN") {
selection.setFocus = "Password";
} else if (selection.getFocus == "Password") {
selection.setFocus = "CPassword";
}
else if (selection.getFocus == "CPassword") {
selection.setFocus = "FirstName";
}
else if (selection.getFocus == "FirstName") {
selection.setFocus = "LastName";
}
else if (selection.getFocus == "LastName") {
selection.setFocus = "MiddleInitial";
}
else if (selection.getFocus == "MiddleInitial") {
selection.setFocus = "Street";
}
else if (selection.getFocus == "Street") {
selection.setFocus = "AptNumber";
}
else if (selection.getFocus == "AptNumber") {
selection.setFocus = "City";
}
}
How To Focus From .exe To .avi And .pdf
I understand how to use javascript to the focus for html pages, but how do I get it to work with other files types such as .avi and .pdf?
I need to make an interactive CDROM for our college and I'm trying to get the .avi and .pdf to appear in front of my .exe movie, but it's not working.
Any help would be greatly appreciated!
Focus
how do i make background frames out of focus? i've seen it done in multiple internet cartoons but i can't think of how to duplicate the effect- i'm also running on flash 5 so any mx tricks won't help- thanks in advance.
Jester45
MC Focus - Help
I'm setting up a simple menu. The problem is that the animation of one menu selection overlaps another, and I don't know how to fix it. My guess is to make an on RollOver focus set command...
the .fla is attached.
I've perused the site for tips, and will continue to do so while I wait for a reply!
thank you so much!
-dom
Focus
Hi,
I have a problem. I have a movie that works with keypress navigation. The problem is when you lose focus on the browser window in which my movie plays, and you come back, the keys won't work anymore, unless you click on the movie and make it focussed again.
How can I solve this problem???
thanx
Focus
Hi,
I'm working on a game which had a character which is controlled by the arrow keys on the keyboard, and on one side theres also a list box, problem is when I control the character, the selection in the list box goes up and down too!, how do I stop this?
thanks
boombanguk.
Set Focus To The Top
I have a long text document in a flash web page. When scrolling down to read this document I have a continue button at the bottom of the screen thats set to move to the next frame where I have the remainder of the document. The problem is when you click the continue button and upon moving to the next frame the focus is still at the bottom of the movie. I am trying to get the focus to go back up to the top of the screen but it staying right where the scroll bar was from the last frame??? I have spent hours trying to come up with a solution and I'm going to lose it.
To see the problem click on Hinduism link on the right handside side and scroll down to the bottom of the document. Click the continue button and you will see how it goes the next frame but not to the damn top.
View Page
Set Focus?
i have two input boxes on screen, when one has a number entered into it i want the curser (focus) to move to the second input box so that the user dosen't have to do it themselves!
any ideas?
Get Focus?
I'm having trouble figuring this one out and I've couldn't find the answer by searching.
I have a text input components and button components. When the user types something in the text input component, how can I get the button component to "get focus" (when the user hits the enter button) my button function will run?
Thanks.
Focus
I am making a fullscreeen board game. When a piece is moving I am trying to make the game automatically zoom in, and set it's center point on the piece's _x and _y position. How can this be done? (If it can be done)
Got Focus
Hi,
I've noticed that by default each button seems to have a yellow square when the focus is on that button.
Is there any way to desactivate it ?
thanks
Set Focus
I have been having a problem with Flash in the html page. It seems as though none of the buttons work until the user clicks twice on the swf file in the html.
The first click sets the focus and then after the browser has the focus set then you must click again to have the ActionScript or button get the URL during this time when the user rolls over the swf files i get a border around them .... is there a way to stop that? This all happens in IE
How can this be corrected....
thanks!
Focus
How do i set the focus on a flash text field field
[CS3] Focus
First off, Hello. I'm new here
Second, I'm kinda new to flash but am able to find my way around.
Now, to the question.
Is it possible to do an "out of focus blur" in flash with a graphic object? I don't really want to make my objects movie clips.
I guess I'll make them movie clips if I have to... But not all of them can be. For instance, I have a light bulb. It has 2 frames. One is off and the 2nd frame is the light turned on. I have that object set to Single Frame. You can't do that with a movie clip, that I'm aware of (without action scripts anyway)
Well, thanks. Also, If you're willing to explain why you would use Movie Clips over Graphic objects, I'm willing to listen.
[edit]I called them objects, but I guess they call them symbols[/edit]
Is It In Focus?
I'm trying to find out how we can figure out if a movieclip is infocus, meaning it was the last movieclip that ran the onSetFocus command.
is there any special command that will tell me what is the current in focus movieclip?
Set Focus
Hi, I'm having trouble using the set focus in my class file. What I want to accomplish is when the message is displayed I want the cursor to automatically proceed to the next box?? Can this be done? I have attached my example.
Code:
import mx.controls.Alert;
class Product {
var id:Number;
/*function Product (id:Number) {
getID(id);
}*/
public function getId () :Number
{ var userid=_root.id;
trace("your input is:"+ userid.toString());
mx.accessibility.AlertAccImpl.enableAccessibility();
_global.styles.Alert.setStyle("color", 0x4B8DEF);
_global.styles.Alert.setStyle("themeColor", "haloBlue");
Alert.show("Thanks for you input!");
userid.backgroundColor = 0xFFCC33;
userid.textColor = 0x696AC9;
//Sets the focus on the next txt box
Selection.setFocus(_root.Name_txt);
return userid;
}
}
Focus?
I have coded a game which starts with pushing the arrow keys on the keyboard.
when I implant this swf file in an html file and call this html file from another html file, it needs to be clicked with mouse first then pushing the keys(arrows) will work.
I might lost you, let me tell you this way.
a link in an html> makes > an html file which contains a flash swf file.
now this new window has been loaded, needs to be clicked then would be able to respond to the keyboard keys.
There got to be a way without clicking, I could gather the focus to the new window and flash file in the middle.
Any help please.
Help With Focus
This will be kinda hard to explain:
I have this problem with my thing I am working on.
I have two things that use the letter s.
I have an input box that processes things also known as "_root.input.text".
I have a movieclip that also uses the letter s, if you press it it goes to another frame. Well the problem is, I don't want to goto the frame if I pressed s in the input box.
So I set up the code:
if (Key.isDown(83))
{
_root.bg.gotoAndStop("sp");
}
I changed it to this:
if (Key.isDown(83) && _root.input.onSetFocus() == false)
{
_root.bg.gotoAndStop("sp");
}
and now it doesn't work.
I need it to check if input.text is selected, and if it is do not work when s is pressed. any ideas?
Post the correct code please, I don't have time to try to interpret your answers, anything that works.
Set Focus
Hi all !
This is my first post. I have switched to flash just 2 days before.
I have a button on click of which a textfields populates.
As soon as user clicks button focus should be on that textfields.
I am trying to make my small example accessible : i have written this code which sets focus to textfield:
Selection.setFocus(feedback);
But screen reader dosn't read text from textfield unless it is selected.
Any solution?
Thanks.....
Set Focus
I am developing a simple example in flash.
on click of a button i am setting focus to a dynamic text field.
its working fine. But the screen reader dosn't read text in it.
Setting focus is not the only thing, i think somthing more gas to be done. So that the complete control will go to the dynamic text field, and the screen reader will read it.
because after the focus goes to the dynamic textfield i have to do tab to go to the dynamic text field and then the screen reader reads it.
Always Get Focus
HI,
I have a little application with a dynamic text field and some buttons. I want that users dont have to click on the text field to start writting
How can I hold focus on the text field?
Thanks in advance.
|