Timed Button Press Changes Frame...
I have a project where I need a button that has special behaviors. I want it to send the user to a specific frame once it has been pressed for two seconds.
If they let go before the two second count is up, the clock resets and a custom message pops up.
Is this possible?
ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 01-24-2005, 11:23 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Navigating To Another Frame On Button Press
I need to know how to get my flash movie to goto the first frame by pressing the space bar i tried lots of tutorials and none of them seemed to work, i am using Flash MX can anybody help me?
Playing Until Certain Frame On Button Press
This must be simple stuff for u guys and dont know where to post it really but anyway...
Say i got 2 circles. Both the circles are buttons, but are part of the same movie clip (circles_mc), and are being moved frame by frame to a position just right of them, until in 20 frames they are the whole way across the stage, frm far left to far right. Now what im trying to do is when the first circle (button) is pressed, the movie clip plays until frame ten, and when the second circle pressed, the movie plays all the way to frame 20.
What im trying to use atm are loadsa boolean vars. This is what i got atm...
On the first frame of the mc:
Code:
var check:Boolean = false;
if(_root.circles_mc.check == true) {
play();
}
else stop();
On the 10 frame of the mc:
Code:
var checkhalf:Boolean = true;
if(_root.circles_mc.checkhalf == false) {
stop();
}
else play();
and on the 20th
Code:
stop();
then button1:
Code:
on(release) {
_root.circles_mc.check = true;
_root.circles_mc.checkhalf = false;
gotoAndPlay(1);
}
and finally buton 2
Code:
on(release) {
_root.circles_mc.check = true;
_root.circles_mc.checkhalf = true;
gotoAndPlay(1);
}
However, this does not work the buttons dont do anything at all...
Any suggestions?
Thanks for your help,
esurio
Random Frame In A Mc An On Press Button
I have 5 mc (g1, g2, ecc..) in tha main stage, copy of a same instance.
Inside the mc istance, there are 9 labeled frames("uno", "due", "tre", "quattro", "cinque", "sei", "sette", "otto", "nove").
First of all i say what i would like to happend. The mcs (g1, g2, ecc) have to play frame randomly, but just the first three labeled frames. On press of one of the 5 button (button are in the main stage _root) they have to play randomly others three labeled frames. But not all 5 mcs, just four. The only one above the pressed button, has to do something different.
well... now the script.
I have made an array for each three "class" of labels:
inizio = new Array("uno", "due", "tre");
tocco = new Array("quattro", "cinque","nove");
tocco2 = new Array("sei", "sette", "otto");
inizio is the array has to play when movie play withot pressing buttons
The others two play on press.
Inside mc, at the end of every labeled frame, i put:
_root.playing=false;
On the main time line of the _root i bilt the arrays:
inizio = new Array("uno", "due", "tre");
tocco = new Array("quattro", "cinque","nove");
tocco2 = new Array("sei", "sette", "otto");
On a control mc i put this:
onClipEvent(load){
_root.playing=false;
}
onClipEvent(enterFrame){
if (_root.playing == false){
_root.playing = true;
_root.g1.gotoAndPlay(_root.inizio[random(_root.inizio.length)]);
//and the other four mcs...
if (imput == 1) {
_root.g1.gotoAndPlay(_root.tocco[random(_root.tocco.length)]);
//and the other four mcs...
}else{
_root.g1.gotoAndPlay(inizio[random(inizio.length)]);
//and the other four mcs...
}
}
}
But the random play like the arrays don't exist... and the value on the button are ignored... help please
PS i know the if onditions (they must be 5 but i put just 2) might be wrong... How can i write propely five if?
Controlling Frame Rate Through Button Press
Can anyone advise me on how to control the frame rate of my movie through button presses? I have a movie clip (slide4) on the timeline. The timeline has a stop on it so the mc is looping around the frame. The movie has a framerate of 24.
I have another movieclip within this one (timer) with the following code on it:
onClipEvent (load) {
_parent.stop();
startTime = getTimer();
function checkTime() {
_parent.stop();
currentTime = getTimer();
if (currentTime-startTime>=(1000/(framerate-1))) {
show = 1000/(currentTime-startTime);
startTime = getTimer();
_parent.Play();
}
}
}
I also have the following code in the first frame of 'slide4':
timer.framerate=12
When this frame is reached, it just gets stuck and doesn't go any further. Does anyone else have any suggestions?
Thanks!
Load External Movieclip Frame On Button Press
Download my .zip fil and open maintest_Scene 1.swf and youll know the problem.
My movie clip loads, but in the wrong spot and I need it to open Frame one "halsub" of work.swf when the button Drive Options is pressed.
Timed Frame Play
Hello guys! Good day to ya'll! I need your help in creating an actionscript for this situation:
Let's say I have a flash movie done with Flash 5 and I have frame 1 with a "stop();" command, but I want it to got to frame 2 automatically after 10 seconds.
Is this possible? Can anyone enlighten me with an actionscript for it?
Thanks guys! I'd appreciate all the help ya'll can give me! ^_^
you can send the actionscript if you want to "firstblood@edsamail.com.ph"
THANKS AGAIN SO MUCH!!!! ^_^
Timed Frame Advance
I have an swf movie (like a slideshow or photoalbum type) that I would like the user to be able to either step through using the next/back buttons or opt to use an auto button feature- that on release would start advancing thru the swf automatically- each frame at a 10 second intervals. Is there a way to script this using Actionscript 2.0? Thanks for any assistance.
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!
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
Timed Button (Waiting)?
Hi,
I have a movie in which there are a few buttons.
Heres how its built:
I have all the buttons on one layer.
I have all the text on one layer.
I have the transition on one layer.
Anytime someone clicks a button, I have faderMC, which is the transition movie clip, gotoandplay(2).
In addition to having the button play faderMC, I want it to check on the progress of faderMC, and when faderMC reaches frame 30, I want to have the main movie gotoandstop on frame 70, if that makes sense.
Basically, when someone clicks the following should happen:
1. faderMC plays
2. check to see if faderMC if faderMC has reached frame 30
3. if faderMC has reached frame 30, the main movie goes to frame 70
This is all I have so far:
on (release) {
faderMC.gotoandplay(2)
}
and then I need something along the lines of
if (faderMC.frames.30) {
gotoandstop(70)
}
but it needs to make sense, lol.
Any help would be greatly appreciated!
Thanks!
-Alok Wadhwani
How Do I Detect A 'timed' Button Release?
Problem: I need the user to hold a button down for 3 seconds, if they let go before the 3 seconds is up an error message will appear.
Question: How do I go about detecting if the user has lifted off the button within the 3 seconds and trigger an error message?
Many thanks in advance.
On Press Go To Frame
Hi,
I have a very simple flash movie, with say, about 10 buttons. Each one you click on goes to a different frame. (where a MC of an image flies in) Slideshow type.
The problem is, if I click on btn#1 it goes to frame 1, as it is suposed to, however, if I click on btn#1 again, it goes to frame 2.
Basically if I click on any button twice in a row, the second time I click on it it goes one frame ahead. If I click it a 3rd time, it goes back to the one it was suposed to go to.??
Does anyone know of a away to fix this?? Here's the link, click anyone of the top buttons 2x (even with a pause) and you'll see what I mean.
comps.aspenms.com/iconnect
Thank you
Advance Frame With ANY Key Press
Does anyone know how I can have a button that when you press ANY key it will advance to the next frame - I seem to only be able to actually assign one key such as space bar or return/enter etc - I need it that they can hit ANY key - this is REALLY urgent for a project I have to do tonight - please please help if you can!
Thanks everyone
Jonathan
Any Key Press Goto Next Frame
Hello there,
I'm working on a simple presentation. The presentation will animate and then stop. The user will talk. The user will then press any key and it will mov eonto the next frame. Stop. Talk. Press any key. Onto next frame etc etc
I'm really struggling with the 'press any key goto next frame' bit. Can someone tell me how to do this really, really simply. It used to be easy in Flash 5, but MX looks like it's written for experts.
Thanks in advance...
[F5] Press A And Win 2 Frame Game
I'm making a game where it stops on frame 1. When I press A it goes to frame 2. On the first frame I drew an A with a brush and made it a movie clip. I have the following code in my A movie clip.
Code:
onClipEvent (enterFrame) {
if (key.isdown(65)) {
gotoAndStop (2)
}
}
It doesn't work and I want to know why. It's probably missing something simple.
I'm using Flash 6 in Flash MX. That version selection thing confused me.
Escape Key On Press Go To (frame)
I have a flash presentation that has a rather long opening so I want to place an event listener that lets me hit the escape key and gotoAndPlay frame (378), I get a syntax error, any one have an idea what the problem is?
var hotkey:Object = new Object();
hotkey.keyPress"<Space>" = function(eventObject:Object){
this.gotoAndPlay(378)
}
this.addListener(hotkey);
Buttons Jump To Next Frame On 2nd Press
I have a very simple flash site set up in as2. The buttons are done using instance names in the actions layer. However, I am finding that if you press them a second time, they'll jump to the next main frame (which isn't the frame they are set to go to). Any ideas on why they are doing that? Do I need more stop actions or something? (I am not that great at actionscript but am trying to do this properly, without putting the code on the buttons).
I have attached my button code. Each main keyframe has a stop action in it.
Here's my site link:
http://www.whispernotjazz.com/staging/
Many thanks for any help you can give!
Attach Code
//LINKS FOR MAIN BUTTONS - ACTIONSCRIPT 2 CODE
stop();
home_btn.onPress = function(){
gotoAndPlay("HOME");
}
Home_bioCircle_btn.onPress = function(){
gotoAndPlay("HOMEbio");
}
group_btn.onPress = function(){
gotoAndPlay("GROUP");
}
reviews_btn.onPress = function(){
gotoAndPlay("REVIEWS");
}
clientlist_btn.onPress = function(){
gotoAndPlay("CLIENTLIST");
}
Slow Frame Rate On Key Press?
Im trying to add a slow motion feel to a game (like bullet time), when the player presses a key, however, I cannot find any answer whatsoever.
so if anyone knows the answer, please tell me. thanks.
Key Press Funtionality With Frame Labels
I have a question, I am in the process of creating a flash presentation that I have to intergrate a keyPress left and right, but also have a nav system that if you click on the title it will take you to that frame and play it.
Here is how I have this layed out...
I have set up the main nav as Nav_mc. It contains 20 different titles that have to when pressed gotoAndPlay an animation in the presentation e.i.(areil view, view from 400 etc...)
So, my question is two fold... adding the function to the mc is not a big deal no problem, but I usually use labels when I do this and if I am using a keyPress function Left and Right to go to the the next animation and play it, I am having a little trouble grasping how to set up the key press so that if you pressed it left it would go to the next fram label and play that and vis-versa.
so if I do this...
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDow(Key.LEFT)){
_root.main_mc.gotoAndPlay("This would plat previous animation");
}
}
Key.addListener(keyListener);
var keyListener:Object = new Object();keyListener.onKeyDown = function() {
if (Key.isDow(Key.RIGHT)){
_root.main_mc.gotoAndPlay("This would play the next animation in sequence");
}
}
Key.addListener(keyListener);
I am now using a label to direct the press of the navagtion to go to that frame and play the animation. I am not sure on how to code the keyPess to have it do the same thing.
any suggestion or is there a better way of differnet way to approach this?
Aaron
Slow Frame Rate On Key Press?
Im trying to add a slow motion feel to a game (like bullet time), when the player presses a key, however, I cannot find any answer whatsoever.
so if anyone knows the answer, please tell me. thanks.
On Press In A Frame, Not On A Movie Clip
I have a frame where I have actions for a certain clip,
I can get it to do things like this
circle.onEnterFrame = function (){
I was curious is there anyway I can do something like
circle.onMouseDown = function (){
or
circle.onClick = function (){
or anyway i can get that code into that frame instead of on the movie so that it is less confusing
On Stage Pressin Button..works, Test Movie, Press Button Dosent Work
i really need some help on that, it's really annoying me, on the stage i enable simple button and simple frame actions, then i click and it goes to the specified frame, but when i go and test the movie and click on the button, it just sits there, i've tried everything, any ideas?
Changing The Function Of A Button Depending On Previous Button Press
Hi all,
this problem has been stressing me out all day! (its probably extremely simple, but i can't get my head round it)
I was wondering if anyone can help me, I'm loading in 5 jpegs from an external file using "loadMovie" and i have 5 corresponding buttons (1-5) to load them with.
I want to change the jpeg the button loads in depending whether a separate navigation button has been pressed -
i.e.
navigation buttons:
-motorbike pics
-car pics
-lorry pics
If a user clicked on "car pics" then the loading buttons 1 to 5 would load "car1.jpg", "car2.jpg" and so on...
similarly if the user clicked on "lorry pics", the same loading buttons 1 to 5 would load "lorry1.jpg" and "lorry2.jpg"
any help and code snippets would be greatly appreciated!
Thankyou!
Recording Button Instanec Names On Button Press
Hi,
I have a number of different buttons in a scene each with different instance names. On pressing any one of these buttons the program moves to the next frame.
I need to record the instance name of the button which is pressed. Currently on each button i have code which on (release) sets a variable 'name' equal to that button instance. ie for the button whose instance name is 'james' i have:
on(release){
name = james
nextFrame()
}
I want to increase the number of buttons and do not want to have to manually write code for each button.
Is there a way in the main scene to get actionscript to find the instance name of the button which is pressed so that for any button press the name of that button can be saved?
many thanks
john
[AS 2.0] Simulated Button Press Of A Dynamically Created Button
hey gang:
i have a set of buttons cranked out from and XML file.
how can i emulate, in code, a press on one of those buttons? i'd like to 'press' one of them for an initial state so that the list it controls will load first off instead of waiting for the person to click it manually and THEN show the list it's connected to. thing is, the first loaded list is going to be random, so i need to 'press' what on another day/load would be a button that the user would press themselves.
in other words, i have 3 buttons. on random, i have to 'press', say button 2, to start. users can press 1 or 3 and then 2 again if they like. another time, it's button 1 that gets 'pressed' on load, etc.
make sense?
i have a sneaking suspicion it might be easy... or stupidly convoluted.
WR!
[F8] Replacing Button With Movieclip On Button Press
Hello.
I am kind of new to flash and very new to ActionScript so please help me with this script which probably seems easy for many of you.
I am attempting to create a simple game on flash.
I have a button on stage. The buttons name is "diff1".
I need it so that when the button is pressed, it replaces itself with a movieclip or graphic called "diff1_2".
"diff1_2" needs to be in the exact place where "diff1" was.
If this is any help, these are the X and Y coordinates for the button, "diff1":
X: 466.0
Y: 344.4
I need the button to be replaced with actionscript and not with frames.
Please help me and reply back with a code and tell me where to place the code.
Early thanks for those who reply!
Why I Need Press Button Twice
Why Actionscript write _root.chois variable, only if i click on button twice... i dont like that, because then will open two windows, but i need just one....
If something in text is understanding, pliis telme... because i speek english bad....
I hope, you will can help me... thx
on (release) {
_root.choisfile();
}
function choisfile(){
getURL("javascriptpenWindow('chois.php',100,300) ;");
loadVariables("http://161.lursoft.lv/~guntis/temp/open.conf","_root");
while(_root.chois==""){
loadVariables("http://161.lursoft.lv/~guntis/temp/open.conf","_root");
}
_root.menu.file_name=_root.chois;
}
_root.menu.file_name is a textbox,
_root.chois return text, whoose i put in textbox, and whuse making in php with user chois...
Get Url On Button Press
hello,
can someone tell me if it is possible and how to getURL when a certain button is pressed.
thanks,
rplmri
Press Button Twice
I have a project. In this project there is a movie clip for a menu. I have a button placed on the main timeline. When this button is clicked, the menu is scrolled out. What I want is if the button is clicked again, then the menu will scroll back to a hidden state. Basically, the code that I have on the button is:
on (release) {
menulist.gotoAndPlay(2);
}
In the menulist movie clip I have a motion tween of the menu moving out.
How can I go about making the second click possibly go to and play a later frame that contains a motion tween of the menu moving back to a hidden state? Should I have a true/false statement? I have looked at some examples, but nothing seems to jump out at me as an answer.
Thanks.
On Button Press...
on button press... i want a movieclip to go to a specific x and y within the swf.
i have a drap drop thing going on and want a 'clear' button which returns the moved objects back to there original place, so was thinking setting them to return to there original x and y co-ordinates!
how do i tell the mc to go to a specific x and y?
Button Press
hello. im trying to maintain a HIT state in my button (which opens a pop up) after it is released, so that the user is able to identify which buttons have already been pressed. Thanks.
(samples/photos)
www.landslideinteractive.com
On Button Press
is there a way of creating a generic code to add a sound to a button press without adding code to each individual button?
rat
[F8] Having To Press A Button Twice?
Hi
I'm currently working on our companies website re-design. I have a problem in the portfolio section. (I have striped out just that movie and link to fla file is below). Could someone help me understand why it takes 2 clicks to get from the catalogues section to the advertising section? I was going to do the sections in their own movie with this portfolio movie, but decided that because I only needed 4 sections, I just ran them onlong the timeline. Is this whats screwing it up.
http://www.fullfatdesigns.co.uk/flas.../portfolio.fla
Any help greatly received.
Thanks
Wayne
[F8] Press Button Twice?
My pc client is telling me he has to click twice on buttons to make them work? What's up with that?
Thanks, I have no idea what to tell him.
[F8] Button - On (Press) XML URL
I'll just say this now, its late and spelling correctly is optional. :-)
Ok here is the senario.
I have a flash that gets information via a XML file - (function)
That function sets a root variable using
PHP Code:
_root.txtNumber = xmlData.childNodes[0].firstChild.nodeValue
tract(_root.txtNumber)
now here is my delima if i trace it right after set it shows the value
but if i trace it right after the XML function is called unidentified value
PHP Code:
loadXml();
trace(txtNumber);
any suggestions.
Button Press
Anybody help me...
In as3, When i pressed a button for a few seconds.., i need a trace...
Button Press Bug (?)
When you press the hotspot (the yellow circle) the whole animation is not shown unless you press it long enough. How can I make so that it shows the whole animation, without stopping when i release.
Press here please for entering my website, and check out what i mean.
Thats all, thanks.
Button On Key Press ?
Hi, I want to do a button lets say with instance name btn_1 to take me to the next frame when i press on it OR when i press the LEFT key
any ideas ?? anyone ?? thanks
To Press A Button Twice ?
hey,
I've a button that unloads a movieclip when I press it, ok that's no problem so far...
but how can I load the movieclip in my instance again by pressing the same
button twice ???
thanx, already
Press Button With AS?
I know theres a way to do this but i dont remember how again. Anybody know how to press a button with AS, something like this:
ActionScript Code:
onEnterFrame = function(){ if (yourmom = "hot"){ somebutton.press //<- this }}
Button Press
I want to start my movie with a button in the pressed state. Any suggestions on how to do this? I have it so it look like it but when you press the other buttons it does something weird. I want the movie to think that the home button was pressed already.
http://flat22.com/hzsponsor/hzdvd.html
On Press. Button Help
I have 2 simple buttons, with black color. I whant to do that when I press a button it turns to red. but when I press the other button it turns to red but the other button that was red will turn black.
how to do this thanx
Button Press
OK, i think this an easy one.
I want to have a button with a rollover state that is different that the out state. I got that part, but I also want to keep the rollover state active if clicked. I can think of a couple ways to do it but I'm certain there is an easier way to do it. I have about 8 buttons and when I click on on I want that to stay in the rollover state, then when I click on another one I want the first to go back to the out state and the new one that I clicked to go to the over state and stay there.
Any thoughts?
Josh
To Press A Button Twice ?
hey,
I've a button that unloads a movieclip when I press it, ok that's no problem so far...
but how can I load the movieclip in my instance again by pressing the same
button twice ???
thanx, already
To Press A Button Twice ?
hey,
I've a button that unloads a movieclip when I press it, ok that's no problem so far...
but how can I load the movieclip in my instance again by pressing the same button twice ???
thanx, already
Press...button
I created a container, and used this actionscript so that when this movie clip created through actionscript is clicked it moves to another function:
var pl2 = scene.getChildByName("plane"+j);
pl2.container.addEventListener(MouseEvent.ROLL_OVER, RollOver);
pl2.container.addEventListener(MouseEvent.ROLL_OUT, RollOut);
pl2.container.addEventListener(MouseEvent.MOUSE_DOWN, Press);
pl2.container.buttonMode = true;
how can i apply this to another movie clip aswell? For example got a closebtn which i inserted into the stage, and want that it has the same function when clicked as the container. N.B. the container script is written in a .as while button create in .swf! Thanks
To Press A Button Twice ?
hey,
I've a button that unloads a movieclip when I press it, ok that's no problem so far...
but how can I load the movieclip in my instance again by pressing the same
button twice ???
thanx, already
A Button That Changes Color After Press...?
How do you do this? I want to be able to assign on mouse event actions to the button as well, so embedding it inside an mc is out of the question (since you can´t give buttons instance names). I´ve come across this problem several times... please give me a hint...
|