ActionScript 2.0 :: Build New Array From _width Values In Loop?

Sep 9, 2007

I have a bunch of thumb mc instances on my stage, using the same mc symbol. They're all sized differently so the widths(which are same as heights) vary.I want to be able to access their width value from an array independent of all the scaling I'm doing with rollovers. That is, I need to have each mc instance's original width accessible from anywhere in my code.The simplest way to do this is to hard code an array, like:

var Twidth:Array = new Array();
Twidth[0] = "33";
Twidth[1] = "45";[code]....

But since I have 22 thumbs and several portfolios, and want the option of changing their original sizes on the stage, I want to create the array above on the fly using information in a loop. For instance, I already have a loop in a function called generateThumbs(). Here's what I've tried:

for (var i = 0; i<total; i++) {
Twidth = new Array();
Twidth[i] = this["thumb_mc"+i]._width;[code]....

for trace on the first method, replacing 'i' with the key I want (Twidth[2]):

undefined
undefined
45
undefined
undefined

As you can see, this gives me non-indexed non-delimited value for the whole loop (the actual in my real movie is 22). There's no length or array because its actually just one value. Entering a number in the key will display a bunch of undefined with one defined. I have no way of extracting that one key without getting all the other undefined values.my question is: How do I put 'this["thumb_mc"+i]._width' values into a loop with each value indexed for the rest of my functions to access?

View 2 Replies


Similar Posts:


ActionScript 2.0 :: Create An Array Storing All This Values, _width, And MC To Load?

Mar 2, 2004

I'm making a portfolio, it has a large amount of images, one by work, (maybe there are 25) and they are put in a horizontal band, the images all have the same height, but not he same width, and they load an external MC of each work.So I want to create an array storing all this values, _width, and MC to load.

Secondly I have a frame like a stroke of the picture, the frame is in the center of the band of images, and there are two arrows, one to move on the band to the left, and other to the right. The thing is that when I push the arrow the band must move 15 px on left or right, and te frame must adapt (with easing) to the _width of the image.And one more thing, there will be many many images in a future, so I would like that a user if it's holding the left or the right arrow for a medium/long time it could make the band of images to go faster from one to another. I think it's so simple of changing the speed of the movement, what I don`t kwow is how to know if the button is pressed for a long-meidum time.

View 1 Replies

Actionscript 3 :: Loop Over Array With Xml-values?

Dec 7, 2011

So I have an array, which consists of xml-values. I want to check a node from each array entry. I've tried reaching xml-values as such:

var eventArtists:XML;
for each (xmlEvent in arEvents)
{

[code].....

View 1 Replies

ActionScript 3.0 :: Adding Previous Numeric Values In Array During For Loop?

May 23, 2009

While a for loop runs through all the elements in an array I want to get the width of each element and add it to the sum of the width of all previous elements.

View 2 Replies

Flex :: Pass The Array Values (not The Array Collection Values) To The Bar Charts Or Column Charts?

Sep 7, 2010

Is there anyway where I can pass the Array values (not the array collection values) to the Bar charts or column charts using flex 3.5...

here is the thing i want:::

I have array values like this,,

array1 = [23, 49, 40, 239, 20, 80, 39,49,120, 24, 31,41];

and i want to show these values on the Yaxis and months on Xaxis....

I have two Qns,

1) how can I pass this array to Bar chart or column chart.

2) how do I need to show months on Xaxis. beacuse I'm asking this regarding, I have kept a filters that even if we want to see some months or a particular months or perticalar span of months... there on Xaxis it need to change the months dynamically depending on the filters..... (for ex, on Xaxis the values should be (Jan, Apr, Jun,Oct) if i select the 3 months period filter....)

I have written a logic to collect the values of those particular months into an array, but not understading how to pass this array to Bar chart,, beacuse there I don't know what Xfield and Yfield to be given....

View 1 Replies

Actionscript :: Build A Colour Hex Value Using 3 Decimal Values?

Feb 11, 2010

basically i want to build a colour hex value using 3 decimal values.

for clarities sake, the 3 decimals i have are

255
254
253

and i want to generate the hex string:

0xFFFEFD

how would i do that?

View 1 Replies

ActionScript 3.0 :: Loop With Varying Values Depending On Where Are In The Loop?

Jul 20, 2009

I have need of loops / nested loops that pick different figures depending on where you are in the loop. The whole function needs to run through 'ml' times. 'ml' is a dynamic figure. Loop 1 = While the loop is within the first 12 iterations, 'exconemp' must equal 100. For iterations 13 - 24, 'exconemp' must equal 102.5, for 25 - 36 it will be 105.06, for 37 - 48 it will be 107.69. This needs to change every 12th iteration until it has reached 'ml'. The calculation takes the value of the previous 'exconemp' and then multiplies that by 0.025.

Loop 2 = While the loop is within the first 120 iterations, 'abc' must equal 0.015 and any further iterations must use 0.01. This must also work in a way to figure out whether 'ml' is higher or lower than 120 and work accordingly. My main issue is this - how do I get the loops to run through as this: While the iteration is < 12, do this, THEN take the final figure (12th iteration) and start on 13 - 24, do this THEN etc etc. How do I produce a THEN statement? I can get the code to pick up the final values, but not change along the way.

[Code]...

View 6 Replies

ActionScript 3.0 :: Remove Values Past An Array Length And Clear Entire Array?

Oct 8, 2009

I'm using the .unshift method therefore the newest values go into [0] and the rest are pushed down.

What is a good method to remove a value from an array once it has passed a certain length? For example i only want my array to hold 5 values.

Also, is there a method for clearing the entire array, ie removing all values? Or will i have to manually change all the values with a loop?

View 2 Replies

Javascript :: Passing An Array Values From Html Into Flash Array?

Oct 20, 2011

anyone knows how to pass an array values from an HTML into flash? Well, to begin I'll discuss what am I doing. I edited a twitter widget javascript which search tweets based on the hashtag I needed then passing it on an array per tweet and then displaying it using a <div> it updates once every 5 minutes. Now I want to display those tweets on a dynamic text on Flash. Let's say I will have 5 dynamic text placed on my flash file then; I want each of those dynamic text to have the tweets I have based on on my HTML arrays to be displayed in random.

View 2 Replies

ActionScript 3.0 :: Array Of Color Id-s Represents A 3D Array Of Values?

Mar 5, 2011

Array of color id-s represents a 3D Array of values. I've represented each value with a color(Blue is 1, Red is 2 and Green is 3). So for the example the array for the image would be[code]...

Now, I have an array of predefined shapes/objects. I'd like to replace the grouped colors with the shapes that I have. I'd like this to follow the rule of finding the largest shape first and then down to the smallest one. [code]...

View 1 Replies

ActionScript 2.0 :: Setting Array Values To Variables In Another Array

Dec 11, 2007

I have some variables created on the main timeline and a mc called options which will be where those variables can be manipulated. A way I've tried to this is by creating a first array(array1) and populating it will all the variable names found on the main timeline, and another array(array2) containing the values of the variables the user has changed(which are displayed on some dynamic text fields). To make these changes, an "apply" button is pressed which will set the values found in array2 to the variables in array1.[code]How would you do this so that var1, var2... are updated properly according to the values found in array2?And because array2 contains strings(read from dynamic textfields), how do you deal with that since var1 and var2 are numbers?

View 6 Replies

ActionScript 2.0 :: Using Attribute To Build Array?

Feb 1, 2010

i have xml that looks like:

Code:
<features>
<screen leisureGallery="true">
<client>Gator Golf Cart</client>[code].....

everything is on frame 1 in the movie, several layers.all items in the XML are displaying; it seems like my checker doesnt work?

View 1 Replies

ActionScript 2.0 :: Build A Nested Array From Xml File

Sep 19, 2009

I am trying to build a nested array from my xml file.so that I then can build some photo slide shows.[code]What I want to do is be able to access the xml data by array notation.For example: If I want the to load the 1st photographers 2nd Gallery adn 3rd image I would say something like:[code]

View 0 Replies

ActionScript 2.0 :: Loop With Two Values?

Nov 13, 2011

I want to do a loop of this

Code:
t_1=parseInt(mcArray1[0]);
t_2=parseInt(mcArray1[2]);

[code]....

View 3 Replies

ActionScript 3.0 :: How To Build Grid Of Identical MCs In Multidimensional Array

May 17, 2009

I'm trying to build an 8x8 grid of identical movieclips, in a multidimensional array, that I can then access by row, and play each in order. So far, I can get them into the array, but I'm having trouble playing each item in a row. Basically, I have 8 more selector buttons in another array, and I added an event handler to each of those, and I want to use the index position of each selector button to play the corresponding row in the first array.

Code:
//The first Array
for ( i = 0; i< 8 ; i++) { //create a row
beatsArray[i] = new Array();
for (var j:Number = 0; j<8; j++) { //add 8 instances to the row
beats = new Beats;
addChild(beats);
[Code] .....

View 2 Replies

ActionScript 3.0 :: Build Function That Creates A 2D Array Similar?

Feb 9, 2011

I keep confusing myself :S I've been staring at this screen too long.I'm trying to build function that creates a 2D array similar to this one:

Code:
private var test:Array = new Array
(

[code].....

View 2 Replies

Actionscript 3.0 :: Loop Not Incrementing Values

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

ActionScript 2.0 :: Storing Values Using Loop

Apr 18, 2008

I have five buttons on stage and I simply want to trace "1" when I click the first button and trace "2" when I click the second button and so on.I am always getting the last number and cannot figure out, how to store the values.

View 4 Replies

ActionScript 2.0 :: Build Some Array That Describe The Geometry Of Each State Mask?

Dec 4, 2006

I think I could build some array that describe the geometry of each state for each piece of the mask, then use the Tween class to change them interactively, but I'd like to do it in a more simple way...

View 10 Replies

ActionScript 2.0 :: Variable Button Values In Loop?

Mar 15, 2010

I have a query regarding assigning values to buttons in a for loop, I will explain:This is a string which I want to assign to a button value via getURL:

var myURL = "http://www.mywebsite.co.uk" + "/?Group=" + mySharedObject.data["destination"+i] + "&" + "SearchType=654&" + "Target=offers&" + "Paging=on&" + "HotelName=" + mySharedObject.data["hotel"+i];

[code].....

View 1 Replies

ActionScript 2.0 :: Loop Through Children In MovieClip And Get Values

Nov 8, 2009

I have a movie clip (mc_moviegroup) which is made of a group of many dynamic text fields. I want to loop through the dynamic text field children of mc_moviegroup and pull out their text values in a string. Does a movie clip have a property which gives the number of it's children movieclips?

View 2 Replies

ActionScript 2.0 :: Output Values For Buttons In Loop?

Jan 13, 2009

I have this little loop that creates buttons. My aim is to change value of variable 'thevalue' on everytime button is pressed, first button should give value 0, second 1, third 2 and so on.

Code:
for (jo=0; jo<xmlData.firstChild.childNodes.length; jo++) {
value1= xmlData.firstChild.childNodes[jo].attributes.value;
_root.attachMovie("button", jo, (1000-jo), {_x:20, _y:20+(jo*20)});

[Code]....

View 2 Replies

ActionScript 3.0 :: Build A Small App That Will Iterate Through An Array Of Sound Files To See If They Are Valid?

Sep 11, 2009

I'm trying to build a small app that will iterate through an array of sound files to see if they are valid.I'm simulating corrupt sound files by taking .png's and changing the extension on them to .mp3 The idea is a sound will start playing and the timer will start. When the sound is done playing the next sound will start and the timer will reset and start counting down again. If a sound does not finish within 45 seconds the timer will complete, output the name of the file that did not finish, and then skip to the next file. For some reason though the timer does not reset when the sounds finish playing, it just keeps counting down from wherever it is.

Code:

import flash.display.Sprite;
import flash.net.URLRequest;
import flash.media.Sound;
import flash.media.SoundChannel;

[code]....

View 1 Replies

ActionScript 3.0 :: Loop And Create New Arrays From Each Of The Values In The CategoryArray?

Mar 23, 2009

I have a array of categories, for e.g.

var categoryArray = new Array('value1', 'value2', 'value3');

I would like to loop and create new arrays from each of the values in the categoryArray I tried...

for(var i=0;i<=categoryArray.length-1;i++){
this[categoryArray[i]] = new Array();
}
value1[0] = "dsfsdf";
trace(value1[0]);

It doesn't seem to work.

View 3 Replies

Actionscript 3 :: Flex In Construct When Modifying Loop Source Values?

Dec 9, 2009

DISCLAIMER: relatively new to Flex/AS3, I might be missing something obvious. After doing some research it appears that using the for(var property:String in object) does not guarantee the enumeration order of properties, however it doesn't say anything about modifying the VALUE that property points to as changing the for...in loop.

[Code]...

As a solution I can create a temp object to store the data while doing the loop on the original object, and then replace the original object with the modified data, but I'd like to know what exactly is going on.

So my question is, does the value of object property modify the looping order of the for...in construct? And if so, should it or is this a bug?

View 3 Replies

ActionScript 2.0 :: Loop - Extract The Individual Values From A Nested Xml Node

Mar 4, 2007

im having problems with a nested loop. i found some post here, but they didn�t help me. i need to extract the individual values from a nested xml node. i simplyfied the xml.
this is the code:

[Code]....

View 1 Replies

ActionScript 2.0 :: Pre-calculate The Perlin Noise Values And Then Loop Through It In An OnEnterFrame

Mar 9, 2007

i got this perlinnoise called function and movieclip.filter = [displacementMapFilter] inside a onEnterFrame and it's eating me at 100 percent. are there any substitutions for making it much less processor intensive? I'd like to show a picture rippling and i'd like to use perlinNoise. Is there a way i can pre-calculate the perlin noise values and then loop through it in an OnEnterFrame

View 7 Replies

ActionScript 2.0 :: Creating Variables In A Loop And Assigning Them Non Empty XML Values

Jun 1, 2011

Here is the structure of the XML file: PHP Code: <xmlfile><page></page><page> <source></source> </page></xmlfile> Some "page" nodes contain the extra "source" node. What I'm currently doing is looping through all the page nodes and looking for any source nodes. If there is a source node, I create a variable, and want to assign it a value of the contents of the "source" (HTML).

[Code]....

View 1 Replies

ActionScript 2.0 :: Assign Values To A Dynamic Text Field Trough For Loop?

Oct 12, 2009

I`m trying to assign values to a dynamic text field.[code]Can you please tell me how to make it work trought for loop #1

View 1 Replies

ActionScript 3.0 :: Instance Names - Get The Values That The User Will Enter Into Matrix By A Loop

Aug 23, 2010

i have a simple matrix form that consist of 3*3 textfields. my problem is how to get the values that the user will enter into it by a loop, i mean not using a long way such:

[Code]...

View 7 Replies







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