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
FlashKit > Flash Help > Flash ActionScript
Posted on: 12-22-2005, 05:29 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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
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
[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...
How Do U Get Something To Stay Up When U Press A Button?
how do u get something to stay up when u press a button?? say i press a button, then something pops up somewhere else, doesnt matter what, it just pops up and stays there...i need to know how to do that. see i can get it to stay there as long as my mouse is over the button but when its not i still want the stuff to be up after i pressed the button. plz help.
*for example scroll over the "I" on my site: http://24.214.78.173 (when its up, its ran off of my computer) it should show you my profile that comes up on the right, and when you take your cursor off of it it goes away. now i want that to stay there even when you dont have your cursor over it.
Thanks,
Flashboy311
Double Button Press
I want to assign a property to a button so that when it is press once a movie clip will show, lets call it A, and then when it is pressed again movie clip B will show.
Is this possible?
Multiple Button Press -- Can You Do It?
i'm building a music mixer... i assigned each track to a seperate button to switch it on or off, and it works well. it gets trickier, hwvr, when i want to be able to flip multiple tracks on or off at the same time...
it appears that i cannot press 2 buttons at the time... in other words pressing button1+button2 != press "button1" and press "button2", but press "button1+button2"
that's fine, i accept that. but how can i differentiate them as invid keys? is there a workaround?
PLUS, i am generating these keys dynamically, as well as there will be 2 to say 10 keys, so it must be a dyanmic checking function of some sort. any help or direction would be greatly appreciated.
thanks,
jwt
Moving Mc's On Button Press....
I have a draggable mc, and i would like to be able to press a button, and have it move the mc back to a default set of co-ords.
Example, mc starts at x=50 y=100, user drags it so anywhere else, then presses button and bang, mc is back at x=50 y=100.
I dont want the mc to visibly move, just go from its current co-ords, straight to the default ones.
Ive tried using the _x; _y; parts of action script, but havent been able to use them succesfully yet.
Thanks in advance,
G
Simulate Button Press Possible?
Hi.
Does anyone know how to simulate a button click in Flash MX?
I'd like to see some actionscript that would result in the release event being raised (i.e. on ( release) ) such that the action associated with the button are executed. But without physically pressing the button.
Thanks in advance.
PS: Something called Qscript has such a capability
Button Press State
I want to create a button that once when pressed stays in another color or image until another button is pressed and only then returns to its original state. Probably very simple but i can't seem to get it work properly. Hope someone can help
Replicate Button Press
Hello.
Is there a way o simulating a button press without actualy pressing the button and also simulating the _x & _y of the mouse cursor when the button is supposed to be pressed ???
sounds weird hey !!!!!!!!!!!
Button (on Release) Or On Press...
Not very good with flash, and I want to be able to make a button. The button and its animation is already done. I just want so that when I click the button, it jumps to the next scene... Any simple ideas or tips please?
Thanks alot in advance!
I Press This Button.. But Nothing Happends
Ok, this is how it is: I don't have a clue of how you make a button and press it and then you can go to another scene. Take this for an example: I create one scene, with 1 button (no matter if i´m gonna do a movie or not), And when i press it, I want to come to another scene! And why doesn't that work? I use "Goto" or what i called on the button.
Help me on this please, It would do so much!
Mouse-button-press
hello,
I´ve made a button. Every time I push it I want a piece of graphic to start move, and it does. My problem is that it only moves when i press the mouse button down...then it stoppes. I want it to move all the time while I keep the mousebutton down...can someone please help me with this!?
I´m not an expert at coding so please keep it simple, if you want...
thx / jan
OnFrame Press Button
OK, I searched for how to do this, but couldn't find anything.
Is there a way to have a button pressed by flash once you enter a frame. Sounds kinda stupid, because I could just run the code that is attached to the button... but... well its hard to explain.
I was thinking something like:
_root.onEnterFrame=function(){
press.'buttonName'};
One Press Scroll Button
I have made a very basic scrollable movieclip (one MC, one up button, one down button). Nothin' fancy.
I have got it to work (sort of), but there's one last thing I can't get to work.
On the (up) button I have a basic action:
on (press) {
tellTarget ("mc") {
prevFrame();
}
}
(and nextFrame for the down button).
What I would like to for the user to be able to press the button and hold, and it scrolls. At the moment, it just goes to the 'prev/nextFrame' and stops, so you have to keep clicking to get to the top/bottom.
Any way this can be done without being too hardcore about it? Any and all help appreciated.
On Press Button Problem
I have a scrolling window that I want have the on press function that enables you to hold the button down and keep it scrolling. As apposed to presently needing to click the button everytime for it to move one frame.
My current script is as follows:
on (press) {
tellTarget ("/scrollingtext") {
nextFrame();
}
gotoAndPlay("down6");
}
any help would be great.
D
LoadMovie On Button Press
I'm attempting to create a portfolio site that will have multipule buttons that when pressed will load that particular movie onto the stage.
Since any of these movies may be the one loaded my problem is getting a mulitiple number of possible movies to unload before loading another.
So if you click "Pro 01" should I just put on that button:
on (press) {
unloadMovie(Pro 02);
unloadMovie(Pro 03); etc...
}
loadMovie(Pro 01);
or will unloading something that isn't loaded cause problems.
-thanks in advance for any help.
Can I Inforce A Button Press?
say i have a movieClip with instance name : part1
and inside that movie clipt i have a button called : button1
where the button "up,over,down,hit" all have there own graphics that change accordinlly!
what i want to do only by code is for example :
_root.part1.button1.over();
and it will show like that button had an over of a mouse!
is it possible?how?
thanks in advance
peleg
Using ActionScript To Press A Button?
Is there a way to have actionscript trigger a button in a flash movie? Like if I had a button with the code:
on(release) {
trace("You Pressed me!")
}
Would there be a way to just trigger this button without ever moving the mouse? I dont know if its possible, but if you know please help.
Thanks in Advance
GotoAndPlay And Button Press
i have a MC which i press on and has the code
on(press){
gotoAndPlay("Scene2"); / go to another scene
}
but it isnt working!!!
why?
thanks in advance
peleg
Rollover, Then Press A Button, Not The Other Way Around
these are the two ways I am trying? For it to work now , you have to hold "o" and then you rollover, for it to work. I wavnt to be able to press "o" whenever you want, as long as the mouse is over the button. What am I doing wrong?
Code:
on (rollOver) {
_root.cursor.cursortext = "letter";
trace("gorilla");
if (Key.isDown(48)) {
trace("monkey");
_root.c_found = true;
_root.c._visible = false;
}
}
onClipEvent (enterFrame) {
if (Key.isDown(48) && _root.c.hitTest(_xmouse, _ymouse, true)) {
trace("monkey");
_root.key_found = true;
_root.c._visible = false;
}
}
2 Movieactions With One Button Press
I want to create a flash site with 5 buttons (A,B,C,D,E). Each buttons is connected to a movieclip(= a graphic with a tween
).
When I press button "B" then movieclip B comes from the rightside in the head scene in the middle. That action I create with on (release) {_root'name'mc.gotoandplay();} but then...
When I press another button "E", then I want that the movieclip, who's at that moment on the head scene, goes left away and the new movieclip "E" comes from the right side
I search a example "tutorial" where I can see how it is made.
thanks
Flash Button Press
I have a button instance named btnGetImage. Is there any way to force the button press event to take place? I tried just btnGetImage.press() but with no luck.
|