IDE :: Complex Loop CurrentTarget Variables
Feb 1, 2010
i'm trying to create a menu system where each item expands in height when clicked but is then collapsed back to the original state when other items are clicked.m is the height of the expanded state. n is the height of the collapsed state. i is the number tacked on the instance name.Also, I'm using Tweener for smoother transitions. I've done this already by copying out the code but it's 24 items so 24x24 lines of code when I'd like to be able to do it a little more elegantly. Here's roughly what I want to do, but don't know if it's possible:[code]So every box below the one that's been clicked on most recently gets the value of m added to the y value and every box above doesn't.Is it possible to retrieve the value of the variable i that corresponds to the currentTarget?
View 1 Replies
Similar Posts:
Aug 25, 2010
I have a number of MC's that I've assigned listeners to through a loop that references an xml table.
//create listeners for all biketrails mc's and designate functionsfunction createListenersbk():void{for(var i:uint=0;i<bktrlXml.row.length();i++){var mc:MovieClip =
[Code].....
I thought I'd be able to replicate the above code and somehow refernce the "idlink" children through the e.curentTarget.
View 1 Replies
Feb 21, 2009
How can I make a bunch of variables from a for loop. for example for (var i=0; i<total; i++) {var bunch(i);}. that i make a bunch of variables named bunch1, bunch2, bunch3. I keep getting errors. I program and use so many different languages that I dont know if that can be done with AS3. my only other alternative i can think of is to create some sort of event dispatcher object array. but I dont know how to get them all to send events to one listener with there index number.
View 5 Replies
May 5, 2011
Say, I had a loop in a function...
[Code]....
How would I refer to a in another function
View 8 Replies
Jan 24, 2012
Okay, now things are getting a little complicated. I need to build a Flash object that can sit over the corner of an image to serve extra content. It's way beyond my Flash skill level, my work is usually limited to print work in Photoshop and Illustrator so please excuse me if any of the following isn't clear. I am trying to learn though, So this is how it's all supposed to work, along with my issues; When the image & Flash item load a small looping animation will play to draw the eye/show the item as interactive.
When the user rolls over this the corner will peelback. I have a working peelback animation for the rollover, that reacts to mouse over/mouse off, and a looping animation for the initial, but I cannot work out how to make the initial loop until mouseover, then play the peelback when the mouse is over. And go back to the initial animation loop if the user rolls off. (Each of these animations is stored as a movie clip in the Library)
Then it gets more complicated... if the user stays on the corner until it is fully peeled back I need to make a small countdown (sort of a 3, 2, 1 situation) show, before launching a lightbox (would this have to be jQuery, or could it be done in Flash?) in the browser to serve the content.
[Code]...
View 1 Replies
Jan 23, 2011
Is it possible to use a for loop to "combine" array variables..g.
Actionscript Code:
var myArray1:Array = [1, 2, 3]; var myArray2:Array = [1, 2, 3]; for (var i:Number in myArray1 && var i:Number in myArray2) //is something like this possible? { ...
[code].....
View 4 Replies
Jan 1, 2011
How am i to get the variables zombData.zomb0, & zombData.zomb1 from inside the "for loop"
I want this trace command dynamic
Quote: trace(zombData.zomb+i);
it works when i put zombData.zomb0 (a variable sent from a PHP script)but if i want to make it dynamic how it is; It fails & outputs NaN How do i make it dynamic for the loop?[code]...
View 1 Replies
Jan 5, 2010
I have 24 movie clip buttons. Named "btn1" through "btn24". I can't figure out how to return the variable as a number that cooresponds to each button onRollOver.
[Code]...
View 2 Replies
Jan 2, 2011
i'm trying to use a for loop to generate for me a set of vars, but it's not really working out. =.=.
I'm loading the image file names from a xml, and i want that the for loop create vars like "fotoToLoad0, fotoToLoad1 ..." and load the filename within.
I guessed i had to use the eval command, but as far as my ignorance sees it, when it is used, the eval makes a variable reffer to another and not fill it's value. (I guess i'm wrong thou).
Here's what i've tried so far:
Code:
for (i=0; i< totalNodes; i++){
var fotoEnd = imagesXML.firstChild.childNodes[i].firstChild.firstChild;
var fotoTemp = eval ('fotoToLoad'+i);
fotoTemp = fotoEnd;
That's quite not working thou =(. If i try used 'fotoToLoad1" for example, in a text box it just returns undefined
View 2 Replies
Apr 23, 2009
I used to dynamically set some variables using a FOR loop kinda like so PHP Code:
//Sorry, from memory
var possibleValues:Array = ["red","green","blue","yellow"];
for (i=0;i<possibleValues._length;i++){
_root["colorNumber"+i] = possibleValues[i];
}
Second question, using that code in a function would set the variables at the root level making them available throughout the timeline. Without "_root" how do I get that variable available to everything?
View 7 Replies
Jan 24, 2010
I need to make new sprites on-the-fly within a for loop, and this code does not work:
Code:
for(var i:int = 0; i<5; i++) {
var this['menuBtn'+i] = new Sprite();
[code].....
View 2 Replies
Dec 20, 2011
I'm trying to get specific variables out of a for each loop. These variables are used to display a click event on a marker on a map. If you click the marker on the map, the details pop over it. Now these details are being overwritten each time the loop starts (50 times). The solution I'm looking for, let's me select a marker on the map with the according detail attached to it.
There might be an easy solution but I haven't found it yet.
The code : for each(artistXML in artistList.events.event)
[Code]...
View 1 Replies
Sep 9, 2009
i'm having trouble creating an image preloader with a loop. my apologies, this might be a very simple task that i've been pulling my hair out over for an hour.
i have 8 UIloaders. each named image1,image2,image3, etc. they are inside a movie clip called "allClips_mc".
this VERY long, redundant code works:
Code:
magicBox_mc.allClips_mc.n1.image1.source = "newsClips/images/newscast01.jpg";
magicBox_mc.allClips_mc.n2.image2.source = "newsClips/images/newscast02.jpg";
magicBox_mc.allClips_mc.n3.image3.source = "newsClips/images/newscast03.jpg";
magicBox_mc.allClips_mc.n4.image4.source = "newsClips/images/newscast04.jpg";
[Code]....
View 2 Replies
Oct 6, 2010
ActionScript Code:
var val1:Number = 10.80;
var val2:Number = 11.54;
var val3:Number = 12.22;
How would I express this in a loop?
var sum:Number = val1 + val2 + val3;
View 3 Replies
Feb 15, 2005
Here's what I've got:
var cColor1:Color = new Color(mcBut1.mcFill);
var cColor2:Color = new Color(mcBut2.mcFill);
var cColor3:Color = new Color(mcBut3.mcFill);
var cColor4:Color = new Color(mcBut4.mcFill);
var cColor5:Color = new Color(mcBut5.mcFill);
What I'd like to do is write a loop to handle all that code in less code. So, how do I define variables using variables?
Something like:
for (var i:Number = 1; i < 6, i++) {
var cColor+i = new Color(eval("mcBut"+i).mcFill);
}
View 2 Replies
Apr 26, 2002
I've a .txt-file containing variables. The variables are structured like this:
aaa_301, bbb_301, ccc_301
aaa_302, bbb_302, ccc_302
...
[code]....
View 9 Replies
Nov 21, 2010
I want to declare 8 variables at the class level like this:
Code:
private var graphicDesign1:Sprite;
private var graphicDesign2:Sprite;
private var graphicDesign3:Sprite;
private var graphicDesign4:Sprite;
[code]....
But I would like to do it with a for loop. Is that possible? If so i'm doing it wrong this is what I have.
Code:
for(var i = 1; i < 9; i++){
private var +"graphicDesign"+i:Sprite;
}
View 1 Replies
Apr 11, 2005
Code:
var x:Number = 0;
var y:Number = 0;
var i:Number = 1;
[Code]....
i have no access to y in the (x < 600) loop... yet i gets incremented every loop.
View 2 Replies
Feb 15, 2005
Here's what I've got:
[Code]...
What I'd like to do is write a loop to handle all that code in less code. So, how do I define variables using variables?
[Code]...
View 2 Replies
Apr 18, 2005
i wanna create a photo album.this is thumbs page.
Code:
for(i=0;i<2;i++){
this.createEmptyMovieClip("logo_mc"+i+"", 999);
loadMovie(""+i+".jpg", logo_mc+i+);
}
how can i solve this problem about variables??
View 5 Replies
Sep 4, 2010
The plan is to set up variables to react to a flashvars value like this:
[Code]...
There would be many mainVars (over 100, actually) and this setup isn't working.
View 1 Replies
Feb 3, 2011
want to make this stuff working.
Actionscript Code:
for (var i:Number=1; i<=3;i++){ var char_name+i = event.target.data.char_name_ + i;//It should be like//var char_name1 = event.target.data.char_name_1;//var char_name2 =
[code]....
View 2 Replies
Sep 4, 2010
The plan is to set up variables to react to a flashvars value like this:[code=html]<param name="flashvars" value="mainVars=1" />[/code]
[Code]...
There would be many mainVars (over 100, actually) and this setup isn't working.
View 2 Replies
Jan 21, 2009
I'm using a few for() loops to populate my game. Now, I have 2 versions of each function, one that executes when my variable "debug" exists, and the other that activates only if "debug" does not exist.Looks kinda like this:
ActionScript Code:
// first, if debug exists, the script will execute for the single instance of my movie clip "myBox_0".
if(debug){
// assign a value to the string "myTarget"
[code]....
Now, on the line I starred*, if I enter "images/0" instead of what you read there, then it works. But when I try to use the variable "i" then it gives me the error "Error opening URL 'images/undefined.png'" I ran a trace statement to track "i" through the code and it works up until I enter the tellTarget statement... how can I get my script to pass that variable through that statement?
View 2 Replies
Jul 19, 2009
i want to query about a point here,
Now, When i make a loop for example a "for" loop
ActionScript Code:
var i:int;
for (i=0;i<4;i++){
// Looping Code For 4 Times
}
in the looping code, when i use a variable, for example "myVar"
Can i make the variable name be "myVar0" in the first time looping, and the name be "myVar1" in the second time looping, and so on ..
View 6 Replies
Dec 30, 2009
Is there a way to make the variables generated from a for loop within a function accessible to other functions? because at the moment other functions are firing errors because the variables refferenced are from a different function.
You may of seen this code from other threads
ActionScript Code:
function nodePoints():void {
//VarName, mcName, XPos, YPos
var row1:Array = ["clientComp", new clientComp(), 100, 200];
[Code]....
View 5 Replies
Jan 24, 2010
I can't create new variables within a for loop:
ActionScript Code:
for(var i:int = 0; i<numBtn; i++) {
var this['menuBtn'+i] = new Sprite();
}
This doesn't work, saying I need an identifier before 'this'.
What I am trying to do is to make a dynamic menu, and the number of buttons depend on how many files there are in a directory, as each button links to each file;I get this value (numBtn in my example) from a php script, and I need to make a menu depending on it, but I can't seem to make it so that when I add a new file into that directory, a new button comes up on the menu and I don't have to change my flash file.
View 9 Replies
Apr 2, 2010
how can I access my different array variables in a for loop?what i need to do is for every increment in my for loop i want to change my var array name so that i don't need to use if else condition.
Code:
var ship_array:Array = new Array("spaceship1", "spaceship2", "spaceship3", "spaceship4", "spaceship5", "spaceship6", "spaceship7", "spaceship8", "spaceship9", "spaceship10",
[code].....
View 0 Replies
Apr 30, 2010
I've looked arround and cannot seem to find exactly what I am looking for.I have a movieclip that I want to get a number of instances to the stage. Instead of declaring them individually (which works):
var a1_mc:monitor = new monitor();
var a2_mc:monitor = new monitor();
var a3_mc:monitor = new monitor();
[code].....
View 7 Replies
Sep 4, 2010
The plan is to set up variables to react to a flashvars value like this:
Code:
<param name="flashvars" value="mainVars=1" />
Code:
var videoArray:Array;
var videoTitle:String;
var videoFile:String;
[Code]....
There would be many mainVars (over 100, actually) and this setup isn't working.
View 0 Replies