IDE :: Array - Loop To Copy The Value?

Apr 29, 2009

i got stucked in a problem in actionscript 2.0

there is a 2d array - arr[12][13]

how can we start a loop to copy the value(using for loop) in manner:

a1=arr[0][0]
a2=arr[0][1]
a3=arr[0][2][code].....

View 5 Replies


Similar Posts:


ActionScript 3.0 :: Dynamically Creating TextFields - When I Copy The Code Into The Loop It Fails?

Oct 15, 2009

I'm currently creating an app which allows users to select blocks of text from a List and dynamically create a TextField on the stage.I'm calculating the height of the TextField and positioning the next TextField beneath.I'm also recording the total heights of the TextFields so that I know when the total height exceeds the available height, at which point I move the x position and reset to y position to zero.

When the next TextField will exceed the available height I want to split it into two, so I'm calculating the remaining height, making the TextField.height into the remaining height.when I try to get the position of the last visible line.If I have the TextFieldAutoSize as LEFT, then I can dynamically generate the heights of the TextFields.For the final TextField in the column I need to set TextFieldAutoSize to NONE so I can change the height of the TextField. i.e. I don't want it to autosize.However, bottomScrollV returns the total number of lines, not the last visible line.

I can create the required behaviour in a separate doc but when I copy the code into the loop it fails.Here is the code.

Code:
public function buildTextFields() {
3 columns (I'm calling them TextBlocks)
// so the first is 0;[code]....

View 1 Replies

.slice() To Copy An Array?

May 25, 2009

I am trying to use .slice() to copy an Array of Loaders (each with a jpg loaded in it), as follows:
 
newArray = oldArray.slice();
 
and it works, but the problem is, any changes I apply to one Array applies to both, as though .slice() had just copied a pointer to the same Array, but I was specifically told that .slice() would not exhibit that pblm. Before I just go back to loading the same images twice, is there something special about Arrays of Loaders or something else I might be missing?

View 5 Replies

ActionScript 3.0 :: Save Copy Of An Array

Jul 27, 2009

How does 1 save copy of an array in AS3 such that changing an element of the copy does not affect the original array? I have an array of Sprites. I tired using splice(0), concat and even copying the array element by element. But everytime I change a propertly in an element of the copy, the original array gets affected. Why does this happen?

[Code].....

View 9 Replies

ActionScript 2.0 :: Push Copy Of Object Onto Array?

May 6, 2004

hey, I was wondering if there's any way to push a copy of an object onto an array without having to create a seperate variable for each object.

For example- in c, i'm used to doing something like having a 'temp' object- and then in a loop i would set the value of the objects members and push it on to the array (vector). If i try to do something like that in flash though, it stores a reference to that object in the array, so every time it changes every new element in the array changes to have the latest values of the temp object.

Without using as2.0 classes (i.e. just mx style) is there any way I can get the effect i'm trying to get here- just have one instance of an object that i can redefine in a loop and push a copy of it into the array so that i wouldn't have to declare a separate variable for each one which would defeat the purpose of the array.

View 2 Replies

ActionScript 2.0 :: Get Copy Of Object In Array NOT Reference?

Feb 6, 2007

In the code below, i create an object and stick it in an array, then I make a duplicate of that array. I loop though the duplicate and change the value of one of the props of the object in the duplicated array. Doing this however unintentionally changes the prop value of an object in the original array. I'm assuming that the objects in the duplicated array are mere references to the objects in the original array. Is this correct? And if so, how do i make unique copies of those objects in the original array, so that changes made to the objects in the new, duplicated array are exclusive to those objects?

I know that i could probably make a new object when duplicating the array, and then recreate each prop, assigning values from the original objects.. but this is a simplified example. The project im working on has many props for each object, so, id rather just make copies if at all possible.

Code:
var testObj:Object = new Object();
testObj.prop1 = "hello";
//
var testArr:Array = new Array();

[code].....

View 1 Replies

ActionScript 3.0 :: Copy An Object Using As An Associative Array?

Sep 1, 2009

I need a simple way to copy an object I use as an associative array. I use Flash, not Flex, so apparently copy() is not an option - or is it?

View 4 Replies

ActionScript 2.0 :: Push A Copy Of Object Onto An Array?

May 6, 2004

push a copy of an object onto an array without having to create a seperate variable for each object.For example- in c, i'm used to doing something like having a 'temp' object- and then in a loop i would set the value of the objects members and push it on to the array (vector). If i try to do something like that in flash though, it stores a reference to that object in the array, so every time it changes every new element in the array changes to have the latest values of the temp object.

Without using as2.0 classes (i.e. just mx style) is there any way I can get the effect i'm trying to get here- just have one instance of an object that i can redefine in a loop and push a copy of it into the array so that i wouldn't have to declare a separate variable for each one which would defeat the purpose of the array.

View 2 Replies

ActionScript 3.0 :: Copy Multiple Array Content Onto Clipboard?

Nov 30, 2010

I'm trying to write a script that can copy multiple inputs that i've stored inside my array to the clipboard. Is it possible for me to get all my data inside "storage" array to the clipboard? All it seems to do is copy the last input given.[code]...

View 2 Replies

ActionScript 3.0 :: Create A Copy Of An Object That's Contained In An Array?

Dec 14, 2009

I'm trying to get a copy of an object that contained within an array - not a reference.

Code:
var copyCellObj:Tile;
var cellObj:Tile = new Tile(); // putter-getter obj containing width, height, color, etc.

[Code]....

View 0 Replies

ActionScript 3.0 :: Make A Copy Of An Array Filled With Canvas Objects?

Jul 26, 2011

I'm trying to make a copy of an array filled with Canvas objects. I use this code:
 
arCopy =    ObjectUtil.copy(myClass.myArray) as Array;
 
 
What I get is an array arCopy filled with Objects instead of Canvas. Each of these Objects has propersties suggesting that it was Canvas (like uid="Canvas333" or name="Canvas333"), but it's instance of Object class. I've been using ObjectUtil.copy() before but never seen such behaviour. 

View 1 Replies

Php :: Flash HTTP Requests URL Containing RTMPE URL - Get A Local Copy Or A Copy With Content?

Oct 7, 2011

A web channel streaming service streams to a certain IP range, it only checks the IP in example.com/cmd.php?id=xxx (channel number) and outputs an rtmpe stream URL, nothing else.How do I trick it to get my local URL instead of the one on their server? I have considered squid proxy, but is there some way to do it with a firefox plugin or greasemonkey script?

Edit:I will try to specify:It's a streaming service from an ISP and cable provider. They stream for free to people on their IP's. On their webtv page, which is called webtv.example.com, there is a flash player. If you are not on an IP from their ISP, you can't stream anything but the test channel.When you try to change channel via. javescript:videoplayer_changechannel(xxx) it makes this HTTP request:

[URL]

If you are on one of their IP's you will get an RTMP URL, like this:

[URL]

This is what the flash player requests, and if it get's this response it load the channel requested. There is no HTML on the php page, just the URL. Note that the rtmp URL is static.If you are not on one of their IP's it will return a random sentence (something stupid, the programmers having fun).I wan't to trick the flash player into getting the right value, even though it's not on one of the ISP's IP's.

View 1 Replies

ActionScript 3.0 :: Copy Files With FLfile.copy Method?

Oct 27, 2010

How can I copy files with FLfile.copy method in CS4? I need any samples with all classes.

View 0 Replies

Loop Through An Array And Use The Array Value To Reference A Variable?

Sep 25, 2009

I want to loop through an array and use the array value to reference a variable.

The Setup:
(For illustration only. Not actual script)
My MCs:
triangle_mc
square_mc

[Code]....

View 1 Replies

ActionScript 2.0 :: For Loop To Check One Array Against Another Array?

Aug 25, 2011

ActionScript Code:
var answerArray:Array = ["3", "2", "5", "3", "2"]; //these are the correct answers
var answeredArray:Array = ["3", "1", "1", "3", "2"]; //this is an example of what the user

[code]....

View 3 Replies

Flash - Copy XML Array From One XML Object To Another Xml Object

Dec 8, 2009

how to copy one xml object values from one xml object to another empty xml object.

I have one xml object from the xml array and need to copy that to another xml object. How can i copy xml from one object to another

if am parsing the XML object with for loop and i get the nodes

var myXML:xml = new xml();
for(...)
if(xmlObj.product[i].name == 'myproduct'){

[Code]...

View 2 Replies

ActionScript 2.0 :: Copy A "dynamic Text" Using Copy Button?

Sep 11, 2011

i need to copy a "dynamic text" using copy button. how can i do it ?

View 5 Replies

Professional :: No Loop In Swf Array?

Jan 20, 2011

I have this flash movie I've been working on for awhile. I've received in these forums. I have my file set to load an array of swfs.  Now, though, I'm wondering how to keep it from looping.  At the end of the last swf, I want the movie to go to the last swf and then just stop.  Here is my code:

[Code]...

View 9 Replies

Use For Loop With An Array And AddEventListener?

Nov 11, 2009

I have this map I'm creating in Flash. You click on a state, then you can click on an icon to view a tooltip/popup of some information. What I was trying to do was instead of creating new functions and event listeners for every different icon is to use a for loop...but it's not going so well.[code]...

View 2 Replies

ActionScript 3.0 :: SWF Array - How To Get It To Loop

Jun 21, 2010

I've a container file which loads an array of SWFs. The code is as follows:

var request:URLRequest;
var loader:Loader= new Loader();
stage.addChild(loader);
var myMovies:Array=["../flash/movie1.swf","../flash/movie2.swf", "../flash/movie3.swf"];
var movieNum:int=0;
var mcExternal:MovieClip;
[Code] .....

This works fine - the array is loaded and plays through once... What changes are needed to get it to loop through the array.

View 2 Replies

ActionScript 3.0 :: Set An Array By Using A Loop?

Oct 6, 2010

how can i set an array by using a loop.. the array is contains by a data that i read from database.. so the length of carry depend of the length of data in my database..

i try to use
for (var i:int = 0; i < xxx; i++) {
products = [p[i]];
}

i never read data from database in as3.. so if i want to use the data in database for this loop,what should i do?

View 2 Replies

ActionScript 2.0 :: Run A Loop In An Array?

Feb 16, 2008

if you could run a loop in an array?

I'm having to make an array that has each value increase by a 10, like 10, 20, 30, etc. is there an easier way to put in those values without adding them 'manually'?

and I have another question that is related. For this same project, on the stage there will be a text box and the user will put in a number--how can that value be run through the array? like say I input the number 500, how does it find it in the array? is there a passed id, a listener and a broadcaster?

View 2 Replies

ActionScript 2.0 :: Loop Through Array Syntax?

Sep 15, 2009

I have an array like this:

Code:

var myData = new Array();
myData["name"] = "John";
myData["Age"] = 35;

What is the syntax to loop through and get the key and value? I have tried for each and for in but they just give me the value of "John" or "35", how can I get the key e.g. "Name" and "Age"?

View 2 Replies

ActionScript 3.0 :: AddChild Using For Loop Then Put Into Array?

Feb 8, 2012

Is there a simple equivalent to what I used to do in AS2 to add a bunch of new objects to the stage and throw them into an array so they can easily be referenced? I'm finding this more difficult than it used to be.

Old code:

ActionScript Code:
mc_array = new Array();
for(i=0;i<5;i++){

[code]....

View 6 Replies

ActionScript 3.0 :: Index Of Array In For-each Loop?

Jan 29, 2009

Consider an array with x number of elements (of type Object) where some of the elements might be undefined.I use a for-each loop to access all the elements of the array that is not undefined (since it simply skips the undefined elements).But I also want the index of that particular element.The only option I can see is to use indexOf(). But it feels a bit like looking for water on the other side of the river so to speak.

When looping through long arrays each frame, is there a change indexOf() might slow it down? or does the for-each loop somehow know what index it's dealing with?

View 19 Replies

ActionScript 3.0 :: Array Inside A While Loop

Apr 5, 2010

I am quite new to AS3 and I am having trouble adapting my knowledge of Java to this new language i am trying to make a simple  grid in which i could work on each individual square seperately(changing their colour for example). To do so, I created a 2D array,hoping it would allow me to work with some kind of coordinates system. I initialised the array using while loops and for some reason, this does not let me access the array outside the loops.[code]The two last lines are causing the problem, instead of turning the last square red, they return the following error: TypeError: Error #1010: A term is undefined and has no properties.However, when placed inside the loop, there is no problem and the whole grid turns red.

View 3 Replies

ActionScript 3.0 :: Loop To Search Through Array?

May 3, 2010

I need to find a way to search through an array of grades and find grades that fall into levels such as[code]...

View 14 Replies

ActionScript 3.0 :: Array.length In A For Loop?

Jul 27, 2011

I like to use array.length in my for loop to keep my code cleaner to read. Is there any huge downside to this? For example will it speed up things greatly if i store the length in a var one time?

View 22 Replies

ActionScript 1/2 :: Possible To Loop Contents In Array?

Sep 30, 2011

Is it possible to to loop contents in an Array? Something like this?
for (var s:Number = 1; s<21; s++) {
var me = ["tfNm"+(s)];
var mcB = ["_root.gmb_mc."+me+".tf"];
var mcC = ["_root.gmbb_mc."+me+".tf"];
//trace (mcB)
var mcA:Array = [mcB, mcC, _root.F5];
/////
}

View 10 Replies

Actionscript 3 :: Generating An Array Using A Loop

Dec 15, 2009

Below I have an array that works but it is far too long and I am thinking there is a far easier way to generate the same result using a loop but I just can't get my head around it at the moment. The array is as follows:

var CardDeck = new Array();
CardDeck[0] = new C1();
CardDeck[1] = new C2();
CardDeck[2] = new C3();
CardDeck[3] = new C4();
CardDeck[4] = new C5();
CardDeck[5] = new C6();

[Code]...

View 2 Replies







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