ActionScript 2.0 :: Incrementing An Array Of Movies?
Jun 13, 2005
I'm trying to create a spinner for different ads for an advertising company website. Each ad has a name, such as "out" "pie" and "bigger". All of them are turned off except "pie" to start off with:
Code:
//initialize movie
var itemArray:Array = new Array();itemArray[0] = out;
itemArray[1] = pie;
itemArray[2] = bigger;
[code]....
The thing is, I can' figure out the button script to cycle through this array. I want to click a forward and back button, lets use forward for now, and do something like (don't mind the syntax):
Code:
on (release) {
i+1, remember the spot, and make everything else invisible.
When you click again, you increment to the
next ad/instance name and so on.
}
What is the actual syntax for this?
View 3 Replies
Similar Posts:
Jun 2, 2009
the user needs to select an answer from a dropdown list. I am then creating an array that will store the answer to each question when the user clicks the submit button. Each of the drop down menus is named sequentially. So what I am trying to do is write a while loop that will increment through and read each of the values into the array so I can process the responses later. The issue that I am having is writing the syntax to recognize the Instance name of the specific drop down I am trying to reference.
Here is the basic code I am using:
var Store:Array = new Array(2);
public var Increment:Number;
Increment = 1;
[code]....
So the DropDowns instance names are DropDown1, DropDown2 etc... It works fine if I manually enter in each instance name (but there are 43 total and I don't want to do each one individually).
I am assuming that I need to setup some sort of variable to temporarily add the increment number to the "DropDown" and then use that as the reference:
Increment = 1;
while (Increment <=2){
ItemNumber = "DropDown" + Increment;
Store[Increment] = MovieClip(Scroller2.Form_Scroller.content).ItemNumber.value;
trace(Store);
Increment++;
}
But when I do that, I get the following error message:
TypeError: Error #1010: A term is undefined and has no properties.
at combotest/submitted()
I assume this is because it is looking for an instance of ItemNumber instead of the instance of the value of ItemNumber.
View 5 Replies
Oct 30, 2010
I have my code in the root first frame. I would like to know is it posible to attach movie from the library to array, but tu have that array created in some movie clip so the path to the newly created instance would be _root.some_movie_clip.array[i].
the code goes like this:
Code:
for (i=0; i<11; i++){
displayed_icons[i] = attachMovie("my_library_mc"+i, "new_mc_"+i, this.getNextHighestDepth());
[Code].....
View 3 Replies
Mar 16, 2011
I have 5 movies in my library, called question0, question1, question2, question3, question4. I linked them with export for actionscript. I have an Array, called questions. Then I have a button that calls the getQuestion function. But I get the following error:
[Code]....
View 2 Replies
Jun 7, 2007
is there anyway to put all movies that are attached with attachMovie in an array?
ex.
attachMovie ('ball','ball1',this.getNextHighestDepth())
then it will allso run a code that push the array with 'ball1' ? ?
View 2 Replies
Nov 30, 2010
I've got about 50 buttons onstage with names like btn1a_mc, btn2B_mc, etc. Each one loads an external swf (called "Monosem1Aslideshow.swf", where the "1A" corresponds to the button name.) into a movieclip holder called slideHolder_mc. I'm trying to use an array instead of writing code for each button. I'm using the following:
Code:
buttonNumber = ["1A", "2B", "3C", "4D", "1E", "2F", "3G"];
for(i=0; i<buttonNumber.length; i++){
var btnName:String = "btn"+[i]+"_mc";
[Code].....
But I can't seem to get it to work.
View 7 Replies
Jan 5, 2012
I would like to randomly move three movie clips, placed in an array, within a set box. The script below worked with used with one movie clip, but not with all in an array.
var clipSpeed:Number= 1;
var speedX:Number = 0
var speedY:Number = 0
[code]....
View 3 Replies
Nov 30, 2010
I've got about 50 buttons onstage with names like btn1a_mc, btn2B_mc, etc. Each one loads an external swf (called "Monosem1Aslideshow.swf", where the "1A" corresponds to the button name.) into a movieclip holder called slideHolder_mc. I'm trying to use an array instead of writing code for each button. I'm using the following:
Code:
buttonNumber = ["1A", "2B", "3C", "4D", "1E", "2F", "3G"];
for(i=0; i<buttonNumber.length; i++){
var btnName:String = "btn"+[i]+"_mc";
[Code].....
But I can't seem to get it to work. I'm a little shaky on array syntax and can't find a tutorial that addresses my particular problem.
View 12 Replies
Apr 7, 2010
Basically i want to run a loop that will change all of the colors of the movieclip instances.... so i have setup an array[code]...
View 6 Replies
Jun 23, 2009
I'm new on AS3, I'll try to explain what my project consists: Well, There is a main.fla and It loads external movies triggered by button items. The content animation sequence introduction starts with tweenLite and fills the stage with elements from Library (movieClips, buttons) and some sprites. I've built the intro animation through actionscript. Perhaps I'll need to explain how I did it the TweenLite structure, but the code lines are too long
The transitions / navigation:
Each button before load the external movie has a respective animation that removes the other buttons from the stage. It triggers an "outro" animation and then loads the External Swf.
First:
Each external Swfs contains a removeChild action in a MovieClip that CLOSES and removes the movie.. Like a "pop up" with a close action. After closed It should replay the intro animation and replace the buttons in the stage but it's not happening because I don't know how to communicate between different timelines / external movies.
View 1 Replies
Apr 6, 2010
Basically i want to run a loop that will change all of the colours of the movieclip instances.... so i have setup an array:
Code:
var Black_Orbs:Array = Array("info_mc", "name_mc", "lift_mc");
function change()
[code]....
View 4 Replies
Jan 16, 2007
I have an intro.swf file that is basically a movie with sound that is exported for actionscript but not exported in the first frame. I just stuck it in a movie on my timeline and it works great and the preloader works because it doesn't load the sound before the preloader. I use :
musicSound = new Sound();
musicSound.attachSound("music");
musicSound.start();
to play the sound in intro.swf.
However, now this intro.swf gets loaded into an index.swf and everything works fine and the sound plays as long as I have the sound included in BOTH the intro.swf and the index.swf and the sound is exported on the first frame in the index.swf. I was hoping I could remove the sound entirely from my index.swf since it already loads into the intro but so far
View 9 Replies
Oct 25, 2005
I have been having trouble creating a movie clip with a reverse rollover effect within a movie which has a reverse rollover effect. that sounds confusing
In essence I wish to create a panel that rolls out on rollover and rolls back in reverse when the you rollout. I have done this using this script
[Code]...
However I wish to make movies within this movie that have the same effect on them. But when I create another movie or button within this movie it is not registering on rollover. I guess because the script on the main movie overrides it?
View 2 Replies
Feb 18, 2012
When the user presses the space bar, I'm trying to take one string from a series of strings labeled c1-c9, break it into an array, display that array, and then increment the linenumber variable at the end of the function so that the next time the space bar is pressed, the next string in the series is traced and so on and so forth. Here is the relevant section of script (the strings and the linenumber variable have been declared earlier)
[Code].....
Every time I press the space bar, though, I just get the traces of the initial string and linenumber value repeated without any incrementing. I think it may have something to do with the "this" before the bracket in this line var displayarray:Array = this["c" + linenumber].split(" "); which I found in a code sample on some website and do not understand at all, but I get compiler errors if I try to join the "c" and the line number without the "this" there.
View 1 Replies
Mar 29, 2010
I try to increment each 2 hours but I don't know how to proceed.
View 2 Replies
Sep 28, 2009
I'm working on a flash movie that involves the use of rotating 3 objects in a matter that the first one moves 18000 degrees cw according to the value in the 'num' variable. The 2nd object rotates -1800 degrees. The third one rotates 180 degrees.
What I actually want to do is create a movie of the older analogue electric meters that had the 5 dials that represented each digit so if the far right dial moved from 0 to 5 the 2nd would move the opposite way to be between 0 and 1 and the third a hair to the right of '0' and so on in increments of 1/10.
When I run the below code the dials ( I currently useing jetplanes until I draw or locate a pointer image file as well as the circle with 0-9 marked off in it) stay on 500 and should be moving a bit since I have another variable that increments num by 1. I tried using the Timer event and would get several errors. I also know that the way it runs now doesn't work since num is going to be assign the same value of 18000 since I have it setup to gotoAndPlay(1) in frame 2. How would I be able to have it so that so it would increment without getting undefined variables. I also tried a for loop to increment the num but the stage would instantly show the end result after the loop was done.
code
--------------
var num:Number = 18000;
var i:Number= 0;
[code]...
View 0 Replies
Oct 3, 2009
Just having problems with incrementing the x property of an object by 0.01 using a timer.It works with 0.1, but does not seem to work with the value 0.01 (commented code).[code]
View 3 Replies
Nov 16, 2009
I'm trying to get a text field that behaves like a fake hit-counter. Adding random numbers and getting larger each time:
My code doesn't add up though, it just replaces the text each time!!
var incrementTimer:Timer = new Timer(1000,0);
var lastNumber:uint = 0;
incrementTimer.addEventListener(TimerEvent.TIMER, incrementNumber);
incrementTimer.start();
[Code]......
View 1 Replies
Mar 15, 2012
I basically have a text file with a username variable that assigns usernames to username1, username2, and so on. I would like to create a loop that checks to see if that username was created and if it was a conditional statement will follow. The problem I have is I want to do a loop with a counter(var i) and increment that counter in the loop and concat that with loginName to input that into a dynamic textfield labeled loginName1. (Actionscript 2)[code]I am using loadvars to load 2 text files, one has username and ip(username1 = blahblah ipaddress1 = blahblah and so on), the second file has an array that has ipaddress and data usage passed in an array. i want to check how many usernames there are and check the ipaddress of that username against the other file containing ipaddresses and usage.) I have everything setup, but im running into issues when writing a loop to check for username1, username2, and so on.
View 2 Replies
Apr 24, 2010
I've solved this problem in AS2 but I can't seem to sort it out in AS3.[code]...
View 1 Replies
Jan 6, 2007
I'm working with a gallery grabbing images from data extracted from an external XML file, and I'm trying to make it work in a hierarchical or folder like structure in Flash 8.For instance, thumbnails are displayed on load, and when a thumbnail is clicked, more thumbnails specific to the image clicked are displayed.As sort of a beginner to Flash and ActionScript, I've been working with this project for a couple months.There is one obstacle I'm facing within the 'for' loops I'm using.First, an example of my XML file is like this:[code]This way displays the catalog look just as I'd like, but it is only good for the first piece of art since this 'for' loop only loops through the <products> node within the first <art> node. Now, if I change 'this.childNodes[0]'to 'this.childNodes[1]',I can display the <products> for the next <art> node.The part that I have not been able to figure out is how to increment that 'this.childNodes[x]' so that I can use it in an onRelease function.
View 4 Replies
Jun 17, 2011
i'm trying to add values to a variable.[code]a simple drag and drop on a MC.i would like to store the X displacement when i drag. let say i have 30 in a variable wich store x position of myMC, if i drag the MC 200 units the variable should read 230 and so on.
View 2 Replies
Feb 3, 2012
I have a problem creating scores in my game. how can i stop it from incrementing +1? [cod]e...
View 2 Replies
May 20, 2005
I've followed several tutorials on how to do this, but my dynamic text box always returns a value of "Nan" when I try to increment it's value.I've been trying to use Code:_root.total = _root.total + 1;] in an on release function. Even if i managed to get this to work though, I still need to reuse the variable i'm incrementing within other calculations.
View 2 Replies
Mar 6, 2009
Just getting up to speed on looping and incrementing variables. A real time saver.I have a onRelease function that I would like to apply to several button objects:
phase1a.but1.onRelease = function() {
p=0;
thisImage();
}
I need the p variable as well as the target but1 to increment. This is my first attempt:
for (n=1; n<=23; n++) {
phase1a.but[n].onRelease = function() {
p=[n+1];[code].......
I get a good trace on n showing that the incrementing is successful but nothing on p when the button is clicked and no execution of the function thisImage(). Not getting any errors either. Can you not loop an onRelease statement?
View 13 Replies
Aug 31, 2006
I'm working on a class which extends MC. I would like to be able to do the same as this line: movieclip._width++. I already havewritten the function which modify the status of my MC and works perfectly. But now I want link it to a property, so any variations applied to this property calls the function and modify the MC.
View 1 Replies
Jul 1, 2010
i have a set of images with incrementing names image1, image2, image3 etc and i have a series of empty movie clips on the stage also with incrementing names mc1, mc2, mc3, etc
i wanted to use this:
mc_empty.addChild(my_loader);
to display a series of images into the series of movieclips on stage my_loader is an incrementing variable, and that works fine with the .addChild however, when specifying what addChild is loading content into, it doesnt seem to favour variables as names, it only seems to like real instance names thought i could use
getChildByName("mc_empty"+num)
like this:
getChildByName("mc_empty"+num).addChild(my_loader) ;
but that doesnt seem to work with .addChild either
View 7 Replies
Jun 23, 2009
I'm adding several similar movieclips to the stage with a 'for' loop. However, I'd like to increment the position of each movieclip when added on to the stage. I know exactly where I want each movie clip positioned as well. At the moment I just have a small 'for' loop which setups the movieclip. Like so...
[Code]...
View 1 Replies
Mar 13, 2011
I am working on an app, where the server time needs to be displayed on a Flex app.
The idea is to make a BlazeDS remoting call getServerTime() once during the app intialization and then use a local Timer class to keep updating the display.( I don't want to bombard server with getServerTime() for each second). My question is, once I have a AS3 Date object. How do I increment it by seconds?
[Code]
View 1 Replies
Aug 13, 2008
I have a script which places a clip on the stage (well, just off it), and rotates the clip and then tweens it to a certain x/y coordinate based on the rotation using TweenLite, and all of this on a setInterval of 2 milliseconds. That works well. Thing is, I don't seem to be able to set a unique name based on the clipname and an incrementing number. Basically (and this isn't the whole thing, this is just the general idea), it goes:
Code:
interval = setinterval("dothis", 2);
var increment=0;
function dothis(){
attachMovie(movieICall, "movieICall" + increment; 1)
movieICall._x = ;
_y= etc;
increment++;
}
So when I set the interval to 2 seconds, it moves everything well and there are no problems. When I set the interval to 2 milliseconds, the clips only get just onto the screen before disappearing. I've tried creating a function to handle the x,y, tween. So I could refer to the clip with a "this", but it doesn't change anything. The only thing I can think of is that movieICall is not incrementing, and every clip on the screen is being referred to as movieICall, in which case the next case of x, y, tweening overwrites that last one and effectively kills the last one (but then why is it not just left sitting on the screen)? I tried adding an overwrite: false to the end of the TweenLite, but that only let the tween happen once and then...nothing.
View 1 Replies