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








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;
}
}




FlashKit > Flash Help > Flash ActionScript
Posted on: 06-08-2004, 02:57 PM


View Complete Forum Thread with Replies

Sponsored Links:

Button Stop Rollover After Press
Hi,
I have a button that moves up in the _y as the mouse rollover and moves back down on rollout. The problem is that on press I want the button to stay up, but the rollout code always executes. I try using a flag in the rollout that says if the button has been pressed than avoid the rollout code but it still does it.
is there a way to code something that would tell the button to forget about the rollout code?

View Replies !    View Related
Button - RollOver, RollOut, And Press ?
Ok.. I need some help here. I have a button, which is actually a movie clip. Here is my actionscript for it:

on (rollOver) {
gotoAndPlay(2);
}
on (rollOut) {
gotoAndPlay(31);
}

Basically when you mouse over the button it tweens larger, and when you mouse out it tweens back to original state.

Thats good and all BUT now how do I add a on (press) event that if pressed and then you roll your mouse out it doesn't run the rollOut actions????

Thanks!

View Replies !    View Related
On Press, Button Stay On Rollover Effect
hi guys,

is there a simple code that, when clicking on a button, the button will hold on the rollover effect to show it's been selected?

thanks

View Replies !    View Related
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!

View Replies !    View Related
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

View Replies !    View Related
It's Often A Long Way From 'press' To 'rollOver'...
This problem might be a little bit tricky, I hope someone can still solve it though: I attached a .fla with four buttons in a movie clip. Since it was initially created by meglomor, a valued member of the flashkit.com society , it is working just fine; I just wanted to know whether someone could convert the actions that occur "on press" to "rollOver" and "rollOut" actions.

In other words:
Once I rollOver one of the "buttons" it should perform the current "active" part, and once (THIS IS WHERE THE DIFFICULTIES START!) I rollOut of one of the buttons it should perform the "goback" bit, which currently just happens when another button is clicked on.

(Please don't tell me about the difference between movieclips, buttons and invisible buttons again. I'm very well aware of the difference!)

View Replies !    View Related
Problems With On(press) And On(rollOver)
hello all.
i'm having a problem concerning the functions on(press) and on(rollOver).
i have a movieclip (text.swf) that contains text (which is also a movieclip) that can be scrolled up and down with two buttons. the text movieclip has the following code:
onClipEvent (load) {
oben = this._y;
mask = 10;
unten = -this._height+mask;
speed = 20;
_parent.up = false;
_parent.dwn = false;
}
onClipEvent (enterFrame) {
if (_parent.up) {
if (this._y<oben) {
this._y += speed;
}
}
if (_parent.dwn) {
if (this._y>unten) {
this._y -= speed;
}
}
}

and the down-button has the following script:
on(press){
dwn=true
}
on(release){
dwn=false
}

and the same script lies on the up button but instead of dwn it says up.
up to this point everything works fine when i preview the film.

now i would like to load this movieclip (text.swf) into another movieclip.
this script is on the first frame:
loadMovie("text.swf", "_root.container");

as you can see the movieclip "text.swf" is beeing loaded into a movieclip with the instance name "container" even up to this point there are no problems and everything works the way it should. but now i would like to have the option that i can drag the "container" with my mouse, so i use the following code:
on (press) {
startDrag("");
drag=true;
}
on (release) {
stopDrag();
drag=false;
}

this is when i'm having problems. now i am able to drag around the container, containig the text.swf but the scroll buttons wont work, so i can't scroll my text.

anyone out there who can help me with this??
i'd appreciate any help.
thanks.

View Replies !    View Related
Rollover Buttons (on Press)
I am trying to script a press action into the rewind function below. I’m sure it’s a simple task to execute, however I have been unsuccessful thus far. Any help would be appreciated.

Much Thanks!

----------------------------------------------------------------------
rewind = function (obj, f)
{
obj.onEnterFrame = function ()
{
if (this._currentframe>f) {
this.gotoAndStop(this._currentframe-1);
} else {
delete this.onEnterFrame;
}
};
};
clip.onRollOver = function(){
if(this.onEnterFrame) delete this.onEnterFrame;
this.play();
}
clip.onRollOut= function(){
rewind(this,1);
----------------------------------------------------------------------

View Replies !    View Related
Making Buttons For This On Press Instead Of Rollover
Hi everyone,

I am just wondering how i can make it so the buttons for this scroll window are 'on press' rather than 'on rollover'.

http://www.flashkit.com/tutorials/Ac...1174/index.php

by far the best standard scroll window i've seen so far without being too complicated...

cheers

chris

View Replies !    View Related
Rollover/rollout/press Argh
i used to use flash a long time ago... but now i just started using it again.. (i think flash 2.0 or 3) now i got flash MX and AS in the timeline is very cool. however I'm not that up to "Mymovie.play = function ()" in the timeline... I have to read up on how to code... I put all the actions on invisible buttons still but maybe you can help me. i have these buttons with 3 animations. when i rollover the button the MC plays the rollover animation, rollout then plays the rollout animation and so on... when you press the button the MC is suppose to play the pressed animation and STOP. and then if a second button is pressed, it returns the other buttons back to the first stage.. see attached if you can help.. thanks

View Replies !    View Related
Loading Text To Textbox Using Press/rollOver
I need help with loading text into a textfield when a button is pressed. I have several buttons which is to load different text into a text field when clicked on. Can anyone help me with this, please??

View Replies !    View Related
On Rollover In Conjunction With Left Mouse Press
hi all.
I've created a "scratch-off" lottery-type of interface for a quiz I'm designing. Right now it works great with the "on (rollOver)" script call enabling the mouse cursor to act as the "coin" doing the scratching-off of the grey top material. However, it would be much more efficient if the user had to hold down the left mouse button AND roll over the grey material in order to scratch it off. It would prevent a lot of false scratches that way...

on(dragOver) doesn't work because the mouse click down has to be initiated on top of the actual mc and I need the mouse click to be initiated outside of it.

Hopefully there is an easy way to put a condition on the on(rollOver) which will make this work. Can anyone point me in the right direction?

Thanks in advance!

View Replies !    View Related
Movie Clip Blocking Rollover And Press For Clips Under It
Say I have some buttons and over them a semi transparent panel appears. I want the panel to block press and rollover and other mouse events for all the movie clips that it covers. How to do that?


Thanks

View Replies !    View Related
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?

View Replies !    View Related
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!

View Replies !    View Related
Trying To Make A Button Rollover, Wait And Recheck Rollover
hi. i'm mostly comfortable with the graphical elements of using flash and there a gaps in my knowledge when i want to polish things up.

i have a bunch of buttons which, when rolled over, trigger some text to sweep accross in an area above the buttons and sweep away when rolled out.
this works nicely but if the viewer sweeps the mouse over a few buttons quickly all the MCs with text in play and it gets very messy.

the only way i can think to tidy this up is to make the button delay when rolled over and recheck about half a second later. if it's still rolled over then it plays the MC. i tried this the obvious way (triggering a small MC with onRollover > play MC at the end) but it needs the actual act of rolling over to trigger so i had to roll out and over again which defies the point >.<

i realise this is a really specific problem and it's very cheeky to ask others to solve my problems but if any of you have come accross similar problems and can point me in a better direction i'd really appreciate it.

View Replies !    View Related
Button RollOver/RollOut Effects WITH Looping On RollOver
I'm planning to use this tutorial, below to make a button:
http://www.kirupa.com/developer/mx2004/button_effect.htm

My question is how can I make it so that only on the rollover, the effect will keep looping?

Example: http://jump5.com/

On the right side, the navigation has this nice hover animation with the pointing arrow that continues to twitch on rollover.

View Replies !    View Related
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

View Replies !    View Related
[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!

View Replies !    View Related
[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!

View Replies !    View Related
[f8] Button RollOver Show's Movie. How To Unshow Movie On RollOver Other Button
I've made a productoverview in flash.

There are 4 productphoto's (buttons with just a rollOver-function, no clicks).

Behind every productphoto there is a detailed product-specification (movie) that shows up when rollOver on the productphoto's.

So I want the product-specification movie to appear when theres a rollOver on the productphoto. The movie has to show on rollOver and has to stay visible on rollOut. But when u move to the next productphoto (rollOver) the previous product-specification movie has to disappear and the new one has to show.

I don't know what to do. so far i have this:

on (rollOver) {
tellTarget ("sony-1-1") {
gotoAndPlay (2);
}

View Replies !    View Related
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...

View Replies !    View Related
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

View Replies !    View Related
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.

View Replies !    View Related
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?

View Replies !    View Related
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

View Replies !    View Related
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

View Replies !    View Related
[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

View Replies !    View Related
[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.

View Replies !    View Related
[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.

View Replies !    View Related
Button Press
Anybody help me...

In as3, When i pressed a button for a few seconds.., i need a trace...

View Replies !    View Related
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.

View Replies !    View Related
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

View Replies !    View Related
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

View Replies !    View Related
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   }}

View Replies !    View Related
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

View Replies !    View Related
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

View Replies !    View Related
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

View Replies !    View Related
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

View Replies !    View Related
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

View Replies !    View Related
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

View Replies !    View Related
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

View Replies !    View Related
Background Rollover With Button Rollover
I'd like for my background behind my buttons to rollover, but remain rolled while I touch the buttons and make those rollover. Here's an example:

http://www.zymocreations.com/index_f.htm

I can get both of my rollovers going, but I can't get the background to stay rolled when I move to the buttons.

Any suggestions? Thanks ahead of time!

View Replies !    View Related
Button Rollover Disabled Due To MC Rollover
i have used this nifty code from this .fla (http://www.actionscript.org/forums/a...chmentid=12251, 6.4kb) and it works perfectly. it's a rollover effect that plays or reverses an MC on rollover, i have just one extra thing i'd like to ask that maybe someone could help me with.
in my example, i have a curtain that goes up and down when rolled over and out. this works fine, but what i want is to have my menu behind the curtain, so when the user rolls over the curtain, it goes up, revealing the menu. i've done this, but for some reason my basic menu's rollover actions are disabled. can't anyone help me to get them to work?

here's the code from devonair's example:code: stop();
curtain.onRollOver = function() {
this.onEnterFrame = function() {
this._currentframe == this._totalframes ? delete this.onEnterFrame : this.nextFrame();
};
};
curtain.onRollOut = curtain.onDragOut = function () {
this.onEnterFrame = function() {
this._currentframe == 1 ? delete this.onEnterFrame : this.prevFrame();
};
};and here are the actions on my basic menu that is within the 'curtain' MCcode: on (rollOver) {MC1.gotoAndPlay("over");}
on (rollOut) {MC1.gotoAndPlay("out");}
on (release) {getURL("home.htm", "iframe");}many thanx in advance for any help given...

View Replies !    View Related
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...

View Replies !    View Related
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

View Replies !    View Related
:: Conditional Button Press ::
how on earth would i code a statement like this...

If key press is 2 than 1 gotoAndPlay (2)

thanks
n

View Replies !    View Related
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?

View Replies !    View Related
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

View Replies !    View Related
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

View Replies !    View Related
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

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved