ActionScript 3.0 :: Replacing Movieclip With Another Movieclip When It's Clicked On?

Jul 9, 2009

I've got music player and one of the controls is a movieclip which acts as a PLAY and PAUSE button. What I would like is to swap the image of this movieclip everytime it's clicked. How would I go about doing this?

Here's my code...

ActionScript Code:
playPause_btn.addEventListener(MouseEvent.CLICK, onPlayPause);
function onPlayPause(event:MouseEvent):void{

[Code].....

View 1 Replies


Similar Posts:


Replacing Movieclip With Another When It's Clicked On?

Jul 9, 2009

I've got music player and one of the controls is a movieclip which acts as a PLAY and PAUSE button. What I would like is to swap the image of this movieclip everytime it's clicked. How would I go about doing this? Here's my code...

[Code]...

View 1 Replies

ActionScript 2.0 :: Button To Open A Movieclip And Then Close The Movieclip When Clicked On Again

May 19, 2010

I am a super noob at actionscript. And I want my button to open a movieclip and then close the movieclip when clicked on again. I have no idea what to add after that here is the code I have for the button so far.....this button opens it.

on(release){
this.linemc5.gotoAndPlay("ear");
}

and this is another button I made that can close it, but I want it to be in the same button rather than seperate.

on(release){
this.linemc5.gotoAndPlay("earclose");
}

View 2 Replies

ActionScript 2.0 :: When Mouse Is Clicked, Detect Which Movieclip Is Clicked

Sep 9, 2009

I have parent movieclip and in that many different children movieclips

What i want to do is when i CLICK, i want to detect which movieclip it has clicked and call corresponding function (defined by onpress event) of that movieclip.

View 6 Replies

ActionScript 3.0 :: Replacing A MovieClip With A Drawing?

Oct 27, 2010

I'm creating a platforming game, and I have a fun little water thing set up. My goal is to be able to drag a water object from the library to the scene, and have the water physics kick in when the game starts.
 
To do this, I made the water object a black line, because width is necessary to know how wide I'd like the pool to be.  Within the class I have a heightmap, so then I can connect all the heights together with lines using the drawing API.
 
The problem is, I can't get the original black line to disappear while still displaying the new lines and points Setting the alpha to 0 will permanently make everything invisible.  I'm kind of new to this so maybe it's a dumb question.

View 4 Replies

ActionScript 3.0 :: Replacing This.graphic For A Movieclip?

Jun 12, 2011

At the moment I am busy editing a little flash game, but i was wondering if i could replace the part below for a movieclip

ActionScript Code:
this.graphics.beginFill(0x333333);
this.graphics.drawRect(0,0,25,25);
this.graphics.endFill();

View 2 Replies

Actionscript 3 :: Replacing Bitmap In A Movieclip In Flash?

Nov 14, 2011

But now the tracks are objects in an array, that will grow larger and larger (and slow down the game over time). How can I paint them on the level bitmap? And how to reload the bitmap when you restart?Have searched for an answer for days but have not found one.I know how to combine a bitmap and add it to the stage, but not how to replace it in the movie clip object:

var newLevel:BitmapData = new BitmapData(grassLevel.width, grassLevel.height);
var newDebree:BitmapData = new BitmapData(debree.width, debree.height);
newLevel.draw(grassLevel);

[code]......

View 1 Replies

Actionscript 3.0 :: Replacing A Loaded Image In A MovieClip?

Apr 27, 2011

Hi there I am still a novice to Actionscript 3 and would like some help please. I am creating a grid style image gallery that is XML driven. What I need help with is getting my images to, at random times, swap out with another image. Each image is added inside a Movieclip and can be unloaded. What I need is to load another random image into the now empty MovieClip. Hope this is ok description.

[Code]...

View 1 Replies

ActionScript 1/2 :: Replacing A Movieclip Without Changing It's Children/depth/tweens

Feb 5, 2010

I would like to be able to draw a simple box as a background/placeholder, dress it up with buttons and movie clips at design time, and at runtime call a function to replace the simple box with a new design. How would I go about doing this? I have a graphic design that is too complicated to make with flash. So i made a piece of actionscript that can restyle any existing movieclip. This piece of code works. It basically gets the coordinates of the specified mc, creates a new one in it's place and deletes the original. Unfortunately this also removes any nested movieclips and buttons and breaks animation tweens of this mc. So if the original mc would have a button on it and animates from left to right, the new one doesn't.
mc.clear(); looked very promising, but it only clears stuff you put on it at runtime while I need to clear the stuff from design-time. (= the simple box drawing object)Creating a movieclip with the same name, at the same depth doesn't seem to work. oldbox.parent.createEmptyMovieClip(oldbox._name, oldbox.getDepth()); The old movieclip keeps existing and neither of them animates.So I'm searching for a way to replace a movieclip or clear it's content at runtime.

View 5 Replies

ActionScript 2.0 :: [mc] Replacing A Movieclip Without Changing It's Children / Depth / Tweens

Feb 4, 2010

I would like to be able to draw a simple box as a background/placeholder, dress it up with buttons and movie clips at design time, and at runtime call a function to replace the simple box with the new design. How would I go about doing this? I have a graphic design that is too complicated to make with flash. So i made a piece of actionscript that can restyle any existing movieclip. This piece of code works. It basically gets the coordinates of the specified mc, creates a new one in it's place and deletes the original. Unfortunately this also removes any nested movieclips and buttons and breaks animation tweens of this mc. So if the original mc would have a button on it and animates from left to right, the new one doesn't.

mc.clear(); looked very promising, but it only clears stuff you put on it at runtime while I need to clear the stuff from design-time. (= the simple box drawing object)
Creating a movieclip with the same name, at the same depth doesn't seem to work. oldbox.parent.createEmptyMovieClip(oldbox._name, oldbox.getDepth()); The old movieclip keeps existing and neither of them animates.So I'm searching for a way to replace a movieclip or clear it's content at runtime. Or am I thinking in the wrong direction and are there other ways to restyle a movie clip?

View 1 Replies

ActionScript 2.0 :: Replacing Object With Larger Version When Mouse Clicked

Oct 6, 2010

I am creating a fish-eat-fish movie. I created a fish (pike1) that follows the mouse. Another fish (Chub) is set to disappear when clicked. What I want to do is to have pike1 grow larger (either by just growing larger or having pike1 disappear and be replaced on mouse click by a larger pike (pike2).

View 1 Replies

ActionScript 1/2 :: Replacing An Object With A Larger Version Of It When Mouse Is Clicked On A Separate Mc?

Oct 7, 2010

I am creating a fish-eat-fish movie and I need some help. I created a fish (pike1) that follows the mouse. Another fish (Chub) is set to disappear when clicked.What I want to do (and need help with) is to have pike1 grow larger  (either by just growing larger or having pike1 disappear and be replaced on mouse click by a larger pike (pike2) when the user clicks on Chub

View 1 Replies

ActionScript 3.0 :: Movieclip Cannot Be Clicked?

Apr 12, 2011

Ive got my target game where the target spawns on the stage at a random position. When the target spawns however, i am unable to click it to shoot it?

Ive got my event listener for the target in my actions on that frame, but its giving me the following error:

1061: Call to a possibly undefined method addeventlistener through a reference with static type class.

If i comment out the addEventListener for the Target the game runs but i cant click it, if i dont comment it out i get that error and the game wont run.

View 14 Replies

ActionScript 3.0 :: MovieClip Will Not Move Unless Clicked

Feb 3, 2010

At the start of my movie (its a game), you press a button that moves you to the second frame where the game starts when called by a function on the main timeline called startThisGame(). A symbol called "player" is spawned from a class called Player and when right or left arrow are pressed it responds by moving left and right. Problem: The "player" wont respond to key presses unless I first click anywhere on the actual game window, either in test mode or after publishing. This did not happen before and now it does.

View 3 Replies

ActionScript 3.0 :: Check If A MovieClip Was Clicked?

Dec 31, 2011

How can I check if a Movieclip is clicked.I have two MovieClips on my stage .one has the instance name "yes" the other one is called "no"

if yes is clicked it should do something

if no is clicked it should do something else

but how do I check which one was clicked ?

View 6 Replies

ActionScript 2.0 :: _alpha = 0 When Clicked Outside Movieclip?

Oct 30, 2006

how to have a MC have _alpha = 0 when clicked anywhere outside the mc

View 9 Replies

ActionScript 3.0 :: Controlling Clicked Movieclip?

Apr 28, 2009

Is there a way to capture what movieclip that have been clicked so I don't have to wright a new "nextFrame" function for every clip

myClip_mc.addEventListener(MouseEvent.MOUSE_OVER, overMyClip)
myClip_mc.addEventListener(MouseEvent.MOUSE_OUT, overMyClip)
function overMyClip(event:MouseEvent)[code].....

View 10 Replies

ActionScript 2.0 :: MovieClip Button Stay Down When Clicked

May 21, 2007

Ok, I've search through the forums but none of the posts seem to work for me. I've got 4 buttons that each have an onRollOver, onRollOut, and onRelease function on them. I would like the onRollOver state to stay in place after the user clicks the button they're over. Then, when the user clicks on a different button, that buttons down state sticks, and the previous button's state unsticks and goes to the rollout function. I've read through and tried this thread:[URL]

View 5 Replies

ActionScript 3.0 :: Get A Movieclip Fill Color To Change Once Clicked

May 23, 2009

I'm trying to get a movieclip fill color to change once clicked. I'm able to get the mouseover and mouseout working. But the click state isn't working properly.

Here's my code:

Code:

my_mc.addEventListener(MouseEvent.MOUSE_OVER, onFolderOver, false, 0, true);
my_mc.addEventListener(MouseEvent.MOUSE_OUT, onFolderOut, false, 0, true);
my_mc.addEventListener(MouseEvent.CLICK, showMovieclip, false, 0, true);

[code]....

When I use the above code, nothing happens once clicked. I tried using the color property, but, although that made a color change (black), it wasn't the color I had indicated (white).What I have is a movieclip ("my_mc"). Inside the movieclip are other movieclips. When one is clicked, only that movieclip ("my_mc.movieclip01"), is highlighted.

View 1 Replies

ActionScript 3.0 :: Not Reload An Already Loaded Movieclip When Clicked On Navigationbutton?

Aug 21, 2009

How to NOT make Flash reload an already loaded movieclip from the navigationbar/buttons when clicked on. [code]...

View 3 Replies

ActionScript 1/2 :: Loading MovieClip Based On What Button Clicked

Mar 30, 2009

I looped my buttons just fine. However, I am trying to load a movieclip based on what button is clicked. the code loads the same movie everytime though.

View 13 Replies

ActionScript 3.0 :: Move MovieClip Position When Button Clicked

May 22, 2010

I have a simple arrangement where a movieclip moves to a new x y position when a button is clicked. I want the movieclip to slowly move or 'glide' there instead of jumping straight to the new position.

Heres the code..
btn_up.addEventListener(MouseEvent.CLICK, moveUp) ;
function moveUp(event:MouseEvent):void {{
allcontent.x += 200;
allcontent.y += 200;
}}

View 1 Replies

ActionScript 3.0 :: Function Executes When An Instance In The Movieclip Is Clicked?

Aug 16, 2010

I'm so getting confused with this,So i'm making a card game, and i'm just on the beginning of it. I've already added the objects on the stage and stored them on an array.now i made a function that when it executes the .x and .y properties of these cards would change. this is what i did, but nothing seems to happen.the array MyCards contain movieclip objects not strings and also, the function executes when an instance in the movieclip is clicked

ActionScript Code:
distCards(MyCards);
function distCards(cards:Array):void {
for (var i:int=0;i<cards.length ;i++) {

[Code]...

View 1 Replies

ActionScript 2.0 :: Getting Zoom Out Effects For MovieClip When Next Link Clicked

May 13, 2008

How can I get the disappear (I used zoom out) Effect when I click another link I mean I want to get the zoom out effects for the previous movie clip when I click the next movie link.

View 5 Replies

ActionScript 3.0 :: Remove A MovieClip From The Stage Once A Button Has Been Clicked?

Mar 5, 2010

What i want to happen seems quite simple yet i keep getting the error "access of undefined property" when what i'm trying to remove is in fact defined in the same class but it obviously cannot gain access to it.

I want to remove a MovieClip from the stage once a button has been clicked.The MovieClip is created in the same class as my button function i created. The button works fine but whatever i try to put within the function to remove the MovieClip cause the error i mentioned at the start.

View 5 Replies

ActionScript 3.0 :: Flash Sending Variables When Movieclip Is Clicked?

Jun 5, 2011

I�m trying to send variables when a movieclip is clicked and use some frames later.

Code:
function langFr(e:MouseEvent):void{
var language = "fr";
play();
}

When the button is clicked, the movie plays until frame 10, where there�s the code:

Code:
if (language == "fr"){
trace ("French")
}

but it�s not working. I imagine that because I�m creating the variable inside the function and trying to read it outside. But how can it be done?

View 3 Replies

ActionScript 3.0 :: HitTestPoint In An Array - Remove The Movieclip When Its Clicked

Jun 28, 2011

I have 3 movieclips on stage and what im trying to do is remove the movieclip when its clicked. the code i wrote is throwing this error.. "TypeError: Error #1006: value is not a function. at hitTestPointEx2_fla::MainTimeline/itsclicked()" Can someone please tell me what im doing wrong..This is what i have so far..

[Code]...

View 3 Replies

ActionScript 3.0 :: CurrentFrame - Doesn't Replay A MovieClip If Button Clicked Again

Mar 1, 2010

I'm coding buttons and have them all switching but I want to set b1 so that it doesn't replay a movieClip if it's clicked again. So I click on b1 and bring up page1, if I click on b1 again it replays the fade-in. How do I set this so if it's already loaded it won't load again?

[Code]...

View 3 Replies

ActionScript 2.0 :: Series Of MovieClip Buttons - Stay Downstate When Clicked?

Aug 27, 2009

I'm using some classes that apply to a series of movieclip buttons I found. I'm using the classes to get the buttons to rollover and when clicked stay in the down state, when another is clicked the previous button goes back to up state. The rollover works fine however it doesn't stay in down state when clicked.

Here is the code I have so far, I'm also open for substitute classes that will do the same thing.
ActionScript Code:
class ButtonClass extends MovieClip {
public var onPressDown:Function;
public function ButtonClass() {
this.gotoAndStop(1);
[Code] .....

View 0 Replies

ActionScript 2.0 :: Accessing Movieclip Parameters - Set A Global Variable To A New Value When Clicked

Nov 4, 2003

I have a button in a movie that I want to set a global variable to a new value when clicked. I want it to access a parameter of a movie clip that this same button loads onto the movie for the new global variable value. I have the final line under this button's onrelease script with something like this:

globalvariable1 = movieclip.parameter;

Everything is on level 0 and I've tried prefixing everything with _root. but it didn't make a difference, the global variable still wasn't changed. I'm a newbie so don't laugh if this is a really dumb question!

BriCar77
brian_carey77@ou.edu

View 2 Replies







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