ActionScript 1/2 :: Simplify With Array Loops?
Jul 11, 2009
I have a test here which is for a more complex interaction, but the principle is the same. What I would like to know is how to make the code more efficient, possibly through array loops?
View 5 Replies
Similar Posts:
Jun 21, 2008
I have this switch and I know there must be an easier way to accomplish this. For example if the user selects something it sets that button to a certain frame in this case nSelected, and sets all other buttons to a frame labeled nDefault.[code]...
View 4 Replies
Jun 20, 2011
how can you access elements in a 3D array using for loops?
View 4 Replies
Jun 27, 2011
I was generating a four-dimensional array using for loops, but I kept getting undefined when reading from the variable. Just to test the thing, I created a new Flash file and typed this into the first frame:
ActionScript Code:
test = new Array();
test[0][0] = 24;
trace(test[0][0]);
When I ran the SWF, the trace window displayed undefined. The same happened when I replaced the 0's with other numbers. Is there something wrong with the way that I am defining the array?
I'm using Adobe Flash CS4 and ActionScript 2.0.
View 2 Replies
Jun 14, 2007
I have this xml document thats created via php that looks like this. (Note: sample of the xml not full.)
HTML Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<cms_item>
<product_item>
<product_id>1</product_id>
<product_name>chairs</product_name>
[Code] .....
This is created from a database and the xml is the a combination of the two data tables. Now I have created a class file which can read this xml data or any xml doc in that format of childNodes and what not and return the results as an array. Is it better to work straight from the xml object or from the array. And is there a better way of doing this so its a lean mean array creating machine?
View 1 Replies
May 26, 2009
I have an animation that has roll overs controlled by AS (see code below). It works the way I have the code, but it's really messy code. And I hate that I'm have the functions rewritten for each event.How can I simplify this code?
//On the main timeline
var gearsEnabled:Boolean = true;
var gears2Enabled:Boolean = true;
[code]....
View 4 Replies
Aug 9, 2010
how can i simplify this code:
PHP Code:
stop();
import com.greensock.*;
import com.greensock.easing.*;
import flash.events.MouseEvent;[code]........
I think, for loop can be used but i don't know how
View 1 Replies
Apr 3, 2011
im a complete noob. how would i get this code into a simple 'for loop' to add 3 sprites named heart1, heart 2 and heart3. basically to simplify this mess
ActionScript Code:
var heart1:Sprite = new Sprite();
with (heart1.graphics) {
beginFill(0xFF0000);
drawRect(0,0,20,10);
[Code]...
View 4 Replies
Feb 14, 2007
Been reading up on the flash transition object. I came up with this way of fading out one clip and fading in another and having them loop forever using the transition objects but it's very dirty coding and not very flexible.
Is there a way to clean it up so that I can add as many clips as I want without having to write more code, just by adding more movie clips to the stage?
[Code]...
View 2 Replies
Dec 16, 2010
I have this code that's repeating for 40 different instance names that play 40 different movieclip names.
Is it possible not to repeat all this code for every instance name? For example creating a function that catch the instance name that is pressed and plays the correct moviclip name?
[Code]...
View 4 Replies
Oct 4, 2009
i have an application in which i have around 100 textinputs all are numbers
i want to simplify the addition ie. any other way than saying txt1.text+txt2.text.....
that would increase my code a lot
is it possible to have (n+=txt*.text) or some thing like that
View 1 Replies
Dec 8, 2009
There are 3 properties (example 1):
[Bindable] public var name:String;
[Bindable] public var email:Number;
[Bindable] public var address:Boolean;
I needed to have 3 helper methods that will be bindable too (example 2):
[Bindable] public var name:String;
[Bindable] public var email:Number;
[Bindable] public var address:Boolean;[code]......
View 3 Replies
Dec 16, 2010
I have this code that's repeating for 40 different instance names that play 40 different movieclip names.Is it possible not to repeat all this code for every instance name?For example creating a function that catch the instance name that is pressed and plays the correct moviclip name?
Code:
pressed=false;
clic=null;
[code].....
View 3 Replies
Nov 15, 2011
Last week I made a class to simplify rollOver and rollOut event of a button based on MovieClip with ENTER_FRAME event. It works well but I'm not quite sure this is the best class, since I'm new in AS3 Classes. Now, if you don't mind to take a glimpse of my class.
Here is the class
Code:
/**
* VERSION: Early
* DATE: 2011-11-15
* AS3
[code]....
View 2 Replies
Sep 28, 2009
simplifying this piece of code right here using "for (i=0,i<numberOfArtists,i++) ;in order to make it dynamic by passing a variable for the amount of artists via XML.
labelArtist1.sideArtistsList.gotoAndStop(1);
labelArtist2.sideArtistsList.gotoAndStop(2);
labelArtist3.sideArtistsList.gotoAndStop(3);
[code].....
View 1 Replies
Jan 16, 2012
Are there any programs or features in flash that can simplify flash vector art?
I just realized that one of the reasons why my program might be running so slow is that I made the images out of lots and lots of circles. When things didn't look right I often just put larger circles over smaller ones. I didn't think that flash might still be drawing the invisible circles underneath-
View 1 Replies
Mar 29, 2009
Shouldn't flash detect these before running the script and crashing and having to force quit and restart (and flash startup takes a while)? Like just give an error: infinite for loop or something? And this happened to me a bunch when working with for loops within for loops, when I accidentally used the same variable for both loops, so of course it never ended and crashed flash.
View 2 Replies
Nov 29, 2010
The scenario is to create a lotto game that matches 6 user inputted numbers with 7 randomly generated numbers. The 7th number is a special case (eg bonus ball) WOULD LIKE TO SHOW A KIND HEARTED FALSH GENIUS ALL OF THE SCRIPT IF POSS! (its not tooo long) This code works, but it just outputs the default message: There seems to be a problem with my arrays not comparing? Part of the code is: (prioir to this the user inputs numbers, they are copied to text areas beginning with O, on a button press) On a second button press randomly generated number appear to a timer. //compareResult checks how many numbers match between the two sets of numbers to determine winnings.
[Code]....
View 4 Replies
Jul 25, 2011
I'm new here and I'm wondering if I can use the Sound Loops for commercial uses?
View 3 Replies
Feb 7, 2011
I have section of code which works for bouncing some fish movie clips off of the 'ceiling':[code].....
However, I would like to find a more succinct way to program this using a 'for loop'. I tried the following, which did not work and gave me an error (posted at the bottom). [code].....
TypeError: Error #1010: A term is undefined and has no properties.at Function/<anonymous>()
View 3 Replies
Apr 1, 2011
I'm pulling data from an xml doc and created 4 XMLLists to hold the children of the 4 different elements. Inside the onLoad function, I created a series of for loops to go through each list. But Flash stops after going through the first two. I'm very puzzled by this. I got around it by creating a 2nd onLoad function for the last 2 lists, but should I be using a different loop? Curious.. I inserted a break after the first 2 and then the 3rd loaded up...
View 1 Replies
Jun 8, 2011
I've got the following code and i would like to add an delay of 200 ms after each trace statement
for (var x_pos:uint = 0; x_pos <= 12; x_pos++){
for (var y_pos:uint = 0; y_pos <=12; y_pos++){
trace("hello world " +"("x_pos+","+y_pos+")");
[Code].....
View 4 Replies
Jul 25, 2004
i am new to flash and i was wondering if there is a way to slow down for loops.Like i can set how many seconds till it goes and loops again. I have tried setInterval but didnt work.here is my code:[code]
View 10 Replies
Aug 11, 2004
My situation is that in the game I'm making, I have a movable turret firing duplicated bullets. I need to hittest them against a duplicated set of oncoming robots. I've tried using a for loop, but I just can't get it to work.I've attached the .FLA, and I would be grateful if anyone could point out what I'm doing wrong (ignore the values for removing the clips and the random duplication; I had to shrink the stage size to make the file size smaller!)
View 3 Replies
Nov 24, 2004
why this code dosent work at the same time in the timeline, and why only envent put inside the attacHMovies or duplicated Movies work, if i put them in the forr loops they don work.
Code:
img01 = new Array();
img01 = ["001.jpg", "002.jpg", "003.jpg", "004.jpg", "005.jpg", "006.jpg", "007.jpg",
[code].....
View 10 Replies
Jun 28, 2005
are there loops in flash like Do while loops, or for next loops?
View 1 Replies
Sep 14, 2005
I would've thought of a better title but I honestly have no idea what's going on. I have this code on the main timeline:
Code:
dots = new Array();
for (i = 0; i < 10; i++) {
[Code]...
View 1 Replies
Apr 9, 2006
I want to attach a MC dynamically so that I have 12 rows and 12 columns of _mc box on the main stage:[code]I think it can be done only with a nested loop but so far, well, my head's in a loop!
View 11 Replies
Feb 26, 2007
Code:
var cityArray:Array = new Array();
cityArray[0] = "southland";
cityArray[1] = "otago";
cityArray[2] = "westland";
[code]....
What have I done wrong? I'm trying to give each mc it's own number based on the name position in the array etc etc - It returns 18 for all of them when I click them one at a time.
View 7 Replies
Aug 17, 2002
Why nested loops must be used. I have this code that I took from the Training from the source book:
v = 0;
i = -1;
while(++i < 2){
j = -1;
while(++j < 2){
[Code] .....
What I don't understand is why I have to have this to create two columns couldn't I just change the while (++i < 2){ to
while(++i < 4){ instead.
View 3 Replies