ActionScript 2.0 :: Editing A Function For Buttons
Aug 14, 2007
I have the following function, basically a whole lot of ohter things happens onRollOver and onRollOut but pretty sure it's here I need to edit. I have 5 mc's on the stage called 'btn1', 'btn2' etc.[code]As I said there is other bits and pieces that happen, but what i want to achieve is btn2, is actually just going to an external link, but at the moment I don't want it when pressed to play.Is there anyway to keep it as part of the function, but if btn2 is pressed NOT to play?
I have a project that I have bee working on for quite a while, and just recently it began doing strange things. Anytime I try to edit a button symbol, Flash crashes immediately.
For example, if I go into the button symbol editing mode, it will be fine. But as soon as I move the play head to the overstate key frame, the whole program just disappears.
I am putting together a simple flash anim - and pretty much have about 25 buttons that I need to fade in and out on rollover. I seem to remember there is a way to apply the same function to all buttons - as long as the over and out state labels within the mc are the same.
I have three buttons. My goal is that each button will load and play a sound file from the internet. Here is what I have:
function loadPlaySnd(pSpecifier1:String):void {
arguments;
SoundMixer.stopAll();[code]....
Every Button I press goes to the same sound file. The best I can figure, is that the file I loaded the first time I pressed a button has been uploaded, and from there I cannot load another file over that variable when I try another button.
What I have is a series of buttons created via attachmovie based on XML nodes. I want to make sure all buttons are all clicked. What I have below is the onRelease of the button and I need to put my checkDone function in there because of the XML onLoad function. What I am struggling with is how to check if each has been clicked. Typically I would just do like but1==true but that does not seem to work.
_root["but"+b].onRelease = function() { function checkDone(whichbut) { done = true;
I have the following scenerio, a main.swf which loads swfs on top, code below
stop(); var Xpos:Number = 0;var Ypos:Number =0;var swf:MovieClip;var loader:Loader = new Loader(); var defaultSWF:URLRequest = new URLRequest("swfs/home.swf");
One of the things that I love about AS 1/2 is with scrpt assist on, the ability to click a box and assign an action to a button (over, rollout, rollover, click, etc.). With action script 3, at least in CS4 that interaction isn't there and you have to write the code.I'm wondering if in CS5 there is that ability with AS3? Am I the only designer who misses this function.
I have a group of 50 buttons (named Bottle01 > Bottle50) that I want to have the same code on. The code I want is to, when pressed, put the buttons individual name into a variable and then move to a point later in the timeline. I have just started using as3 as I need this to work through Air and have been googling all afternoo and have cobbled something together, but it doesn't seem to work that well. This is the code I have sofar which is probably very wrong:
Not all of them only a snippet. Is there a short way of doing this. The only prob is each function will have a completely different piece of code in it eventually doing different things. I have 20 mc with 30 btns in each.
I am building an interactive world map, and for ease of updating am slapping all the functions in a frame on the main timeline.
Say I have a the word "Belgium" with a generic button symbol underneith it (instance name of Belgium of course), and also the maps shape of Belgium, as a button labeled, say Belgium_Map , each requiring several functions for rollovers, movement etc, is it possible to simple write one expresion and apply it to both buttons?
So can I apply it to my completly separate button with the path map.europe.belgium as well, without having to write out all that crap again for each, when they execute the same things?
The addEventListener will be in a forloop and applied to all the circles that are created. But how do I have the function apply itself to all the circle(s). How do I send an "circle" array as an argument or whatever it's called to that clicked function.
Say I have a the word "Belgium" with a generic button symbol underneith it (instance name of Belgium of course), and also the maps shape of Belgium, as a button labeled, say Belgium_Map , each requiring several functions for rollovers, movement etc, is it possible to simple write one expresion and apply it to both buttons?Im sure, like most things that one gets stumped on, it is pretty simple, however Im not sure of the syntax..My code looks something like this:
Right now, I have a gallery with many different thumbnails each individual movie clip symbols and not button symbols and each movie clip has a rollover and rollout function assigned to them which are all basically the same for each thumbnail.
Following is an example from a small section of the gallery thumbnails.
The above shows two groups of thumbnails grouped into individual movie clips (web01, web02, web03) each movie clip containing 3 thumbnails (btn04, sub04_1, sub04_2). I had done it this way for grouping and ease of animation.
I was wondering if it was possible to create just one function which executes the rollover and rollout functions so the script window would not be filled with so much repeated script.
I'm building a demo that has a keyboard in it. Obviously, people will type stuff with it and it will go into a dynamic text field. So I have a full keyboard (a movie clip named "keyboardStandard") made up of button symbols. That is placed in the same frame as the text field. Then I wrote this code, using the Q key ("keyQ"):
Code:
keyboardStandard.keyQ.addEventListener(MouseEvent.CLICK, addQ); function addQ(ev):void { enterPlayerID_txt.appendText("Q"); }
This works just fine, the Q goes into the text field. However, I sure as heck don't want to write 26 event listeners, then 26 more functions, even if it is copy paste. That's just gnarly. Plus, there are actually 3 keyboards - a numeric and special char one as well I need to handle.I seems passing a parameter from the event listener is not doable?
Well i have spent a long time getting the code i have so far from tutorials and the listener and function commands seem to work well for one button, but i need to know how to apply the existing code to the other buttons. This is the code i have:
Probably a misleading title. I meant function, not name ><I have a number of colour buttons in a custom made colour Picker. Each one has a name likecb0000FF, cbCC3333 etc, corresponding to the hex value. I'm having to make a function for each button like this though:Actionscript Code:else if((cb99CC00)==e.target) return;Is there a way to have only ONE else if function, such as Actionscript Code:else if((cbNNNNNN)==e.target)return;Basically referring only to the "cb" and then any combination of 6 random numbers = N?
My problem is that I am trying to use the following functions on 10 different logo movieclips. Each logo movieclip has a popup up box (another mc) within its timeline with a description in. When I hover over the logo movieclip i want it to call the forward frames function and on hover out call the rewindframes function.
function forwardFrames() { onEnterFrame = function () { if (_currentframe != 15) { nextFrame();
I'm fairly new to AS3 and CS4, and I'm trying to figure out how to write code that isn't needlessly repetitive. I'm not sure exactly how to streamline it, or if that's possible in my case. My issue in particular is with buttons. I have 40 buttons that perform the same function with a single variable, so I'd like to figure out if I can accomplish that without writing 40 separate functions.This is the current version: http:[url]......Here's the full code, with the relevant part in the last commented section:
It seems that something like that might work, but I don't know how to go about setting my variables up in an array or otherwise putting them in a state where an incremental statement could refer to them.The bigger issue, though, is whether I need to make a separate function for each button.Each button will do the same thing, just with one variable.When the user clicks a button, I want it to perform a function that will update text fields with text pulled from XMLList variables.Each button is given a unique identifier that corresponds to an index in the XMLList.So clicking the button just needs to establish that identifier as a variable n, so that the function can, for example, update the titleText text field with the text contained at titleList[n].
For the purposes of this example, let's just say that I want the mgInteraction function to trace the identifier (name, array index, or whatever) of the clip that's being interacted with (mg0/mg1/mg2/mg3). Is there a way to set this up to work with a single function, or do I need to create 40 unique functions, one for each button?The flash, if need be, is here: http:[url].......
i am working on small project where i find my self stopping at this rateMmm.. this project is dealing with buttons placed in MC name = main.ButtonCon the main i am programing those buttons as if
I have a movie with 5 movieclips named section1_mc, section2_mc, section3_mc, etcI want to advance to frames 1 - 5 by clicking in each of the movieclips. Do I need to add the onRelease to each of them, or is there a way to do it once for everybody. I tried the code below, but when I click on any of the movieclips the timeline goes to frame 5, the last one.
Code: for (i = 1; i < 6; i++) { _root["section" + i + "_mc"].onRelease = function(){
Instead of applying it to just one button I want to apply it to many on the stage, how do i add the names of the buttons to the function? I tried separating with commas but no luck
I have the following code for the button over/out effect. It is nice but instead of writing the same code for function for each button (I have 15 buttons), how to shorted the code by modifying it?
Code: Button1_mc.addEventListener(MouseEvent.MOUSE_OVER, navOver); Button1_mc.addEventListener(MouseEvent.MOUSE_OUT, navOut); function navOver(e:MouseEvent):void {
How would I go about making a search function that can locate an array of buttons?
The buttons direct to movieclips. The purpose is to have a search field in the flash project to help find specific movieclips (the buttons that direct to them, anyway) based on criteria using arrays. I am using Flash8, but have access to CS4 if necessary.
I have a movie that uses a next and previous button. The next button works the same on every page calling a function that uses next(). The movie continues until it is told to stop. The previous button takes you directly to a specific frame in the movie. When running through and testing, if I go forward a frame and then back to the beginning and then add a frame every time, it seems to work fine. But if I go forward 3 times and back 2, or mix it up in any way, the previous button will only work once. Then after that you can go forward as much as you want, but you can only go back once. Each frame that has a previous button has a unique function.
Here is my code below: stop(); import flash.ui.Keyboard; import flash.events.KeyboardEvent; stage.addEventListener(KeyboardEvent.KEY_DOWN, Next); Next_btn.addEventListener(MouseEvent.CLICK, Next); Previous_btn.addEventListener(MouseEvent.CLICK, Disclosure2); [Code] .....
What I'm looking to do is create a banner that transitions between different photos while there are small square buttons on the side that when the user clicks on them, it jumps to the corrosponding frame where a new photo begins showing. I've seen it a bunch of times on other websites.After following the advice found here: http:[url]....Everything was going well until I hit a snag. When trying to preview my movie I got the following error:1021: Duplicate function definition
Now, I know there is a very obvious error here in my button scripts, but as I said, I have no idea what I'm doing. Can someone look at my code and tell me what's wrong and what I should change? I'll post all five scripts.The instance names by the way are "sidebutton1" thru "sidebutton5" if that's any help.Here's my codes for each of the five buttons (one of these code bits per button)
sidebutton1.addEventListener(MouseEvent.CLICK,f); function f(e:Event):void{ gotoAndPlay(1);[code].......
I'm working with a dynamic slideshow that was already set up. Instead of thumbnails each image has a button that you click to see the image. I cant get the buttons to turn off for the categories that have less than 26 images. he button instance names are imgB1, imgB2,etc... they are in a container that is called: mc,collection_menu with an instance name of: collection_Menu basically in the script bellow the: visible=false is not working, is this the right syntax... what is wrong here
Code: // this is the main button to start the slide show collButtHolder.Bali.onRelease = function() {