ActionScript 3.0 :: A Single Button That Removes And Adds MCs

Feb 5, 2011

I'm trying to create a button that, when first clicked, will add a MC to the stage. Then, on the second and subsequent clicks will remove the existing MC and replace it with a new one. The code I'm using is:

stop();
draw1.buttonMode = true;
draw1.useHandCursor = true;

[Code]....

Is there a better way to handle this than what I have above?

View 3 Replies


Similar Posts:


Flash :: Compare 2 Arrays For Adds, Removes & Updates?

Apr 13, 2010

I'm wondering if there is a better way to approach this than my current solution...

I have a list of items, I then retrieve another list of items. I need to compare the two lists and come up with a list of items that are existing (for update), a list that are not existing in the new list (for removal) and a list of items that are not existing in the old list (for adding).

Here is what I'm doing now - basically creating a lookup object for testing if an item exists.

[Code]...

View 2 Replies

Make A Button That Removes The External SWF

May 29, 2009

I'm new here, so let's introduce myself at first: My name is Bram, I live in Holland. I am 16 years old and currently working on a little project for school. In the project you can click on stuff, and that loads an external SWF. Here is how I did that:

[Code]...

Okay. That all works, but now I want to make a button that removes the external SWF (and brings you back to the original SWF). how to do that? If you need my FLA, tell me; i'll upload it. PS: I did use search, but couldn't find anything.

View 1 Replies

ActionScript 3.0 :: Button Adds To Total Score?

Dec 3, 2009

I can find my way in Actionscript 2.0, but 3.0's hell for me. I've been following a bunch of tutorials and I suppose I understand the 'basics', although I'm beating myself over this 'cause most of you will probably consider this basic aswell.

The problem at hand : I made a few movieclips, that have a transparant button on the first frame inside of them, and on layers below it an animation that starts once you click it, then stops at the last frame.

(Example : You see a snail, you click it(but really click the transparant button that's above it) and the movieclip starts playing, showing a snail that crawls back inside it's shell, then it stops. Pretty simple, but it's a fun and easy way to have multiple interactive graphics on a page.)

The task at hand : Somehow make a score system that allows you to see how many of them you've clicked, meaning everytime you click a snail (for this example, anyway) there's a +1 function somewhere.

Currently, inside the movieclip (the transparant button) I have :

stop();
alpha_btn.addEventListener(MouseEvent.CLICK, nextClick);
function nextClick(event:MouseEvent):void{
gotoAndPlay(2);
}

Which is pretty straight forward. alpha_btn is the button that makes the animation inside the movieclip play. At frame 30, there's a stop(); function.Then, there's the main timeline.

function scorePoints(myPoints:Number):void {
if (Number(scoreBoard.text)) {
scoreBoard.text = String(myPoints);

[code]...

It works, but only once. After the snail is clicked, I have it looped (no stop(); at the end of the moveclip, but it moves to the first frame again. Meaning, the button's there again and it's clickable again.) but everytime I click it after that, there's no points added to it.So I'll break it down to this : I need simple button that, when clicked, adds a number of points to the scoreBoard.

View 4 Replies

ActionScript 3.0 :: When A Button Is Pressed It Adds Another Movieclip (from The Library)?

Jan 14, 2012

When a button is pressed it adds another movieclip (from the library) to a movieclip acting as a container at the bottom of the screen. This all works fine, and the movieclip is added to the container (directly in the middle), what i need is it to be positioned to the left. Obviously i could change the .x value, but its a little bit more complicated, because if there is already one movieclip there (in the container at the bottom), the next one that is added needs to be 25 pixels to the right of the movieclip already there.

Code:
var bass1:Bass1 = new Bass1();
//navigation
help_bt.addEventListener(MouseEvent.MOUSE_UP,help);[code].....

View 14 Replies

ActionScript 3.0 :: Reset Button - Clear All The Input Box And Removes The MovieClips

Mar 1, 2009

I have a page with several input boxes and several instances of movie clips on the stage which have been added with addChild, what i want to do is make a reset buttun that clears all the input boxe and removes the movieClips so that the page looks as it did when it was first loaded but the help files are usless with a specific request like this.

View 14 Replies

ActionScript 3.0 :: External Class That Controls The Button And Adds Interactivity To It?

Jan 29, 2009

i have an annoying problem. I have a mc that i use as a button. I have an external class that controls the button and adds interactivity to it, here's part of the code:

Code:
package
{
import flash.display.*;
import flash.text.*;

[Code]...

The problem is, i want the btn that, when clicked, remain inactive.That's why I remove all the listeners in the class. HOWEVER, it still functions as a button, I mean the functions haven't been removed at all after I click it. What's wrong here?? Why are the functions still there, if I have removed them when clicked at the btn?

View 4 Replies

ActionScript 3.0 :: Kill Button On A Loaded Swf That Removes Itself (loaded Swf)?

Jan 21, 2009

I have a swf loading another swf. The loaded swf has a button (mc) whose purpose is to unload (kill) itself (the swf).

View 3 Replies

Play / Pause Music With Single Button?

Sep 28, 2009

I'm extremely new to Flash and I am making a website and want to have a single button that when pressed pauses or plays a music file. I was able to create one that works by following a tutorial that I found online but the problem is that the button is on the main timeline so as I move away from it, it stops working. I think that it would work better if I was able to make a movie clip out of the button so that it doesn't sit on the main timeline and will keep working no matter where I am on the timeline. All I need is one button that pauses and plays music when pressed. I also want to be able to have a "music on" line of text and "music off" line of text depending on whether the music is playing or not.

View 4 Replies

Flash :: Show Different Images For A Single Button?

May 7, 2011

How to show different images for a single button?It should show different images when the mouse pointer is over the button and out of the button.

View 3 Replies

ActionScript 3.0 :: 2 Ways Of Scrolling From A Single Button?

Jan 13, 2010

I'm building a historical timeline app in Flash. The main feature will be an MC containing links to specific event in the history of an organization. The MC will scroll, and there will be a couple ways to scroll it. One type of navigation will be fwd/backward buttons, and I want them to work such that if the button is pressed and held, an MC containing links will scroll w/increasing speed (up to a limit), but if the button is clicked, it will just move the MC a specified amt.

An example of what I want to accomplish can be seen it this HP timeline: [URL]

I think I could do this w/a MOUSE_UP eventListener

View 2 Replies

ActionScript 3.0 :: Single Button Combo Attack?

Apr 27, 2010

so I'm still pretty new to AS3, but I'm making a game for my final project in school. I have to make a side scrolling beat em up game, where you hit the X button to do three different attack animations. I want the next attack to not start until the last ends, and I want the attack animations to reset if you wait too long between X presses.What I've gotten so far works, but is very clunky and I already see reasons down the road for why it's not gunna work well.

ActionScript Code:
var attackTimer:Timer = new Timer(1000);
var attacks:Array = new Array();

[code].....

View 0 Replies

ActionScript 2.0 :: Condense The Script So Every Single Button?

Aug 18, 2009

I have a small Flash presentation I'm putting together and I've written out the code that I'll need or how it will function at least.My question is... is there an easy way to condense the script so every single button doesn't have like 20 if/elseif statements? This is the code on my main frame:

Code:
import mx.transitions.Tween; //import tweening class
import mx.transitions.easing.*;[code].....

Now I have to apply this idea to like 50 buttons in different sections. Is there a way that I can just check whats in that container already and then just load that movie out without all the code? I'm going to have to rewrite this thing like 50 times for it to work otherwise.

View 1 Replies

IDE :: Play / Pause Music With Single Button?

Sep 29, 2009

'm extremely new to Flash and I don't really know how to code yet.. I'm making a website and want to have a single button that when pressed either plays or pauses the music file. I found a tutorial that worked but it has two buttons (one for play and one for stop). You can see the tutorial here:[URL] I'm hoping that someone can tell me how I might be able to change the code so that a single button acts as both play and pause (i.e.; If music is not playing then play, if music is playing then stop).

View 2 Replies

ActionScript 3.0 :: Setup Up A Single Button To Perform Two Different Events

Oct 22, 2010

I am designing a instrument panel and am needing to essentially create an emulation of how the panel would actually work. Right now I have the panel set up to run through a systems test. So I have a button play a movie, and display a verification that the test was successful. On the real panel, you press the same button again to confirm the test. How do you setup the button to go to a different frame than the first time I clicked it? I have come across different possibilities, such as using an "if then" function, but really don't know how to use the syntax, or if that would even accomplish the task at hand.

View 3 Replies

Single Start/stop Button For Looping Movie?

Oct 25, 2009

I currently have a 23-frame multilayered single-scene animation designed to loop continuously which I would like to add to my portfolio. As such, I am adding a Play button, which I would like to toggle to a Stop (or Pause) button. I currently have an instance of the Play button ("playButton") created.
 
(You can find this at pineboxmovingco.com/gear_redux.swf)
 
Besides imploring your assistance in providing the code, I must also ask if this requires (and best practice for) inserting an additional frame at the beginning for the ActionScript, as well as where/what layer to add an instance of the Stop button. I would like the movie to be stopped by default, presenting the Play button, toggling to the Stop button, and back to the Play button, each upon release.

View 8 Replies

ActionScript 3.0 :: Remove All Loaded SWFs With A Single Button?

Jan 27, 2010

I load many SWFs in to my webpage. I need to add a removeChild to my main buttons (HOME, ABOUT US, CONTACT US, etc...) so when exiting from one page to the other all the loaded swfs will be removed.

Is there a way to remove all loaded swfs with one action on a button?

View 2 Replies

ActionScript 3.0 :: Single Click Button Needing To Be Clicked Twice?

Jul 3, 2009

I have buttons that need to be double clicked in order to work when they should only have to be clicked once. Once the button is clicked twice, it only takes one click to work. I have this code on the button itself.

ActionScript Code:
on (release) {
services_btn.onRelease = function() {

[Code].....

View 6 Replies

ActionScript 3.0 :: MovieClip With Children Function As Single Button

Sep 21, 2009

I have a movieClip. It has two children, a rectangle shape on layer 2, and a textfield on layer 1. The movieClip is used as a button.

The problem is that the textField and the rectangle are firing mouse "over" and "out" events individually. I want the movieClip to function like the old ActionScript 2 movieClips--as one single button.

I tried

ActionScript Code:
mynew_mc.mouseChildren = false;

but then the movieClip did not respond to any mouse events.

View 7 Replies

ActionScript 2.0 :: Adding Multiple Actions To A Single Button

Jan 22, 2010

I am creating a "Kiosk" to be used in flash using ActionScript 2.0 with individual scenes. At the end of each scene is an outro and the beginning of each is an intro to give the impression of them all appearing seamless.So on each button I have added the following [code]Frame 180 is where the outro plays to enter the selected scene of that button. I would then like add to this piece of script that I want that button to go to that scene after the outro is played. So it would have something like gotoAndPlay(scene xx);The only other solution I have at the moment would be to make an outro of each scene for each button to jump to but this having 8 scenes it would end up adding up to 64 outros in total.So would there be a solution to simply have each button jump to the one outro then jump to its own scene?

View 3 Replies

ActionScript 2.0 :: Muti Screen With Single Back Button?

Aug 14, 2010

I have an animated storybook that reader moves through each page (scene) with forwardBtn and backBtn. Each scene (in it''s own keyframe) I have placed a voiceover on the time line. When I view movie the forward btn plays scenes and sound correctly. The prolblem is with the back btn, When bacBtn in pressed the previous scene plays but the sound from the other sceane keeps going.actions from back btn below

on (keyPress "<Up>") {
// Locate the screen that is the target of the behavior
var screen = null;

[code].....

View 5 Replies

ActionScript 2.0 :: Single Stop/resume Button For SWF File?

Sep 16, 2010

I'm looking for an AS2 tutorial or template that will show me how to create ONE button that will stop and resume an SWF file that is made up of several composited movieclip elements. I've found several that use two buttons (start and stop), but I would like one that operates like the single sound on/off buttons you see on many sites.

View 1 Replies

ActionScript 3.0 :: Load 2 Swf Files With A Single Button Click?

Sep 1, 2011

I want to load 2 swf files with a single button click. I'm currently using 2 different functions with different loaders and I call both functions with the same button, but I get error 2025.

View 3 Replies

Actionscript 3.0 :: Load 2 Swf Files With A Single Button Click

Sep 1, 2011

I need to load 2 swf files with a single button click. I'm currently using 2 functions, but I get: ArgumentError: Error #2025: The supplied Display Object must be a child of the caller.[code]because I tried to load everything into a single function and when I used two functions I got error 2025.What code should I use in order to load two swf files at the same time, with a single button click?

View 1 Replies

ActionScript 2.0 :: Loading Multiple Named External Swf On Single Button?

Apr 24, 2009

on loading multiple external swf on single button... I mean on click of next or previous button may I load external swf with different name on targeted instance....?

View 9 Replies

ActionScript 3.0 :: Two Functions Running At Same Time With Single Button Press

Jan 23, 2012

I have a problem with two functions. This is the story: the user has to press the space button on keyboard when he sees something on screen, then the "rightClick" function is called. If he presses the button when there is something else on screen that is a wrong answer (function "wrongClick" is called). The problem is that when the user presses the space button both function run at the same time.

This is the call of the wrongtClick function on frame 5
stage.addEventListener(KeyboardEvent.KEY_DOWN, wrongPress);
This is the call of the rightClick function on frame 10
stage.addEventListener(KeyboardEvent.KEY_DOWN, rightPress);

Both function are very simple:
function rightPress(event:KeyboardEvent):void {
scorenum += 1;
trace ("Right:",scorenum);
} function wrongPress(event:KeyboardEvent):void {
wrongnum += 1;
trace ("Wrong:", wrongnum);
//and plays a sound too
}

View 3 Replies

ActionScript 2.0 :: Alternating Sounds On A Single Play/Stop Button?

Jan 6, 2009

When the movie loads, the music begins to play. I have a single Music On/Off button that can stop and restart the first track. However, whenever the user stops and then starts the music again, I'd like to alternate the track that plays.

As it stands now, only the the first track will play when the button is clicked (and when the movie loads, of course).

Code in action layer:

ActionScript Code:
var song = 1;
var my_sound:Sound = new Sound();

[Code].....

View 3 Replies

ActionScript 2.0 :: Create A Single Text Field With Submit Button?

Sep 28, 2002

I need to create a single text field with submit button. The user will simply enter their email address and press submit and it will be sent to an email address of my choosing.

View 3 Replies

ActionScript 3.0 :: Same Button On Single Frame To Display/hide Movie Clip?

Jul 2, 2009

can a button on a single frame be coded to both display a movie clip on its first click and, after a second click, hide the movie clip?

View 3 Replies

ActionScript 2.0 :: Playing A Movie Clip In Forward And Reverse With A Single Button?

Oct 5, 2010

i am new to this site and also to AS i am trying to create a an expand and collapse functionality in which i want a movie clip to shrink and disappear when i click on a button and reappear when i click it again the solution that i came up with was i animated the movie clip shrinking and disappearing and now i think playing the timeline in reverse will solve the other half and i also added the stop script at the 1st and last frame of the movie clip.

i tried a lot and a number tried and tested the no of scripting techniques posted on other threads

View 9 Replies







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