ActionScript 3.0 :: Button (MovieClip) With Two Click Functions

Aug 9, 2009

I'm almost 100% sure that I have to write an if, else statement for this. Below is the code I have for a button(movieclip) I created. It is suppose to play an animation when you click on it. Then when you click it again it's suppose to play a second animation that will take it back to the original state. What is happening is, it goes straight to the clicked state without playing the animation. However when you click the second time it plays the animation that takes you back to the original state. Am I correct in believing the only way to get the animation to play on both clicks is to use an if, else statement.

function clickPlus(event:MouseEvent):void {btn1.gotoAndPlay("clickOpen"); }btn1.addEventListener(MouseEvent.CLICK, clickPlus);
function clickX(event:MouseEvent):void {btn1.gotoAndPlay("clickClose"); }btn1.addEventListener(MouseEvent.CLICK, clickX);
btn1.removeEventListener(MouseEvent.CLICK, clickPlus);

View 3 Replies


Similar Posts:


ActionScript 3.0 :: Multiple Button Functions - When Click The Button, The Mc Does Not Stop Playing And The Text Does Not Show Up?

Nov 8, 2009

I'm designing an interface for a class, and the buttons that I am using all have multiple functions.For example, when the story button is clicked, I need the mc to stop playing and change to text (in the same window/screen, just no mc playing).  The mc is 31 frames long, but if there's a way to just make it loop continuously until told not to, Currently, my code looks like this:

stop();
story_btn.addEventListener(MouseEvent.CLICK,story);
function story(event:MouseEvent):void { gotoAndStop(32);}credits_btn.addEventListener(MouseEvent.CLICK,credits);[code]...

When I click the button, the mc does not stop playing and the text does not show up. 

View 6 Replies

ActionScript 3.0 :: 2 CLICK Functions On 1 Button?

Feb 23, 2010

I'm making a menu in flash and I want that when I CLICK the button/movieclip moves up and when I CLICK again it moves down again. I allready did it with MOUSE_OVER and MOUSE_OUT but that gave me problems.
 
Here is the Code:
 
//Eventlistenersmenu_over.buttonMode = true;menu_over.addEventListener(MouseEvent.MOUSE_OVER,onOver,false,0,true);menu_over.addEventListener(MouseEvent.CLICK,onOut,false,0,true);//Functionsfunction onOver(e:MouseEvent):void {menu_over.gotoAndPlay("menu_op");}function onOut(e:MouseEvent):void {menu_over.gotoAndPlay("menu_beneden");}

View 3 Replies

IDE :: Get A Button To Do Two Different Functions With One CLICK Event?

Sep 30, 2009

I have attached a sample fla file of what i am talking about. I am trying to get a button to do two different functions with one CLICK event. depending were you are on the time line a window should open on close when button is clicked. The problem is it dose it once, opens then closes. I would like it to work every time the button is clicked either open or close depending on the state.

View 5 Replies

ActionScript 3.0 :: Control Two Functions On One Button Click?

Jan 10, 2009

how I can control two events on one (the same) button click. On click, the first function must jump the user to a particular frame label and at the same time trigger a second function which is a movie clip on that particular frame. I must note that the event listener is attached to an actual Button and not a movie clip.

View 3 Replies

ActionScript 3.0 :: Flash Menu - Two Click Functions On One Button

Feb 23, 2010

I'm making a menu in flash and I want that when I Click the button/movieclip moves up and when I Click again it moves down again. I already did it with MOUSE_OVER and MOUSE_OUT but that gave me problems.

Here is the Code:
Actionscript Code:
//Eventlistenersmenu_over.buttonMode = true;
menu_over.addEventListener(MouseEvent.MOUSE_OVER,onOver,false,0,true);
menu_over.addEventListener(MouseEvent.CLICK,onOut,false,0,true);
//Functionsfunction onOver(e:MouseEvent):void {menu_over.gotoAndPlay("menu_op");
}function onOut(e:MouseEvent):void {menu_over.gotoAndPlay("menu_beneden");
}

View 1 Replies

ActionScript 2.0 :: CS3 Movieclip Button - Click To Play, Click To Stop?

Jun 21, 2010

I am building a flash interface and I would like a menu where it is hidden to begin with (just a tab). You click the tab to expand it, and click again to collapse it. I've made a movieclip with animation of the menu opening up and closing, but I can't seem to work out how I'd go about making the movieclip open and close properly.

View 4 Replies

ActionScript 1/2 :: Creating A Movieclip That Functions Like A Button

Aug 16, 2010

This has served me well, but I've been designing a new sight and wanted to get more into Action Script to control functions to help improve both my programming and keep my file size down.
 
So I decided to create an instance of a block (rectangle shape as another movieclip) and have multiple layers.  One which controls the actions of two other blocks.  The upper most block would not be visable until I ran the cursor over it (increase its Alpha property from 0 to 100 one step at a time in a loop).  This would reverse when the cursor ran off (reduce Alpha property from 100 [or less] back to 0 in a loop).
 
I've read and re-read every flash book I own on the subject and cannot understand why I can't control another instance of a different movieclip.

View 1 Replies

ActionScript 2.0 :: MovieClip Used As A Button - Stop All The Other Functions From Playing Once The .onRelease Function Has Started?

May 12, 2005

My problem is pretty simple, but I'm still finding my way around even the simplest things in Actionscript. I have a movieclip named 'leaf9' in which I'm using as a button (which happens to be within another movieclip). I have the following actionscript on the frame which contains 'leaf9':

[Code]...

What I want is for all the other functions to go away once "shrink" has started to play, so that if the mouse goes over the button again, the clip doesn't start playing "rollover" etc etc. So how do I stop all the other functions from playing once the .onRelease function has started?

View 8 Replies

ActionScript 2.0 :: Click A Button Twice To Run Movieclip

Sep 26, 2009

I was just wondering why it is that after I have clicked a button to run a movieclip, I have to click it twice to run it again? I would like to be able to run it again with just one click - it is for a true and false set of questions. The movieclip is an animation that runs if correct (and there is another if it is incorrect.

Here is the button script

on (release) {
_root.tf1_mc._visible=false;
_root.tf2_mc._visible=true;
_root.tf2_mc.gotoAndPlay(1);
}

comment: tf1_mc runs when the true button is clicked and tf2_mc runs when the false button is clicked. The script above is for the false button

View 3 Replies

ActionScript 2.0 :: Can't Click A Button Inside A Movieclip

Jan 6, 2010

I have made a sort of drop down menu of a movieclip. There are actually two, the first one named list_over_mc is only to detect when the mouse is in the area for when to drop down the menu (onRollOver) and the other one, list_mc, is holding the menu itself. The problem is that when the menu is down nothing happens when I click the button (now named knapp1_btn). I have tried with another but with the same sort of script (but placed outside of the movieclip list_over_mc) and that works so I'm guessing it is because the button is "over" the other movieclip.

View 3 Replies

ActionScript 3.0 :: Movieclip Array On Click Of Each Button?

Jul 7, 2010

I have browse button on stage. when i click this i am uploading a image to a movieclip. then the movieclip is added to the stage. my issue is when i click the browse button 2nd time i need to select another image and add to another movieclip and display it  to the stage

View 2 Replies

ActionScript 2.0 :: How To Get MovieClip To Hide On Button Click

Jan 20, 2009

I got this code but when i click on another button is is still there how do i get it to disappear? I have two movieclip one is the snow and another movieclip is an empty mc called snow2

ActionScript Code:
i =0;
while (i<25) {
//duplicateMovieClip (dot, "dot" +i, i);
dot.duplicateMovieClip("snow"+i, i);
i++;
[Code].....

View 1 Replies

ActionScript 2.0 :: Set MovieClip Visible On Click Of Button

Feb 2, 2009

public function mc1():Void {
for (i=0; i<9; i++) {
c = c+30;
//here my_clip is a refrence to stage
var mc_new = my_clip.attachMovie("mc_bread", "bread_"+i, my_clip.getNextHighestDepth()+1, {_x:80, _y:385-c});
mc_new._visible = false;
[Code] ......
See the function visibility I am trying to set visible a movieclip on a click of a button. this code gives no error but still movie clip is not visible.

View 1 Replies

ActionScript 3.0 :: Show Movieclip Upon Button Click?

Aug 3, 2009

I am building a navigation menu with buttons that call and show a movieclip just below the button. I have no more compiler or output errors. Despite this, I still dont have a working navigation menu.The movieclips are only found in the library and are being called by buttons on the timeline. I currently have all the actionscript on frame 1 on a separate layer of the main timeline. None of the buttons or movieclips have code associated with them individually.The code I have created is as follows (I omited some bc the functions get repetitious).

Code:
stop()
va html_con_mc = new MovieClip

[code].....

View 2 Replies

ActionScript 2.0 :: Button Click In Duplicated Movieclip?

Nov 4, 2009

Before telling you my problem in actionscript, I would like to explain on how the system works. Please bear with my long explanations.I have a list of data that need to be display out. I've created one movieclip and I named it table_mc. Inside the table_mc, I put 2 dynamic text and one blue box with alpha 0. In order to display a list of data out, I used a table component in flash to duplicate the movieclip, table_mc. It saved me from doing a "for loop".

I wanted the list of data to be clickable so I converted the 2 dynamic text in table_mc, into movieclip. I named it table_but. When I clicked onto table_but, the blue box will appear, alpha 100 to show that it is being clicked.Here's the problem. I've done an actionscript in table_mc. In the list example, when i clicked onto no '2', the blue box appear and if I clicked onto no '5' the blue box for no '2' should disappear. Unfortunately the blue boxes will appear there together when i clicked onto no '2', '5' and '7' because they shared the same movieclip table_mc. Is there a way to do it when the blue box can only appear at a time?

View 2 Replies

ActionScript 2.0 :: Play Movieclip On Button Click?

Feb 21, 2011

how to play a movieclip on button click in actionscript 2.0.

View 3 Replies

ActionScript 3.0 :: MovieClip Button - Go To Frame One On Click

Feb 18, 2009

I put a mcBtn in the end game frame, put this code in the frame:
mcBtn.buttonMode = true;
mcBtn.addEventListener(MouseEvent.CLICK, playGame);
function playGame(e:Event):void {
play:(1);
}
The object is to go to frame 1 when you press mcBtn. When I click it, Nothing.

View 2 Replies

ActionScript 2.0 :: Get A Movieclip Bigger When Click A Button?

Nov 29, 2004

What AS should I use to get a movieclip bigger when I click a Buttom? I want the object to grow at a size "x" and then stop....

View 7 Replies

ActionScript 2.0 :: Functions And Sub-functions - Button Doesn't Work OnRelease?

Jun 17, 2004

I have one function that puts text in a text field and makes a button goto a url onRelease.The code is like this:

Code:
item.onRelease = function() {
myButton.onRelease = function() {
getURL("http://google.com", "_blank");
}
talk = this.txt;
}
the only problem is that the button doesn't work onRelease. i think that it is because there are too many functions there, but at the same time,

View 5 Replies

ActionScript 3.0 :: CAN'T CLICK On Any Button - Movieclip Layer Work

Jul 31, 2010

i CAN'T CLICK on any button, movieclip layer and have actionscript work, it just says "CURRENT SELECTION CANNOT HAVE ACTIONS APPLIED TO IT" what do i have to do so that i can click on my button's and go in action pannel and be able to input my actions without it saying "CURRENT SELECTION CANNOT HAVE ACTIONS APPLIED TO IT"

View 4 Replies

ActionScript 1/2 :: One Click Two Buttons - Replicate To The Other Button Within The Movieclip

Mar 16, 2012

I have a button on the stage which works fine and performs various actions. I have a movie clip on the stage, that contains 10 different buttons which when you click advances you to the next button and does different things and so on and so on. Again independantly this movie clip with buttons works fine.

What I want to do however is this. I want to click on the main button on the stage, have that 'click' replicated to the other button within the movieclip so I can action both with a single clip.

View 31 Replies

Flash :: Loads A New Movieclip/swf File On Button Click?

Sep 5, 2011

I am creating a library like flash file for our game. I am using adobe flash cs5 with as3 and adobe indesign. I am still very new at flash(a real newbie) and i am wondering if anyone could help me in my problem.

i have a movieclip file named "mainPage". mainPage contains 6 buttons (with a cyrstal design) but lets focus only on 1 button. The 1st button contains the name Art_btn which calls the movieclip artBook when the button is clicked (which is my problem) . I have another movieclip named "artBook". the contents in my artBook are separated or written on each frames that could be called when clicked next or prev.

here is my prob. i dont know what is the right code that would call for artBook when Art_btn is clicked.i tried inserting codes such as loadMovie, gotoAndPlay and addChild but when I test it, the mainPage contents doesnt show up and it produces errors.

[Code]...

View 1 Replies

Flash :: Getting Instance Of Button/movieclip On It's Click's Handler?

Nov 25, 2011

It used to happen in AS2.0 as follows :

my_Mc.onPress = function()
{
trace( this)
}
//output :
[my_Mc Movieclip]

[Code]...

View 2 Replies

ActionScript 2.0 :: User Click MovieClip Button To Go To Another Page

Mar 22, 2010

I want to have an application where the user click on a movieclip, and is then taken to a another page. What I need is the code so as a user clicks a moviceclip (for example MC_1) it holds a variable (say = 1), as the movieclip is pushed a movie plays which at the ends checks for the variable change and then re-directs the user some where?

View 1 Replies

ActionScript 2.0 :: Change Alpha Of Movieclip On Button Click?

Feb 18, 2011

I am unable to change alpha of movieclip on button click using as2.[code]...

View 1 Replies

ActionScript 3.0 :: Change Alpha Of Movieclip On Button Click?

Feb 21, 2011

i am developing one small imteractive game.in that i'm getting one difficulty.Difficulty is: i want to play a moviclip whenever i 'll click on button ,and .For that i hav applied logic in following way.

function onMouseClick(event:MouseEvent):void
{
this.alpha=0; (alpha of 1st movieclip will 0 )

[code]......

View 5 Replies

ActionScript 3.0 :: Show / Hide Movieclip When Click On The Button

Sep 28, 2010

I just did a button and 3 movieclips. What i want? Well, when i click on the button to change the movieclips. click 1 = movieclip 1 when i click again on the button it change to movieclip 2 My problem is that i can`t make so it can change to movieclip 3.So when i click it must be something like this> click 1 = movieclip1, click 2 = movieclip2, click 3 = movieclip 3 so on...

[Code]...

View 2 Replies

ActionScript 2.0 :: Cross MovieClip Navigation Via Button Click

Feb 7, 2004

Here is how my movie is set up.
Frame one -> MovieClip #1
Frame two -> MovieClip #2
within each movieclip there are 10-15 frames.
Here's the problem. I want to be able to go from frame one in MovieClip#2 to the last frame in MovieClip#1, via a button click.

View 5 Replies

ActionScript 2.0 :: Click On A Button It Load Up Intro Movieclip

Sep 27, 2002

I want to know what action I should use for this. For example, I want to click on a button, it load up my intro movieclip, after the movieclip is done and it automatically load to my next scene.

View 14 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved