ActionScript 2.0 :: Multiple Buttons - Linking To Directory With Similar Name
Sep 29, 2009
I am creating a map of the US. I've created a button for each state and named each button with it's 2 letter state code (AL, AK, AR, etc) in the library. I would like for each button to link to a directory on the site with a similar name, /site/map/AL, for example.
Rather than set up each button individually with script like:
on (release) {
getURL("/site/map/AL", "_parent");
}
Is there a way to consolidate the 50 buttons in to a few lines of code? If the destination directory were to change in the future I would then only have to change a couple of lines of code instead of 50 instances. I'm thinking the name of the button could be read and passed in to the button function, but I'm no programmer and not familiar enough with Actionscript to know where to start.
View 6 Replies
Similar Posts:
Feb 5, 2011
I'm using the below code to have a button that adds a MC to the stage. The problem is that I have over a dozen of these buttons and I'd rather not have to write out the event listener and function for every single button. Is there a way to use a single function for all the buttons and just change what MC is added based on which button is clicked? So if the user clicks on the draw5 button the function adds the deck5 MC to the stage?[code]
View 7 Replies
Aug 28, 2011
I have a flash movie with 3 buttons I am trying to link relativley to pages within my site, I have one working fine but can't get the others to link and when I try it makes the one that is working, work no more..
Below's the code I am using for the one that is working;
import flash.events.MouseEvent;var getIndex:URLRequest = new URLRequest("../index.html");
//---Enter Button---\
[Code]....
View 5 Replies
Oct 5, 2007
I have a small flash movie with three buttons I would like to link to three different URLs. My code for these is below, however, when I test the movie there is a namespace error (copied below). I assume this is because both buttons are trying to use the same variable but I have no idea how to make this work in AS3.
where i need to make changes so the code understand that "thisButton" should take the user to URL#1 and "thatButton" should take the user to URL#2?
This is for my own site and I have to use AS3 as there is an FLV on it as well which requires AS3 to be viewed.
FIRST BUTTON
//when they click the "light" button go to the www.site/About page
this.lightButton.addEventListener(
MouseEvent.MOUSE_UP,
function(evt:MouseEvent):void {
[Code]....
View 9 Replies
Oct 13, 2003
I've been trolling the web all day looking for button FX sounds similar to 2 advanced. Can't find any and my deadline is running out. Nothing I have on hand is right for this job.
If u have these or similar FX for buttons etc can u send a wav or aiff???
View 1 Replies
Jan 13, 2012
I am adding a different listener to each button in the menu and there are several menus as well, then each one of those functions adds a different child depending on the button and also pushes several values to the Array list, in this example called objectsOnStage. I will be running this structure function 40 times with each of the highlighted elements changing accordingly.
//Listener and function for Button01
menu01.button01( MouseEvent.MOUSE_DOWN, button01Function);
function button01Function(event:MouseEvent):void
{
[code]....
My original thought was to keep all those changing values in an Array list and run a loop for the function/listener, but I just cant make it go.
View 5 Replies
Apr 5, 2009
Iam having 3 buttons in stage and three corresponding movieclips. When I clicked on one button, it should play its corresponding movieclip from the second frame. (Same case for the rest of the buttons).Here the action for the three buttons are almost same, only the movieclip differs. In AS2, I can optimize the script for the above activity as below
for (var i = 1; i<=3; i++) {
_root["btn_"+i].onRelease = function() {
myname = this._name.split("_")[1];[code]..........
My Question is ===>is there any way to add the Event listeners for all the 3 buttons using "for loop" instead of initializing it for each buttons seperately ? [Imagine if we have more than 10 buttons and it will be very boring to add the listener for each button in a seperate line ].
View 2 Replies
Jun 6, 2011
I have a site that has multiple pages of similarly sized buttons. These are magazine covers. I'd like for the mag covers and links they point to (loaded swfs) to be dynamically loaded via a text file, if possible. The client always has new magazines she's been in and to manually load the newest buttons first is time consuming.
View 3 Replies
Nov 19, 2009
I have a directory of PDF's that I am loading the names of dynamically using PHP: My PHP file looks like this:
[Code]...
Now the code works perfect and it displays the name of all the pdf's but I want to somehow make a button on top of each displayed pdf that makes it clickable. The code is already storing the name of the PDF's so it should be pretty easy to do a getURL("pdfname","blank") or whatever I just don't know where to start. Here is the SWF output: [URL]
View 1 Replies
Feb 9, 2010
When I have a class linked to a MovieClip in my library and that class takes an argument in its constructor method. That class will compile properly ONLY when it's located in my top-level directory (same dir as the .fla and Document.as files). If I move that class to a deeper directory, say com.place, and update the package statement and symbol link appropriately, the compiler will generate error "1136: Incorrect number of arguments. Expected 0."Create flash project and put a rectangle on the stage. Covert it to symbol and assign it to class TestPanel - or whatever you choose. Also configure the fla so that is uses a Document (Main) class.Create Main.as and TestPanel.as in the same folder. In the Main class, instantiate a instance of TestPanel and add it to the stage. Flash will, predictably, add the rectangle symbol and everything is fine.Now modify TestPanel so that its constructor method takes a Number and have Main.as pass some number to TestPanel.[code]You now get the error: 1136: Incorrect number of arguments.Expected 0.When I move the TestPanel.as into a deeper directory, Flash somehow is looking elsewhere for the base class for Symbol, even though I'm mapping that Symbol to com.place.TestPanel.
View 4 Replies
May 20, 2009
I have got a very simple flash timeline, on each frame is a different page of a book. There is four pages alltogether. I am trying to create 'next' buttons so that the user can flick through the book.
This is the code I have used:
stop();
btn_1.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler1);
function mouseDownHandler1(event:MouseEvent):void {
gotoAndStop(2);
[Code]....
View 1 Replies
Jul 7, 2009
This was created with frames in dreamweaver and the nav bar and index page movie are swf files. When you click on the pages in the nav bar it redirects to the index page. It does this the majority of the time and every now and again when you click it will go to the actual page.The way it is set up in dreamweaver, it has the nav movie in the top frame and the content in the bottom. All I did was change the old i.p address to the domain name because our host changed. I did nothing else and then this started not working correctly.I have checked and double checked all links in flash and they work from the swf but when it is loaded in the browser it does that weird linking to the index again. This is the code in flash to link to the pages:
on(release) {
getURL("http://www.fostersfreeze.com/Food.html","_top");
}
[code]....
View 4 Replies
Aug 5, 2009
Is there a way to link a button to a .SWF file and if not is there a way to import an .fla file into a new scene of a different .fla file and then link the button to that scene? I am kind of a beginner to actionscript but I know some basics and am willing to learn.
View 1 Replies
Apr 7, 2008
I'm having trouble figuring how to get the buttons to reference the correct imageBox and position the imageHolder. The imageHolder is a movieclip on the main stage and inside of that are a series of imageBoxes attached for each image. You can click on each image and the imageHolder will move and the images will enable and disable. If you click on a button the current image will fade but then return to 100% alpha. It's not completing the disableImages function.
You can view a swf of it HERE. Probably viewing it will be better than anything I can describe.
This is the actionscript for enabling and disabling images and for positioning the imageHolder: ActionScript Code:
function disableImages() {
for (i=0; i<imageTotal; i++) {
imageHolder["imageBox"+i].enabled = false;
[Code]....
View 3 Replies
Aug 3, 2010
I am creating a project that will have 28 different "link" actions to appropriate flv clips that will then play in the center of my program/project. I am starting to realize that in Flash CS4 you can only import one flv clip at a time.
How can I bring in multiple flv clips? I have started to create seperate layers for all the possible flv clips then I have created buttons out of my text and then provided script that would look for the mouse event of "click" that would then send the user to a lable that I have named on an "action/lable" layer thus playing the appropriate layer or flv clip.
All the flv clips are going to be inside the project since there is no access to the internet or a server. All project files would be on one computer at a display with a touch monitor.
View 3 Replies
Feb 18, 2009
I have created 3 invisible buttons over a graphic. Each has its own button layer and action layer. For each action layer I have used:
my_button1.addEventListener(MouseEvent.CLICK,clickHandler1);
function clickHandler1(event:MouseEvent):void{
navigateToURL(new URLRequest("
[code]....
When I test the movie I see the hand icon so I know it's an invisible button, but when I click on it, it goes out of the flash play like it wants to go to a browser, but nothing happens. When I upload the files I can see the hand icon again, but nothing happens when I click on the link. I tried the changing the .html file that it is housed in to an .htm file, but that didn't work either.
View 8 Replies
Aug 27, 2008
I am new to this. I have followed several tutorials with noluck. I am using action code 3. I want to link an invisible buttonto an url. I placed the code in the layer with the button.Thefollowing code I have used, but then follows the error message. Ican't figure it out.1180: Call to a possibly undefined method on.1120: Access of undefined property release1180: Call to a possibly undefined method getURL.
View 2 Replies
May 2, 2009
I am currently working on an outdoors project. You can view the website here to see what I mention below.
The problem I am running into is that I want the Yahoo, Camospace, and Myspace logos to link to their respective websites when clicked.
All of the current action scripts I have found do not work for me at all.
I am using Flash CS4 v10, action script 3.0
View 6 Replies
Nov 7, 2010
Im making a flash program about pancakes (random I know). I have a "Mainmenu" scene and then a "Recipe" scene. I have a button on my mainmenu which takes me to the recipe page when I click it, the code behind the button is
"stop();btn_recipe.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);function mouseDownHandler(event:MouseEvent):void { gotoAndStop(1, "Recipe"); }"
Then when I arrive at my recipe page I have a button which will take me back to my MainMenu, the code behind that button is:
"stop();btn_home.addEventListener(MouseEvent.MOUSE_DOWN, mouse5DownHandler);function mouse5DownHandler(event:MouseEvent):void { gotoAndPlay(1, "MainMenu"); }"
So I run my program and the first button works and takes me to recipe page but the button to get to the main menu does nothing, click it and no response or anything
View 3 Replies
Feb 9, 2011
I have laid out the four pages that I wish and have created a button for each page on each page.I was told a simple stop script would stop the pages acting like a movie.I entered:
14:00PM
stop();
function button1_clicked(e:MouseEvent) :void{ gotoAndStop("home");}
function button2_clicked(e:MouseEvent) :void{ gotoAndStop("about");
[code]....
which I was told would accomplish this and link the buttons to the relevant pages. When I test the movie the buttons start flickering as well as the images.....
View 2 Replies
Jan 11, 2009
how to link moviclip to rotating buttons. the experiment button is working but do not know how to link the others.
View 1 Replies
Oct 4, 2009
i'm just a newbie....i want to link a button to some moving thumbnails...this is the code
[Code]...
View 0 Replies
Jan 11, 2010
So I have 3 buttons. One button links to an animation, the second button links to a different animation, and the third one shows the links. The first button works properly, but when I click on the second button, it goes back to the animation that is shown at the first button. How do I fix this? Here is my code for the first button:
button2.addEventListener(MouseEvent.MOUSE_DOWN,mou seDownHandler);
function mouseDownHandler1(event:MouseEvent):void {
gotoAndPlay(1, "random");
}
I have made sure that the button's instance name is button2, and that the scene name is "random".
Here is my code for the second button:
button3.addEventListener(MouseEvent.MOUSE_DOWN,mou seDownHandler);
function mouseDownHandler2(event:MouseEvent):void {
gotoAndPlay(1, "random1");
}
View 2 Replies
Mar 19, 2011
basically I had a situation arranged where when a button was clicked and flash would then display a certain image by jumping to a label on the timeline, and by clicking a different button a different image would be shown. this was working pretty well but for layout reasons I had to split these buttons and the timeline that they relate to up into separate movie clips. obviously the buttons dont do anything now, but what i'm hoping to find out is how I can link these items back up despite them being in separate movie clips. is this possible?
View 0 Replies
Mar 27, 2012
1. I have very little flash experience, but have been tasked with creating a presentation.
2. I have decided that if each slide was a movie clip, it would keep my timeline tidy.
3. In the attached fla, you will see there are 2 slides, with (green squares) for buttons. The purpose of the button in the first slide is to advance to the second movieclip in the timeline and the purpose of the button in the slide2 movie clip is to go to and play the label "start" from the first movie.
However, nothing I do seemed to work. I'm hoping someone can talk me through it so I can replicate the button functions throughout the file for multiple movieclips / 'slides'
I've attached a txt file with the URL to where the .fla can be downloaded
View 9 Replies
Aug 13, 2007
I have made some advanced buttons and want to use then to navigate to a different frame in the site this is what have
b1.onRelease = function() {
this.gotoAndStop(10);
View 1 Replies
Jul 19, 2010
why my 3 pages are not being brought up when i 'ctrl enter'. I am making an online game with 3 pages - an instructions page, game screen and end game screen and do not know why my initial page is not opening.It is sending me the error message:Error #1010: A term is undefined and has no properties.at MainClass$iinit()[code]
View 1 Replies
Feb 22, 2011
I am relatively new to Flash development. I have a scene that contains 3 buttons that are movie clips. I am trying to link each button to a seperate scene but no matter what script i use the buttons do not click through to the new scene.
Each scene consists of 20 frames that need to play when each button is clicked on, so rather than using gotoandstop i am trying to use gotoandplay to a specific frame within each of these scenes.
View 1 Replies
Jun 22, 2004
i have a movie in which i have 3 movieclips..lets call them MC1, MC2, MC3.In this movie i have 3 buttons linking to respective movieclips.but the button does not show any actionso far i have the actionscript on the button is:
on (press)
{
targetPath('MC1')
[code].....
View 2 Replies
Jul 12, 2009
I just want different-looking movieclips to move in the same way so that I will only have to edit one file if I want to change their behavior, instead of copying the class file and renaming each one, and then I would have to edit the builder function name and class name inside each one as well, even though it would do the same thing.
View 2 Replies