Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Checking For Key PRESS Not Down



Sorry double thread post.



FlashKit > Flash Help > Flash Newbies
Posted on: 05-31-2008, 01:18 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Checking For Key PRESS Not Down
I need something to happen every time I press a button, let's say SPACE. Lets space pressing space shoots something, every time I hold down SPACE it keeps shooting. But I want it to only shoot when I press it and not if I hold it down. I am sure there is a simple way I am oblivious of,

Thanks!

Klaushouse

Button Press + Key Press Together In Perfect Harmony?
Well, i have been trying now for a while to get my buttons to display the corresponding number in a text box. I have achieved it so that if you click on the button with the mouse cursor it will happen. I can also do this for a keypress, but sadly they will not work as an either/or option. What actually happens is that the keypress is disabled until the mouse has activated the on release.
Here is the code:

on (release){
if (password == "") {
password = "1";
} else {
password += "1";
}
}
on(keyPress "1"){
if (password == "") {
password = "1";
} else {
password += "1";
}
}


Any suggestions will be greatly welcomed.
Thanks
Yoda

Combo Key Press, Double Key Press Ect
HELLO, this is common code for action "when u press key go to "frame""


Code:
if (Key.isDown(Key.UP)) {
_parent.gotoAndPlay("frame");}
i want to ask if any1 know code for actions:
1. when u press combo key UP and then key DOWN(down after up in like 0,5 sec or smth) goto "frame"

2. when u press 2 keys AT once (f.e. up+down arrows)

3. when u press key very fast twice - goto "frame"


GREETINGS !

[F8] Key Press To Mouse Press
The code below is a sample i want to change to onMousePress from keyPress. my attempts have not worked. come someone give me some pointers?


rat


PHP Code:




fscommand ("fullscreen", "true");
fscommand ("allowscale", "false");
Stage.scaleMode = "noscale";

stop();

// use spacebar to re-draw screen

var canvasArray = new Array();

for (var p in this) {
    var curCanvas = this[p];
    if (curCanvas instanceof MovieClip) {
        canvasArray.push(curCanvas);
    }
}

pressSpacebar = new Object();
pressSpacebar.onKeyDown = function() {
    if (Key.isDown(Key.SPACE)) {
        for (var i=0; i<canvasArray.length; i++) {
            var curCanvas = canvasArray[i];
            curCanvas.drawCanvas();
        }
    }
}
Key.addListener(pressSpacebar);

On Press Start Drag, On Press Stop Drag. How?
Hello i have an object that i want to drag and drop with the same event.

Something like on press start drag and on press again stop drag.

Anyone can help me?

I'm sure it's pretty simple with and if and else statment but i can't find how to do that...

The best i have done so far was this:




ActionScript Code:
on (press) {

startDrag(this);

}

on (release) {

stopDrag();

}

But i want to on press start drag then on press again stop drag.

anyone can help?



thanks

On Press Start Drag, On Press Stop Drag. How?
Hello i have an object that i want to drag and drop with the same event.
Something like on press start drag and on press again stop drag.
Anyone can help me?
I'm sure it's pretty simple with and if and else statment but i can't find how to do that...
The best i have done so far was this:


Code:
on (press) {
startDrag(this);
}
on (release) {
stopDrag();
}
But i want to on press start drag then on press again stop drag.
anyone can help?

thanks

Add A Movieclip On Button Press, Remove On Another Button Press...
Sounds a little confusing maybe, but the idea is rather simple... I'm trying to figure out a way to have a + and a - button. When a user hits the + button, a movieclip appears. If they hit it again, another duplicate movieclip appears next to the first, etc... basically adding movieclips along the x-plane. Now, when the user hits the - button, the movieclip on the furthest right-hand side is removed, when hit again the next movieclip furthest on the right-hand side is removed, etc until there are no more movieclips.

It's basically an add and subtract movieclip function but I have no idea how to set this up. Any tips or advice would be greatly appreciated! thanks in advance!

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.

Checking For Even And Odd Numbers
Hey-
does anybody know if there's a way in flash5 to check if a given number is odd or even?
Like...

Code:
if (myNumber == //an even value) {
// do something
}
Possible?!

Checking Angle
i'm trying to figure out a way to to get the angle that the cursor is to a movie clip. if the movie clip was the center of a clock and the cursor was at 3 o'clock, it would be 90 degrees, 6 o'clock-180, and so on...
anybody have any ideas?

thanks

dougc

Checking DOCUMENT_URI
Ok, here is a quick briefing on the situation. For quite a while now this little punk kid has stolen my copywritten work, be it flash files, pages, images, anything just to piss me off, then he brags to me that he had done it. I have put a stop to the remote loading with my .htaccess scripting and I was wondering if there was a way to check the document_uri in flash, whether using actionscript, or calling another script (last resort). What I'm wanting to accomplish here is in case he saves the .swf file and uploads it to a page of his own, the movie will check the document_uri of the parent frame, and if it is not one of my pages, it will not play (or play a rather rude scene). If it is one of my pages that the movie is on, then it will play normally. I have taken this kid to court once already and came back $3200 richer and it's just too much trouble to take him back, and I would just like to defeat him with knowledge by using actionscript like XSSI. If you know the actionscript, or know of a perl/php script that will do what I'm looking for, please help me out. Thanks in advance..

Another satisfied Flash user:
Matt

Checking Another MC's _x Position
What script do i put on my MC "bear" to get it to go to frame 2 whenever MC "claw" is at an x position of less than 90? I have buttons pointing left and right that move the MC "claw" over by ten pixels when they are pressed. I just want the MC "bear" to play once the user clicks the left arrow enough to put MC "claw" above the MC "bear". Thanks for any help. I'm trying to get better at Actionscript.

Checking For A File
I've not heard of a solution to this issue i'm having and have tried to cover my butt so I don't seem like a....well...you know what. Anyway, I want to check if a certain file exists in the same folder as my swf. I know in perl there is a

if(-e file.exe){
do this;
}

anyway..I know this isn't perl. I just was wondering if there is a command in flash that will return a true if the file exists or a false if it doesn't. Any help would be much appreciated.

Thanks

Variable Checking?
Can anyone please help...
I'm having a few problems with this
its taken from the actions on a frame on the end of a loop.
the loop being executed by the gotoAndPlay on the end if the score is less than 99.

----------------------------
if (score > 99) {
gotoAndPlay ("level2");
}
loops = int(loops+1);
score = int(score+hit);
if (score>0) {
score = score-1;
}
message = "not yet";
gotoAndPlay ("level1loopstart");

----------------------------------

the score routine check (score>99) just wont work...
the other incremental variables, like loops and score do function,
and display onscreen as numeric values in dynamic text fields.

I cant see whats wrong, can anyone help please?

thanks

Derek

Checking To See If A .swf Is Loaded
Can someone help me please?!!! I want a button to check to see which .swf has been loaded in my main movie. Then once it finds which one is currently loaded to go to and play the end of that .swf then load the new .swf of the respective button. Does that make sense? How do I do this? Thanks.

Checking For Visibility - How?
I am trying to make a menu-like thing.
There is a button I am using to show/hide another object.
And that is where the problem is.

How do you check if an object is visible?
Might sound like a dumb question but I am stumped.
No matter what I put, it just seems to ignore the condition.

Thank you for your time~

Variable Checking <=(
i have a problem wid checking a variable inside a text files.


Code:
on (release) {
myVars = new LoadVars();
myVars.load("nb_chk.txt");
myVar.onLoad = function(success) {
if (success) {
if (nb_checker == "1") {
gotoAndStop("notice board");
}
}
};
}
basically wha i want it to do is load a text files ( nb_chk.txt ) and inside the text file it has a variable called ( nb_checker ) inside the text file it has ( nb_checker=1 ) and what i want my script above to do is check to see ( nb_checker=1 ( this is inside ma text file ) ) equals to whats i got (nb_checker == "1" ( this is inside my swf file ) ) . I have also made sure that alll the variables and the text file r correct and i also made sure the file is in the right location... nothing is happening . anyone know why it's not performing this???

Checking SWF Vertion
I remember something where you can check the vertion of the users Flash Player by something like...

if($Vertion 6){
play
}else{
stop
}
}

I know this isn't right. But how would I write this. (I can't find $Vertion anywere in the refrence pannel.

Thanks

Checking Email
Hi
I was wondering if it was possible to put something on a portion of my site that enabled me to check my email. A friend of mine suggested getting something with php backend to check to pop3. I understand it, but no nothing about php and need guidance. Please send a link or a tutorial enabling me to check my email. (I have a yahoo account if it helps.)
Thanks a lot,

Checking TextWidth
I need to check the length of a textfield inputted from an input field.

I can check the length of a field by using this for example;
tempnum = testing.textWidth;
temptext = tempnum.toString();
rechts7 = temptext;

But can I do the following????

Got 2 dynamic textfields with var names rechts7 & rechts8, when the input of rechts7 is longer then 95pixels the following has got to go to rechts8 >> "@mydomein.com" because it's an iput field for email So it's a check for long emailadresses. If it's to long the field below email has to become also an email field, got it ..

Is it possible to do a check and action like this?

Checking Bandwidth
I need to know how to check a viewers bandwidth. Anyone know a way to achieve this?

go here

http://www.looplabs.com/

and click enter. It tells you your bandwidth. I need to be able to do this, but have no clue how. Anyone help? Or at least point me in the right direction? I'd REALLY appreciate it. Thanks!

Checking For Plug-in
How can I get my flash intro to check for a flash plug-in, then either proceed to the intro or ask the viewer if they want to download the flash player. I currently have an html page preceeding the intro that warns the viewer that Flash is needed for this site, and I have created a link to the flash download. I know there is a more elegant way of checking for plug-ins.

Checking Variables
I have four buttons in a movie clip, and i have an animation that plays on the main stage. I want it to play that animation, then based on which button someone clicked on go to a certain frame.

for everybutton i have:

on (release) {
set(click, "cd_bw");
_root.gotoAndPlay("wipe_box");
}

click being the variable that it's setting and "cd_bw" being the value. that's in the movie clip...

my if statement in the main scene is:

if (click="cd") {
gotoAndStop(15);
} else if (click="cd_bw") {
gotoAndStop(16);
} else if (click="ian") {
gotoAndStop(17);
} else if (click="tlg") {
gotoAndStop(18);
} else {
gotoAndPlay(19);
}

if i use numbers as the variables, it doesn't work, if i use text it doesn't work...i'm confused. Every time i click on something here it goes right to the 'else' frame. am i syntactically (is that a word?) wrong? or is it an issue with movie clips and actionscript.

thanks!!
~hodge

Checking If Theres Anything In A Level?
How can i check what movie is loaded into a particular level?

For example, say i have 5 buttons each loading a different external movieclip into level 1. I want to be able to include an if statement in the actionscript of the buttons to check if that buttons movie clip is already playing and if so, i want to unload it.

Any idea how i can check this?

Cheers

Checking Where The Playhead Is
hi All

i,ve developed a menu which drops down sub catorgories under the header catorgory and all other header catogories below will drop down the required distance! i've done this by embeding each header and drop down sub catogory in a movie clip of the above header

The problem i have is i want to be able to test whether a headers sub catogory is already opened or closed as i don't have much vertical space to work with i need to be able to shut some of the headers when opening another!!

i know i need something like a if/else statement but can't work it out. each movie clip has a stop action on frame 1 then frame 2-10 the sub cat drops frame 10 stop action and then 11 to 20 sub cat closes. so i need something to test where the playhead in the relavent movie is so i can determine if the subcat is opened or closed.

regards

jon

Checking To See If A .swf Is Loaded.
I'm loading a .swf into a mc called "page" on the _root. I have set a global variable called _global.aboutMeLoaded = false;. Once you click the about me button, it will set _global.aboutMeLoaded = true; Then it will load the .swf into the "page" mc. When you click another button, it should check to see which .swf is currently loaded into "page" then go to and play a certain frame in "page" to make the .swf fade out before loading the new .swf.

How can I accomplish this?
It needs to check to make sure the current .swf has been unloaded before loading the new .swf.

Please help.

Thanks.

Variable Checking.....help Plz
im having trouble checking a variable and then attaching an action based on the rsults of the variable check' this is what i have...

on (rollOut) {
if (_level0.var_check.section == definition) {
tellTarget ("_root.bnav.1_glow") {
gotoAndStop(1);

ive checked the vaiable and its being set correctly, the action assigned to rollout is not taking place..

any thoughts?

thanks a ton.

Checking Variables
What I want is for Flash to check a variable and then change a certain movie clip's colour depending on it's outcome.

This is my code at the moment:


PHP Code:



if (credit > 50000) {




Next I tried adding
PHP Code:



if (credits > 50000) {
}
.play(2)




And adding a different colour to the second frame of the movie clip, that didn't work so I tried.


PHP Code:



if (credits > 50000) {
}
.setRGB(603020)




And again nothing happened. Can anyone suggest what script I should be using so that if the variable credits is greater than 50000 a movie clip changes colour?

Checking Requirements...
on my site requirements page (enter page) i would like to display a tick or a cross next to each reccommended requirement. i would like to check:

If they are usin flash 6
if they are using IE6
if they are using 800x600 (minimum)

how could i do this?
thanks a lot
jh

Checking Cache
Hi - is there a way to check if a JPG is cached to the drive (image loaded by an html page, not by a swf) ??

Ed

Checking For New Data...
http://www.swgfreak.com/k/chat.swf

Take a look at that chat project im working on. Everything works except the chat dialogue doesn't refresh. My code for it looks something like this:

Code:
var c = new LoadVars();
new_mes = new Sound();
new_mes.attachSound("beep");
setInterval(LoadMessage, 500);
function showValues() {
if (_root.chat<>this.chat_from) {
new_mes.start();
}
_root.chat = "";
_root.chat = this.chat_from;
}
function LoadMessage() {
c.load("from.php");
c.onLoad = showValues;
}
The setInterval doesnt seem to work. Is there another way to make that text box refresh every 3 seconds or something. Right now the only way to see updated text from the .dat that the text is stored in is to close your browser and reopen it.

Checking Year
i have a year combobox that is part of year,month,date. its being used for the user to input a date up to 45 days in the future. i need to check that the year the user inputs isnt illegal.
i know how to check that they havent put in a past year, or a future year, the problem is that if its december 30 and the user looks for a date 45 days in the future, it will then be the following year and i will get an error msg. thats where im stuck.
any advice anyone?

Checking Variables
Hi all!

I have a site currently in build, where I have 3 buttons on the main time line....that on(release) each set a variable (ie. button 1 sets panel="digital", button 2 sets panel="creative", button 3 panel="ebusiness".) Then they each trigger a separate movie clip to play until it reaches a stop(); (ie. click button 1...panel="digital"....digital movieclip plays)
Next when say button 2 is clicked....I want digital movieclip to play out and then make the creative movieclip to play in....but its not doing it?

On the last frame of each movieclip that plays out, i have a if-else if setup going which quiries the value of panel (the variable being set by each button on release)...but for some reason the if-else statements within the movieclips arn't picking up the value of panel set on the main stage?...although I know they'll work ok if the if-else statements were on the main stage.

This is what I have at the last frame of the movieclip:

if (panel=="digital") {
_level0.gotoAndStop("Intro", "digipanel");
} else if (panel=="ebusiness") {
_level0.gotoAndStop("Intro", "ebuspanel");
} else {
_level0.gotoAndStop("Intro", "paneloff");
}

Im all out of routes to try so any help is much appreciated.

Thanks in advance

Andy

Loadmovie Checking ...
Hi, I just wanted to know if theres a way to have a script check if my emptyMc contains a movieMc and if so, unload it ..


>>Heres the Scenario:...

I currently have a mainMc calling a menuMc which in turn calls in other sectionMc(s), now, when I just put this script on my frame

_root.sectionMc.unloadMovie();

I get an error saying can't locate file, which is understandable because the file (swf) isn't loaded on the sectionMc unless I ..


on (release) {
gotoAndPlay("section");
}
on (release) {
_root.sectionMc.loadMovie("section.swf");
}


Keeping in mind that I have multiple sectionMc(s) [with specificMc names] that my menuMc is calling into which are located in my mainMc, can I have the code do a check and see if the sectionMc(s) are empty or not? and if they are loaded to unload them?

on that note: is it advisable to have the sectionMc(s) loading on one emptyMc or specificMc(s) like I have?

Checking For Flash
Hi

I am working on a project where there has to be an option of flash or no flash.

Is there a simple script (in asp vbscript) that will allow me to check for the plugin, and if it is not available to display an image instead?

Many thanks

Digga

Checking For An Error?
Hi guys,
Hopfully this will be quick and simple.

I am trying to validate a URL that is a link to an image to be loaded into flash.
Just now i have a text field that the user can input the url and a button to check that there is an image(button loads image into a new mc"geturl").
This works, but if there is a mistake or there is no image linked to the url i get an error in flash output window "error opening url http://blah blah". Howcan i turn this error into an ouput in flash instead of the ouput window.

cheers
Paul

Checking A String
I have a text field where the user needs to type a time "9:07".


Code:
if (_root.checklist.time1.text == "9:07"){
_root.gotoAndStop("cResp5");
}else{
nextFrame();
}


But what if the user types in "9:07 a.m" or "9:07am" or just has an extra space at the end? Is there an efficient way to check to see if the user wrote the correct time even though they may have an extra elements in the string? I could write a bunch of "or" statements but I thought there must be a better way. Any suggestions are appreciated.

Copyright © 2005-08 www.BigResource.com, All rights reserved