ActionScript 2.0 :: Multiple-dimensional If Loops

Jul 31, 2006

creating If loops with multiple-dimensions. What I am trying to do is simple in concept: create "boxes" (square movie clips) surrounding another movie clip (one to the left, to the right, above and below). Essentially what I have so far looks like this:

--------SQUARE-------
SQUARE-Center-SQUARE
--------SQUARE-------[code].....

The problem with this is that as soon as I use the function createmoresquares, the for loop is run again for that second set of squares, but the original for loop to create the original set of squares is forgotten so that I end up with this:

----------------SQUARE--------
--------Center-SQUARE-SQUARE
----------------SQUARE--------

I know this all seems very confusing but the basic mistake I am making should be easy to resolve. I have the same problem creating multiple-dimensional arrays.

View 5 Replies


Similar Posts:


ActionScript 2.0 :: Multiple Loops Not Working?

Jun 30, 2009

I'm new to flash, and this is my first post.I'm using Flash MX Pro, 2004 V7.I have this code in the first frame:

________________________________________
for (i = 0; i < 5; i++){
_root.attachMovie("A","A_" + i, i + 10);

[code].....

View 2 Replies

ActionScript 3.0 :: Multiple For Loops Within Various If Statements?

Jul 28, 2011

I'm building a quick products display app for my company (basically customers put in certain numeric values and the app recommends a product based on the numbers.) I've done this with if statments and addChild()s

Now if they've gotten one result and they want to try with different values I need to removeChild() the product images from the stage.

So far I have this working by adding the addChild()s to an Array and using a for loop to remove them everytime the calculate button is hit. This works fine until I get to product double ups (some products can work across multiple values) then it errors.

Below is part of the code I've shorthanded some of the parts which are working fine as well as the repeat parts so that it's not just a whole blob of code

Code:
stop();
import flash.display.MovieClip;
equal_btn.addEventListener(MouseEvent.CLICK, equClick);

[Code]....

View 6 Replies

ActionScript 3.0 :: Multiple Tab Loops Creating Themselves?

Oct 26, 2010

I have created 2 separate arrays. One that contains all of the "options" and the other which contains all of the "products". Since the products change depending on the options, this way I can just update the products array whenever the filtering options get changed.So far, everything is working as expected. I can change the filters whenever I want and tabbing works exactly as expected.The problem arises when I click on one of the products.This brings up an informational popup. When that happens, I loop through the products array and the options array and set tabEnabled to false on all of them so that you can't tab through to items in the background. This works great. When you close the popup, I once again loop through the products and options arrays and set tabEnabled to true, but this is where the weird happens.

What happens is that you can now tab through the options and it goes through them all just fine, but when it gets to the end of the options, where it would normally start tabbing through the products, it skips them and goes back to the beginning of the options. HOWEVER, if you shift-tab from the beginning of the options, it goes to the products and as long as you are shift-tabbing, it will cycle through only the products. If you release shift and tab normally, it will tab through the products and when it reaches the end, jumps over to the options and tabs through those, once again skipping the products unless you are shift-tabbing.

I have traced the tab indexes and they aren't changing. I have no focusManagers implemented in the entire project. All of the various items are added programatically and dynamically at runtime. I'm at a loss here, and haven't been able to find anyone else with a similar problem... Any thoughts? Most of the options items are components (radioButtons and Checkboxes) if that might make a difference.On a side note, it also seems like whenever I set tabEnabled to false, when I set it back to true, I have to set focusRect to true as well. It seems to automatically set focusRect to false when you set tabEnabled to false as well. Is that normal? Seems like those should be independent of each other

View 2 Replies

ActionScript 3.0 :: For Loops For Multiple Classes On Stage

Dec 31, 2009

I have a document class of particles and i'm trying to add multiple instances of the class...

[Code]....

is this the correct way to add multiple instances of the class to the stage?

View 3 Replies

ActionScript 2.0 :: Storing Values In Multiple Loops?

Jun 28, 2008

for (var s = 0; s<mainSections.length; s++) {//grabbing the fabric types Handblocks,Screenprints,and Wovens
for (var i = 0; i<subSection.length; i++) { //grabbing each fabric design of the fabric

[code]....

View 4 Replies

Actionscript 3 :: Advantages And Disadvantages To Having Multiple Loops Flash

Jan 11, 2010

What are the advantages and disadvantages of having just one main loop and having a main class control individual objects on your stage, in oppose to having each individual object have its own loop and giving it the responsibilities of doing what ever it has to do on its own. What are consider best practices.

View 3 Replies

Flash :: Create Multiple Tab Loops In AS3 By Using Fl.managers.FocusManager?

Sep 7, 2010

I want to create a tab-enabled popup window in an AS3 Air project. Currently, when I press tab several times, the focus goes through all the components in my popup window and then starts focusing the buttons and TextFields from the components that are behind the popup. I have tried to solve this problem in two ways, but none of them worked. I will explain both of the methods here

[Code]....

View 2 Replies

ActionScript 3.0 :: Arrays And For Loops To Generate Multiple Buttons For Loading Images?

Sep 22, 2009

I have this array that contains the names of various images I want to load into Flash

var imageArray:Array=["image1","image2","image3","image4","image5","image 6","image7","image8","image9","image10"];

Now I want to create 10 different buttons with each button loading in an image. I know there's a way to do this with a for loop without having to make 10 different buttons and writing 10 different functions. Not sure how to correlate the members imageArray with the generated btns.

View 5 Replies

1 Dimensional Chart In Flex?

Apr 15, 2011

I want a bubble chart that just shows items along a straight line. So I'd like the horizontal axis to essentially not exist. I have it working right now with the yField assigned to a field that happens to always be '1' on my test dataset.. but this is not going to be the case in general, so I need some way to restrict the y-axis... preferably without needing to go back to my model and parse through all my data to add a dummy value '1' on each entry.

Unfortunately setting min/max values just cuts off anything above or below rather than restricting entries.

I set computedMin and Maximum (no idea what they are and the docs don't really explain) but it didn't seem to restrict the data in any way.

View 1 Replies

ActionScript 2.0 :: Traversing 3 Dimensional XmL?

Mar 5, 2010

I have this as xml :

[Code]..

I wanna parse it and install it on in array or an object how do i that?

View 1 Replies

ActionScript 3.0 :: Sorting A Two Dimensional Array?

Mar 8, 2009

have a twodimensional array that consists of 6 other arrays(like array[0 to 5][0 to 4]). The [4] of each sub-array is a indexnumber that i'd like to use for sorting the array[0][x] toarray[5][x] according to their array[x][4]-value. How would I do

View 3 Replies

ActionScript 3.0 :: Two Dimensional Array With 2 Col And Two Rows?

Apr 19, 2011

I couldnt find how to form a 2x2 matrix as old  pascal days in ActionScript. All arrays are only one row.  How can I change it.

View 3 Replies

Flex :: Multi-dimensional Arrays In AS3?

May 5, 2011

I am currently playing around with flex, I have C++ background, so I am not used to AS3.The problem is in the main*.mxml file I have fx:script block and I try to define a multidimensional array like that:

public var Board:Array = new Array(25);

I use a function to initialize the 2d-array:

public function initBoard():void {
var i:int;
var j:int;[code]....

This function gets called later on in the main loop to init and reset the "board" why doesn't it work. The only difference to the AS3 documentation is that it gets done in a function.

View 2 Replies

ActionScript 3.0 :: Sort A Two-dimensional Array?

Feb 8, 2009

[code]...

How can I sort the two-dimensional array superHeroes by the "city" or [1] value?

View 5 Replies

ActionScript 2.0 :: Multi Dimensional Array From Xml?

Mar 9, 2010

How do i traverse multidimensional array so i can turn this into value objects :

Code:
<accordion_nav>
<item branch="PATIENT TYPES" level="1" treeID="10.00">[code]......

so each items has a propery of branch, treeID, and level?

View 0 Replies

ActionScript 2.0 :: Accessing The Two Dimensional Array?

Dec 22, 2005

i am amuthavalli. i am new to the action script. so i want to know how tho define and access the two dimensional array in flash

View 1 Replies

ActionScript 2.0 :: External 2 Dimensional Array?

Aug 1, 2006

I have been working on this flash project for some time now. it is a calender program, one week at a time. (see the screencapture). My problem right now is that i am trying to load data into flash from a database as a two diminsional array. currently i have a two diminsional array in flash named num. num holds values for the color of each box: for example num[2][0] holds a number (1-8, each corresponding with a color) for the first box in moday for employee 3. How would i parse information so that the arrays can be filled with data from a text or asp file (MIME format). I tried to do this: num[0][0]=2&num[1][2]but it didnt work.

View 5 Replies

ActionScript 2.0 :: Invoking Two Dimensional Arrays?

Nov 29, 2007

I am trying to create a two dimensional array in AS2. It should have two values like name and roll no. and stored in such a manner that they can be traced out and also the corresponding values should be together.

as of now I am using...

myArray1.push({name1:inpName,roll:inpRoll});
trace(myArray1);

View 1 Replies

ActionScript 2.0 :: Multi Dimensional Array From XML

Mar 3, 2008

Images I am loading from XML are associated with the right record on first load but then on refresh they swap places.I am loading XML and creating arrays.Then I pass the array data to objects using loop functions.the AS counts how many books there are in total then and creates the objects and passes informations regarding each book into the individual objects.when I trace the array data just before starting the loop function I get a good consistent read:[code]

View 1 Replies

ActionScript 2.0 :: Get (two-dimensional) Array Position?

Aug 30, 2004

I found the tutorial about getting the index of something in an array, but i need the same for a twodimensional array, so i get [0][1] for example. How do i alter this code to do so?

Code:
Array.prototype.getIndex = function(data) {
for (i=0; f=0; i<this.length; ++i; ) {
if (this[i] == data) {

[Code]....

View 1 Replies

ActionScript 3.0 :: Find Out Dimensional Of Loaded Image?

Jun 25, 2009

I have loaded image file . I want to find out width and height of desire image. [code]...

View 1 Replies

Professional :: Calling Strings In 3-dimensional Array?

Feb 17, 2012

Here's the bare bones of what's causing me a problem:

var txt:Array = [mtxt];[code]........

View 2 Replies

ActionScript 3.0 :: Multi-dimensional Array Search?

Dec 28, 2010

i do have problem with searching through my multi-dimensional Array to insert newly value to currently existing value..what I have now....

Code:
var someArr:Array = new Array(["apple"],["orange"],["watermelon"]);

so what I wanna do is I able to search the desire valeu 1st and append to existing value eg;

word search = apple

match and I can append new value to this particulars array and my expecting result new array after append new value

Code:
var someArr:Array = new Array(["apple","expensive"],["orange"],["watermelon"]);

View 9 Replies

ActionScript 2.0 :: Get The Two Values In A Two Dimensional Array Separately?

Jul 5, 2011

How can I get the two values in a two dimensional array seperatly. I mean in myArrow[1,1] I want the two values seperatly.

View 1 Replies

ActionScript 3.0 :: Parsing .txt File To Two Dimensional Array?

Nov 14, 2011

I am trying to parse data from a user created .txt file and convert it into an Array. This data will eventually be used to output an .xml file or to generate html. The user has no experience or knowledge of XML otherwise there would be no need for this post, I would just parse XML. The data will be set up as a group of items (term and definition, question and answer as well as a type to determine the attributes of the item) like so:

1. How many licks does it take to get to the center of a tootsie pop?
a. The world may never know.
t. ML

2. What is the square root of 69?
a. 8 something.
t. SA

I am currently able to allow a user to have an Open Dialog box to open a local .txt file from their computer. I am also able to read the data and trace it via actionscript. I cannot however split the data where I want to into an array. I cannot use '' to split at as the data from the .txt file may sometimes be multi-line for the question or answer.

So I need to be able to; a) split on a number with a . and a space (eg. '1. ') b) split on a-e with a . and a space (eg. 'a. ') and c) split on 't. '.

Here is the relevant code I have so far:

ActionScript Code:
import flash.text.*;
import flash.net.FileReference;
var tf:TextField = new TextField();

[Code]....

I was just trying to hardcode a couple things like splitting on 'a. ' and 't. ' but it only does one split, whichever comes last.

View 2 Replies

Actionscript 3.0 :: How To Order Multi-dimensional Arrays

Jul 24, 2009

I have an 2D array that will look summat like this:

var numbers:Array=[[10,1,3],[9,2,4],[8,3,5],[7,4,6],[6,5,7],[5,6,8],[4,7,9],[3,8,10],[2,9,1],[1,10,2]];

now how do I order this array by the 3rd number so it looks like this:

2,9,1, 1,10,2, 10,1,3, 9,2,4 , 8,3,5, 7,4,6, 6,5,7, 5,6,8, 4,7,9, 3,8,10

I have tried:

trace(numbers.sortOn(0,Array.NUMERIC));

returns:

5,6,8, 9,2,4, 8,3,5, 7,4,6, 6,5,7, 10,1,3, 4,7,9, 3,8,10, 2, 9,1, 1,10,2

trace(numbers.sortOn(2,Array.NUMERIC));

returns:

5,6,8, 9,2,4, 8,3,5, 7,4,6, 6,5,7, 10,1,3, 4,7,9, 3,8,10, 2, 9,1, 1,10,2

trace(numbers.sortOn(3,Array.NUMERIC));

returns:

5,6,8, 9,2,4, 8,3,5, 7,4,6, 6,5,7, 10,1,3, 4,7,9, 3,8,10, 2, 9,1, 1,10,2

spaced out for ease of reading.

View 2 Replies

ActionScript 2.0 :: Function With Two Dimensional Array As Argument

Feb 22, 2005

I want to write a function which has 2 dimensional array as one of its arguments
_global.getList = function ( type:Number, list[]:Array )

This is giving syntax error, if I do
_global.getList = function ( type:Number, list:Array )
Then there is no error, but then, list is now, single dimensional array, which I don't want. Whats the correct syntax to write it as two dimensional array?

View 1 Replies

ActionScript 2.0 :: Dynamic Multi-Dimensional Arrays

Dec 4, 2005

following on from B.Rich's great Multi-Dimensional Arrays and attachMovie tutorial, i'm trying to load the array from an external source.i've got a text file that outputs: url... i then try to break this down in flash into a multi-dimensional array that provides info for dynamic buttons:[code]however its not working at all. i'm not sure if its because the attachMovie loop is not getting initiated or what..

View 12 Replies

ActionScript 2.0 :: Multi-Dimensional Arrays And AttachMovie?

Mar 10, 2006

I visit this site almost every other day and it has been a sort of online Gita for me. I am a designer and I find advanced actionscript really tugging at my brain cells.

memberInfo = [["1","http://www.madmusings.com"],["2"],["3"],["4"],["5"],["6"],["7"]];
xPos = 100;

[Code].....

As you can see I got it working this far. Now I want to have an inner loop so that only 5 buttons ["container"] come in the first line at yPos=100 and next five in the second line at yPos=150.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved