2D Arrays
Hi,
I was wondering if anyone has an little example of how to setup and use a 2d array.
thanks,
jimi
FlashKit > Flash Help > Flash ActionScript
Posted on: 04-24-2002, 07:49 PM
View Complete Forum Thread with Replies
Sponsored Links:
Arrays In A Text File To Arrays In Flash
What i am wanting to do is get an array list from an external file and put it into flash arrays, the code i tryed to use was this:
PHP Code:
for (i=1; i<33; i++) {
if(id=="undefined" || id=="NaN"){
} else {
id[i] = id(i)
}
}
But that dosent work obviously.
I know ive got the
PHP Code:
id[i]
bit right, but i dont know how to do the bit from the text file.
in the file it goes like this:
PHP Code:
id1=432&id2=324 ect
So basically what i am trying to ask is how to in a look do variables using the i (id plus the i at the end). Anyone got any ideas?
View Replies !
View Related
Sorting Arrays...2-Dimensional Arrays
How would I go about sorting two dimensional arrays using the sort() function. What I'd like to do is organize the arrays inside of an array by a certain variable...
i.e:
array1 = new Array("Name", "State1", "Cost");
array2 = new Array("OtherName", "AnotherState", "OtherCost");
array3 = new Array("DifferentName", "YetAnother", "AndAnother");
allarrays = new Array(array1, array2, array3);
Now, let's say I want to sort the arrays in allarrays by their state variable. In other words, I want to sort them so allarrays would look something like this (if sorted by state):
allarrays:
array2,
array1,
array3
Any suggestions or past experiences with this sort of sorting? Would I use the Sort() fuction? or would I have to make my own sort function? Thanks in advance for any help you can provide.
View Replies !
View Related
Arrays: Cleaning Up Empty Arrays
Hi,
So, I have an array generator, and its not worth explaining the details, but long story short, I end up with an array in which some of the slots are "undefined". How can I go through and remove just those slots? Eg this this my Array
myArray[1] = "red"
myArray[2] = "blue"
myArray[3] = undefined
myArray[4] = "pink"
myArray[5] = "undefined
and what I want to end up with is:
myArray[1] = "red"
myArray[2] = "blue"
myArray[3] = "pink"
thx!
-Z
View Replies !
View Related
Arrays/Arrays/Arrays/and Functioning.
Can someone please , tell me how to shorten that Rescale function to just do all the movies in one shot ? and also to add an array for the delay which is the ( o.2, 0.4,0.6 ) so i need to shorten all this to do something like this
Code:
rescale = function(){
this.scaleTo(100,2,"easeOutElastic",this.speed);
this.alphaTo(100,2,"linear",this.speed);
}
//... the next line is inserted within the duplicate movie loop
eval("item"+a).speed = 0.2*a
Instead of all this..
Code:
// Callback Function for lacos to tell when to rescale/alpha back to 100 percent
reScale = function(){
//How can I shorten this by just making an array and doing this in One shot ? is the only problem
item0.scaleTo(100,2,"easeoutElastic",0.2);
item0.alphaTo(100,2,"linear",0.2);
item1.scaleTo(100,2,"easeoutElastic",0.4);
item1.alphaTo(100,2,"linear",0.4);
item2.scaleTo(100,2,"easeoutElastic",0.6);
item2.alphaTo(100,2,"linear",0.6);
item3.scaleTo(100,2,"easeoutElastic",0.8);
item3.alphaTo(100,2,"linear",0.8);
item4.scaleTo(100,2,"easeoutElastic",1);
item4.alphaTo(100,2,"linear",1);
item5.scaleTo(100,2,"easeoutElastic",1.2);
item5.alphaTo(100,2,"linear",1.2);
item6.scaleTo(100,2,"easeoutElastic",1.4);
item6.alphaTo(100,2,"linear",1.4);
item7.scaleTo(100,2,"easeoutElastic",1.6);
item7.alphaTo(100,2,"linear",1.6);
item8.scaleTo(100,2,"easeoutElastic",1.8);
item8.alphaTo(100,2,"linear",1.8);
item9.scaleTo(100,2,"easeoutElastic",2);
item9.alphaTo(100,2,"linear",2);
item10.scaleTo(100,2,"easeoutElastic",2.2);
item10.alphaTo(100,2,"linear",2.2);
item11.scaleTo(100,2,"easeoutElastic",2.4);
item11.alphaTo(100,2,"linear",2.4);
item12.scaleTo(100,2,"easeoutElastic",2.6);
item12.alphaTo(100,2,"linear",2.6);
};
//Duplicate method puts all movieclips on stage at 0 alpha so the user doesnt see the placement
for (a=0; a<titles.length; a++) {
duplicateMovieClip("item", "item"+a, a+1);
//eval("item"+a).alphaTo(0,0,null);
eval("item"+a).item_txt.text = titles[a];
eval("item"+a).tween("_x", [posX[a]], 4, "easeoutElastic");
eval("item"+a).tween("_y", [posY[a]], 4, "easeoutElastic", 0.1);
//Callback function is set here
eval("item"+a).scaleTo(0,0.2,"easeoutElastic",0.1,reScale);
item._visible = false;
}
View Replies !
View Related
Arrays Referencing Other Arrays?
Picture this... I declare two arrays:
array1= new Array();
array2 = new Array();
Then I went through some data and added values to "array1". For this example, let's say it has 20 values. (length = 20)
I want array2 to be a "backup" of this data, so I did this:
array2 = array1;
I would expect array2 to simply be a copy of the contents of array1. But, whenever I .pop() a value off of array1, array2 ALSO loses that same value! How is this possible? Is array2 only a "reference" to array1??
View Replies !
View Related
Only Arrays Or Arrays And Objects
Hi
I've been told not to do this with an array...
PHP Code:
var travelbooks:Array = new Array();
travelbooks.push({titel: "Madrid", release: 2004, pages: 248});
travelbooks.push({titel: "Barcelona", release: 2003, pages: 224});
travelbooks.push({titel: "Tenerife", release: 2002, pages: 124});
travelbooks.push({titel: "Malaga", release: 2005, pages: 172});
for (var i=0; i < travelbooks.length; i++) {
trace(travelbooks[i].release + " - " + travelbooks[i].titel);
}
... but to do this...
PHP Code:
var travelbooks:Array = new Array();
var book_1:Object = {titel: "Madrid", release: 2004, pages: 248};
var book_2:Object = {titel: "Barcelona", release: 2003, pages: 224};
var book_3:Object = {titel: "Tenerife", release: 2002, pages: 124};
var book_4:Object = {titel: "Malaga", release: 2005, pages: 172};
travelbooks.push(book_1, book_2, book_3, book_4);
trace(book_1.titel);
trace(travelbooks);
trace(book_releases);
function book_releases():void {
for (var i:Number = 0; i < travelbooks.length; i++) {
trace(travelbooks[i].release + " - " + travelbooks[i].titel);
}
}
Could you tell me why i'm not supposed to use the first example? And why example 2 doesn't work?
Thank you
Ferran
View Replies !
View Related
Creating Arrays From Arrays?
I'm not sure this is possible but...
I'm trying to create a series of arrays from one main array.
My main array [main_elements] contains four items - interactive, motion, print and illustration. This main_elements array is dynamically created from an xml file.
I'm wanting to create a set of arrays based on the content within this initial 'main_elements' array.
So i would end up with an interactive array, motion array , print array and an illustration array.
currently i'm at this stage with it...although i've tried every other combination i can think of to get it working.
ActionScript Code:
for(q=0; q<work_elements; q++){
main_elements[q] = xmlDoc_xml.firstChild.childNodes[1].childNodes[q].nodeName
//this is the actual categories of work - the areas - interactive,motion,print,illustration
var Vname = work_elements_ARRAY[q]
//i need to create an array based on the names in the work elements area
//ie i need an interactive array - motion array etc
Vname = new Array
trace("Vname-- "+interactive.length)
//this trace should pick up the newly created interactive array but it doesn't exsits...???
}//end of second for
I would then fill these arrays with the work items.
As you can guess its a menu system of the simplest kind i'm trying to build.
Is there a better way to be doing this or is it a case of correct syntax / approach??
View Replies !
View Related
# Of Arrays - Length Of Arrays
Is a length of 540 to long for an array?
If so what a good limit to cap it at?
What # arrays of max limit are to many for a flash movie?
10?
100?
1000?
I'm just curious as i need to track the _x and _y of a dragable MC for as long as possible - 3 to 4 minutes if i can squeeze that. It needs to have smooth motion when it's played back, so the cord's need to be stored about 3 times a second. I was just wondering if anybody has an idea of how much data is too much?
All comments are welcome. Thx
View Replies !
View Related
Arrays In Arrays Trouble
does AS3 have capability to do multidimensional arrays? My computer won't let me download it because I have edu version. 2D arrays would make this a lot easier. Here's the class:
Code:
class com.samainsworth.math.matrix {
var arr:Array;
var r:Number;
var c:Number;
public function matrix(r:Number, c:Number) {
this.arr = new Array(c);
for(var i in this.arr) {
this.arr[i] = new Array(r);
}
this.r = r;
this.c = c;
}
public function getPos(r:Number, c:Number) {
return this.arr[c][r];
}
public function fillPos(val, r:Number, c:Number):Boolean {
if(r <= this.r && c <= this.c) {
this.arr[c][r] = val;
return true;
}
else {
return false;
}
}
}
here's the code in the movie:
Code:
import com.samainsworth.math.matrix;
var m:matrix = new matrix(2, 2);
trace(m.fillPos(1, 0, 0));
m.arr[0][0] = 1;
trace(m.getPos(0, 0));
and last but not least here's error:
Code:
true
undefined
I'm trying to work on 3D which requires a lot of matrices work even though flash doesn't support 3D you can fake it with a lot of math - http://www.kirupa.com/developer/actions ... onCube.swf
View Replies !
View Related
Arrays And Pop()
I thought (and the ActionScript dictonary says) that using .pop() with an array will remove a value. How do I use this with gotoAndStop so that in frame 1 I select a random value from my array and goto that frame. Then from each subsequent frame you select from the remaining pool of frames until finally you can play again with a new random set?
Here's my current code in frame 1:
// Declare the function
function getUniqueRandom (number) {
// Create a new array for sequential number list
var numberlist = new array();
// Place each value in sequential array
for (count=1; count<=number; count++) {
numberlist[count] = count;
}
// Create new array for randomised values
this.randomlist = new array();
// Loop from total number of random values down to zero
for (count=numberlist.length-1; count>0; count--) {
// Pick a random number between 1 and the number of random values remaining
picked = math.floor(math.Random()*count)+1;
// Copy the value in that random location in sequential number list...
// ...into the next 'slot' in our random array
this.randomlist[count-1] = numberlist[picked];
// Copy the last remaining value in sequential numbered list...
// ...into the 'slot' used by the number we just picked
numberlist[picked] = numberlist[count];
}
// Send the resulting array back
return randomlist;
}
// Call the function
x = new getUniqueRandom(5);
firstnumber = x.randomlist[0];
secondnumber = x.randomlist[1];
thirdnumber = x.randomlist[2];
fourthnumber = x.randomlist[3];
fifthnumber = x.randomlist[4];
trace (firstnumber);
trace (secondnumber);
trace (thirdnumber);
trace (fourthnumber);
trace (fifthnumber);
ifFrameLoaded (1) {
gotoAndStop ( secondnumber + 1 );
}
View Replies !
View Related
Help With Arrays
Can any one out there help me with array I am trying to make a dinamic menu so if you can explain it to me in some thing relating to english it would be very much appreciated
Thanks You
View Replies !
View Related
Why Use Arrays?
Okok, I know arrays are useful for listing things and such, but can anyone out there please give me an example of a flash site or a flash site out there that uses arrays in a real world situation?? I don't really understand why we would ever use arrays.
Riki
View Replies !
View Related
DIE Arrays DIE
I'm loading a comma delimeted string into a array from a text file.
I use the split function but it but its not actually splitting the string. WTF am I doing wrong?
Text file:
task1="10,20"
Code:
task1ar = new Array(task1.split(","));
View Replies !
View Related
Arrays
why this script works:
function check(){
_root.result = new Array()
_root.result[1,1,1] = 1
_root.test = _root.result[1,1,1]
}
but this doesnt:
function check(){
_root.result = new Array()
_root.result[1,1,1] = 1
_root.result[1,2,1] = 2
_root.result[1,3,1] = 3
_root.result[2,2,1] = 4
_root.result[2,3,1] = 5
_root.result[3,1,1] = 6
_root.result[3,3,1] = 7
_root.test = _root.result[1,1,1]
}
View Replies !
View Related
Arrays
I want to create an array..that can have values add to it and removed then sends the values in a comma seperated list to server side programme....
for example...there is 20 images on a site...people can add them to an a array list to be sent to them zipped.
at the begining i have:
images = new Array;
on the buttons per image i have:
on release (){
image[0] = 1;
}
on another buttons for image i have:
on release (){
image[1] = 2;
}
Click these and I get a read out of:
1,2
fantastic..but...if I click on image 1 and 3 I get:
1,,3
How do i get rid of the empty arrays I don't want?
that's my question
thank you
View Replies !
View Related
Arrays
hi evry one.
can anyone help me with arrays in flash 5?
I want to put in an array the position of a MC in time.
but it doesn't work, i'm sure the syntaxe is not god.
thats what I made if someone could correct it and explain me why it does'nt work would be nice
onClipEvent (enterFrame) {
if (_root.go == 1) {
xpos[_root.compteur] = _root.toto._x;
ypos[_root.compteur] = _root.toto._y;
_root.compteur = Number(_root.compteur)+1;
}
if (_root.go == 2) {
_root.toto._x = xpos.pop();
_root.toto._y = ypos.pop();
}
}
View Replies !
View Related
Arrays - Please Help.
Hi there,
I need to find a good tutorial that explains arrays in flash 5. If any one knows of any please could you tell me. I am new to arrays so need to start at the beginning.
If anyone could explain some of the basics on this forum i'd be very appreciative.
Thankyou in advance!
//Gary
View Replies !
View Related
Arrays-Your Uses?
Hi all,
This is a totally noob question, but I wanted to ask it here. I'm currently fascinated with the concept of arrays. I understand the concepts behind their use, but I'd love to know what some of you are doing with them. They're not something I've yet gotten into, so-what are some things you folks are doing with them?
Be as verbose as you like-I really wanna know.
Cheers,
Bryan T
Some people used to be lost in the shuffle--------------
now they just shuffle along with the lost.
View Replies !
View Related
Help With Arrays -- Help
Hello fellow Flashkit members!!
I need some help working with arrays. I have written up a few functions that deal wirth working with arrays.
The first function takes an array and duplicates a mpovieclip and populates the clips with the text array and an array of links. That part is working...
the second function just adds to the array. working...
the third function is where I am having trouble. I have a variable that shows the array separated by commas and the user can go in and edit out the array and update the array, which updates the whole menu system. My problem is if the array starts off with a length of 4 and I change the elements of the array to 3, then it does not get rid of the 4th menu box. I want it to change from showing four menu items to three menu items. I can't get it to clear out the extra items.
I am reading about arrays, so I'm trying all different projects with working with arrays. I hope Ive made sense in my explanation. If you need to see the .fla, I can post it.
Thanks all,
dduck1934
View Replies !
View Related
Arrays With MC
Suppose I'm a very stupiod person (that's not far from true), but suppose it. I need to attach the same movie clip, with different instance names (I know how to 2 do that), but i need to do it in different "positions" of the array. Let's see:
Array ---> myArray
MC ---> myMC
MCs Name ---> myMC0, myMC1....
when the user presses a button, I want to push (Array.push) a MC into the end of the array, when he presses again...the push thing again....oh! and then I want to modify some MC's properties...for example _xscale....
ok...please give me a detailed tutorial on this....coz i've tried so many things....the last thing I remember of arrays is in PASCAL...so try to understand me....
thanx
hide.
View Replies !
View Related
MCs In Arrays
Suppose I'm a very stupiod person (that's not far from true), but suppose it. I need to attach the same movie clip, with different instance names (I know how to 2 do that), but i need to do it in different "positions" of the array. Let's see:
Array ---> myArray
MC ---> myMC
MCs Name ---> myMC0, myMC1....
when the user presses a button, I want to push (Array.push) a MC into the end of the array, when he presses again...the push thing again....oh! and then I want to modify some MC's properties...for example _xscale....
ok...please give me a detailed tutorial on this....coz i've tried so many things....the last thing I remember of arrays is in PASCAL...so try to understand me....
thanx
hide.
View Replies !
View Related
Arrays With MCs In Them
How do I load the same MC (with attachMovie) into different instances of an array....myArray[0], myArray[1], myArray[2] thay all got to have a MC inside them.....ANd also, how do I change their(the MC) properties.
Please!! pleaseee!!
Thanx
hide.
View Replies !
View Related
Arrays?
Would anyone mind briefly explain arrays to me please, and for what reasons they are best used? I’ve read a little about them but it still hasn’t sunk in as I am still very much confused. I think the terminology used was a bit too technical for little ol’ me and there were no examples given either.
Many Thanks
View Replies !
View Related
Please, Help With ARRAYS
Hi guys,
I am having problems with arrays, (I know it is simple, but I think I worked too much )
Anyway, here is the script:
--------------------------------
i = 24;
for (a=0; a<=i; a++) {
ClipLine = "_root.line"+a;
b = eval(ClipLine);
}
trace ("Array : " + b);
---------------------------------
and I need to put all those _root.line1, _root.line2, ... into the Array, so the computer understand it that it is really ARRAY.
Thanks for your help!
Olga.
View Replies !
View Related
Arrays()
ok mad an aray usin loaded vars Like so!
loadVariables (_level0.url+"/_admin/pr.asp", this);
id = 0;
prds = new Array(this.prods);
skus = new Array(this.skus);
prd = prds[id];
sku = skus[id];
Now when i call eather prd or sku it displays the entire array and when i set id to something else it displays nothing!
The string of prods & skus looks like this on the page its pulled from
prods=1234, 12321,&skus=745373, 6436,
Any Idea why its doing this?
View Replies !
View Related
Arrays? Help Please
This is the second time I have run into this problem and have yet to figure it out... Any help would be a GREAT help.
I am calling data from an Access database using VBScript.
Counter=0
Do While Not RecordView.EOF
flduser(Counter)=RecordView("flduser")
workstationname(Counter)=RecordView("workstationna me")
output(Counter)= "&output[" & Counter & "]=" & flduser(Counter)
eoutput(Counter)= "&eoutput[" & Counter & "]=" & workstationname(Counter)
Response.Write output(Counter)
Response.Write eoutput(Counter)
Counter=Counter +1
RecordView.MoveNext
Loop
Which gives a result of:
&output[0]=WIN2K&eoutput[0]=W2KP.HOMENET.LOCAL&output[1]=Unassigned&eoutput[1]=OHCOLUACES&output[2]=Joyce Weber&eoutput[2]=OHCOLUJWEBER&output[3]=Training&eoutput[3]=OHCOLUTRAIN7&output[4]=Bret Gillete&eoutput[4]=OHCOLUBGILLET&output[5]=Unassigned&eoutput[5]=OHCOLU233NT2&output[6]=Linda Siders&eoutput[6]=....
Now the problem. When I import this into Flash it works great, as long as I have a dynamic textbox with a variable label such as: output[0] and a second textbox output[1].
Can anyone tell me how to change the textbox variable to just change the "output[0] to output[1] and so on?
Thanks to anyone who can save my sanity!
View Replies !
View Related
Arrays
hey im making a game for a project at school. you go through a maze and you collect different objects. i need to know how i can make an array so that when you collect all 7 object it will play a movie clip. i am using hit test to make the objects movies play when u get them.thanx to all who respond.
jimmy
View Replies !
View Related
ARRAYs ?
i have this calender which is dynamically created in flash
the calender dates have buttons in there and when clicked display the date u have clicked on in another text field.
i have a external text file that holds if statments
Code:
DateText = SelectedDate.toString();
_root.DiaryEntry = DateText;
if (_root.DiaryEntry =="Tue Jan 1 00:00:00 GMT+0000 2002") {
_root.cal_body = "<font color='#003366'>" add ("flybar") add "</font><br>";
} else {
_root.cal_body = "<font color='#003366'>" add ("no gigs") add "</font><br>";
}
now if u click on the 1st of jan 2002 it displays 'flybar' other wise it says 'no gigs'.
now i want to use arrays as every time i i want to add a new date ill have to add an if statement. it works with the if statement but my it manager tells me its crap cause u have toedit code in order to update the calender. i heard itwas possible to update it with arrays but im a little new to arrays. any ideas guys?
View Replies !
View Related
2D+ Arrays
Hi,
What is the syntax to declare and use an array of more than one dimensions?
I tried myArray[x][y] and myArray[x,y] but that doesn't seem to be working very well.
Thanks.
View Replies !
View Related
Arrays Help Please :)
I am trying to create a code which will retrieve the _x position of a scrolling image gallery and retrieve the nearest button position (which I have the positions set up in an array). Heres the code I am attempting to use.....
pos = new Array("2", "102", "208", "308", "410", "514", "620", "726", "830", "934", "1040", "1144", "1248", "1354", "1458", "1562", "1666", "1768", "1872", "1980", "2084", "2186", "2292");
clipposit = getProperty("movieclip", _x);
z = pos.getnearesto(clipposit);
jump = pos[z];
setProperty ("movieclip", _x, -(jump));
tellTarget ("movieclip") {
gotoAndPlay (5);
}
}
View Replies !
View Related
Arrays And Dup. Mcs
Here is my problem. I will try my best to be clear. I have a movie with a spaceship MC with the instance name "ship" and a Meteor MC with the instance name "rock". I want to duplicate the "rock" Mc 7 times when it appears on the screen. This is the actionscript that I have written for it. For some reason it is not working properly. When I debug the movie, it shows that my Rocks[1], Rocks[2], Rocks[3], and so forth are registering but the value of each one is coming back as undefined. I have checked the script over and over and can't seem to figure out my problem. I am very new to action scripting so I am sure that I must be missing something. These are the scripts that I have attached to the "rock" Mc. The second script, if hitTest..... is for when the rock Mc hits the ship Mc. This script is working fine.
onClipEvent (enterFrame) {
total = 7;
rocks = new Array();
for (var i = 0; i <= total; i++) {
duplicateMovieClip ("rock", "rocks" + i, i);
rocks[i] = eval("rocks"+i);
setProperty ("rock", _visible, "0");
}
}
onClipEvent (enterFrame) {
if (_root.rock.hitTest(_root.ship)) {
setProperty (_root.explode, _y, _root.ship._y);
setProperty (_root.explode, _x, _root.ship._x);
setProperty (_root.ship, _visible, false);
_root.explode.gotoAndPlay(2);
setProperty (_root.rock, _visible, 0);
}
}
Any help, insight, or even suggestions of a better way to accomplish this effect are greatly appreciated. Thanks for your time. -Josh
View Replies !
View Related
Dam Arrays
I am haveing a little problem with arrays in flash. The folowing peace of code always goes into the else and i can't seem to think of why it would do that when FC[1], 2 and 3 are 0, PLEASE help me
FC = (1, 0,0,0);
for (i=0; i<4; i++) {
if (FC[i] == 0) {
tellTarget ("/fc" + i) {
gotoAndStop (1);
}
} else {
tellTarget ("/fc" + i) {
gotoAndStop (3);
}
}
}
View Replies !
View Related
Help With Arrays?
Hello,
I have an array = 1,8,10,12,15
I need to split the array
Var1 = 1
Var2 = 8
Var3= 10
Var4 = 12
Var5 = 15
Can anyone give me a hand with some sample code.
Thanks for your help!!!!!!!!!
View Replies !
View Related
Arrays///
used this code to load XML data.
Code:
myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = populateXML;
function populateXML () {
var nodo = this.firstChild;
numData = new Array();
textData = new Array();
for (var i = 0; i<nodo.childNodes.length; i++) {
numData.push(nodo.childNodes[*i].attributes.num);
textData.push(nodo.childNodes [*i].firstChild.nodeValue);
}
trace (numData.toString());
trace (textData.toString());
}
myXML.load("expnav.xml");
Information from the XML document is put into arrays.
Now I'm trying to put an element into a text box, such as
Code:
mytext = numData[1];
it shows undefined for some reason. any one help me?
[*i] just so the board doesn't think its a board tag.
View Replies !
View Related
ARRAYS Fla Help
jow guys
this is my prob
i have a squar wich follows the mouse when you rollover section 1, section 2, .... (found it in a tut, it uses arrays)
now
when you open the fla, you'll see the sections, and my list
i want the squar to follow the memberlist
so the AS on the buttons needs to be changed
i cant figure out, how those arrays work
i cant get the squar to the right place
any one who can help me starting with this?
http://users.skynet.be/digizone/ESAD/prob.fla
View Replies !
View Related
Arrays In 4
hi all - arrays that is my question- it has been a while since looking at flash 4 but now I have a couple of jobs to do in it - to be honest the first one I ended up having to do in 5 coz there was a nasty latency prob in 4 but - this one has to be done in 5.
a bit of a challenge perhaps if I can't get arrays to work - do they in flash 4? - if so how do you set them or use them? -
for example how would I say
Code:
if (_root["array" add i][x]==value){
the scripting seems to like
array[0]=value; - but really doesn't seem to be doing anything with it.
any help would be well apreciated coz without arrays as i said i really have given myself a huge challenge.
cheers all
beezer
View Replies !
View Related
Arrays
I'm not sure if this is a newbie question or not. I've never used an array before and I can't quite figure them out. I'm trying to make something that would act like a global array, where I could get to the information from all the timelines in my scene. Do you do that the same way as you would regular variables? I was saying
_root.buttons.array = array
Where buttons is a movie clip and array is the name of the array but it wasn't working. What am I doing wrong? Any help is greatly appreciated.
Thanks,
Liz
View Replies !
View Related
Using Arrays
I have been told that the best way of achieving a dice to display random amounts of dots after rolling is to use arrays. As a designer this is a bit further over on the techie side of things for me, but I'm a willing learner.
Please could someone help?
On release of a button an animation of 2 rolling di runs and when the di stop numbers are displayed randomly. These numbers combined call a message which displays below, i.e. di display 2 & 4, message says "6. You are lucky this time" and so on...
Thanks.
S
View Replies !
View Related
Arrays
I'm trying to design this game where by answering a load of questions it tells u which football team u should support. Therefore i need to start the game with an array of all the football teams and depending on which answer u choose, a certain team is taken away from the array with each question answred - so by the end of the quiz u're left with one team and this is the team u should support. I think what i'm trying to do is work out how to take one variable out of an array. eg. if there was an array called teams, i would want to say after the 1st question, if u choose this answer, teams = teams - manchester. or something like that. I'm a bit of a beginner so i hope this makes sense.
View Replies !
View Related
Arrays - Help
Hi there,
Basically, I'm creating this game where you have to shot things that randomly come towards you like space invaders.
There wil be 16 aliens. They will play randomly.
But what I don't want is for the random action to play one that is already playing. So, I thought an array is the answer. It would pick a alien from the array, remove it from the array, so that it can't be picked until the alien has finished his animation. When the animation has finished it attaches itself back into the array to be randomly picked again...
but I can't get my head around arrays...any ideas or help with arrays.
I thoguht this would work:
onClipEvent (load) {
new Array();
new Array(16);
objArray=new Array(alien1, alien2, alien3, alien4, alien5, alien6, alien7, alien8, alien9, alien10, alien11, alien12, alien13, alien14, alien15, alien16);
i = random(16)
objArray.splice(i, 1);
__parent["alien"+i].gotoAndPlay();
}
cheers, stu.
[Edited by stuartpetri on 09-27-2002 at 09:49 AM]
View Replies !
View Related
Arrays
I would like to assign the contents of an array to a variable (name 'content'.
The array elements will be (I imagine) variables each referring to a different string.
I would like the variable ('content') to be the strings attahced to the array elelments, not the names of the array elemtns themselves.
I am familiar wiht using arrays and loops, so if you don't have the time to write out the code, just give me intstructions and I should be able to understand them.
Thanks
View Replies !
View Related
Arrays
I'm very uncertain about some things with arrays and hopefully somebody here can help. If I have 8 buttons, how to I make them an array of buttons? Under the instance name in the properties menu do I just type button[1] for the first button all the way to button[8] for the last one? Also, I'm trying to use the actionscript attachMovie with arrays, I can have a maximum of 48 movies, none of which exist at the beginning, but when the user pushes one of the buttons, I want a MC created using attachMovie that is named
myMovie[buttonnumber-that-pushed-it][number-of-times-this-button-pushed] using a two dimensional array. But if I do something like this:
Code:
_root.someClip.attachMovie("MC",myMovie[x][y],layer)
it doesn't work. Can anyone help?
View Replies !
View Related
Arrays
Hello,
I’m Reletavly new to flash actionscript and indeed using flash for more than just pretty pictures. I'm currently working on a document which reads in sports scores from an xml file, once read into flash it stores them in an nested array, I have a function which reads the array, compares a time field with the current time on the server and displays the score when they match. Then removes the record from the array.
My Question, is there an unwritten rule of the maximum size of an array you should have in flash? You see my array might get more than 300 records in. Is this too much or can flash handle more records. The nested array is [value1,value2,value3] in design too.
Thank you
Craig.
View Replies !
View Related
More Arrays
hi!
I have now in an array four names of different mc. ("filmA_mc", "filmB_mc") and so on...
I want to play them in that order they appers in the array when I release a button.
how do I "read" from the array?
thanx for all kind people on this forum
View Replies !
View Related
Arrays
***With Version Flash 5.0***
I am having a very big problem with array's and how to access the information.
I have a variable named "correct", this holds an array with some words
correct = new Array("SEAL", "PENGUIN") quite simple
next i have a variable that holds different letters. These letters when combined together create the words SEAL or PENGUIN. what i am creating is a word find game. I need the code to check the selected letters with the correct answers. I have come across tutorials on using Array.length but it doesn't work. My code follows
on (release) {
correct = new Array("SEAL", "PENGUIN");
for (a=0; a< correct.length; a++) {
if (letters == correct[a]){
ok=1
}else{
ok=0
}
}
i just create a button and if i press that button it should check the letters with the array to see if there is a match. If there is ok=1 otherwise ok=0
the problem i have is that ok always equals zero even when i debug and see the results. I can see the letters being added and the words in the array but it just won't work.
It does however work if i create every single combination. Such as
on (release) {
correct = new Array("SEAL", "PENGUIN")
if(letters = correct[0])
ok = 1
} else if(letters = correct[1]){
ok = 1
}else{
ok=0
}
}
i think the reason is that the for action isn't working properly or that the if action isn't properly referencing the array or something like that
PLEASE, PLEASE help me someone. I really need to know this. thanks
View Replies !
View Related
Arrays Wha..?
Oh can someone tell me why this doesn't work! My debugger says nothing after the word Hello! I can't believe this! None of thearrays are working. Sorry to be so insistant but does anyonw know any common array issues that result in the inablility to assign values!
function convertData(){
piecesdata = string(ARRAY);
aPieces_x = new Array();
aPieces_y = new Array();
// these next two lines are the test
aPieces_y[1] = 1; -----------------------
trace("hello "+aPieces_y[1]); ---------
trace("piecesdata" + piecesdata);
j = 1;
for (i=0; i<64; i++) {
if (i%2) {
aPieces_y[j] = Number(piecesdata.charAt(i));
arrayexample[j+10] = i;
j++;
}else{
aPieces_x[j] = Number(piecesdata.charAt(i));
}
}
}
View Replies !
View Related
Sum Arrays
Hi, anybody know how sum two arrays?
for example:
x= [1,2,3]
y = [1,2,3]
z= x+y
This dont work, but i want get this result:
z = [2,4,6]
I know this is posible, but i dont remember how
View Replies !
View Related
Help With Arrays Please....
HELP!! Just started getting my hand into real ActionScript (pats pile of books on desk) but I am having trouble with arrays.
TASK:
I have a website with several sub-directories for each section. Using ASP trickery, I can return a path value for use in the Flash movie. ie. if the path is /wwwroot/about, the variable 'sns' is set to 'about' and so on.
I have set up a number of arrays for each of the subfolders. These arrays pass variables to the functions; eg. array["filename.jpg", endYpos, startYpos, "description"].
The procedure should go as follows: preload image, begin reveal, move image to endYpos from startYpos and set the dynamic text field to show the variable "description".
My code is below...
ACTIONSCRIPT:
(This code sits on Frame 1 the main timeline in its own layer.)
Code:
/////////// path variables to display corresponding images
path = "/assets/swf/imgs/";
welcome = [path+"image00.jpg", -100, -200, "Welcome"];
about = [path+"image01.jpg", -200, -50, "About"];
exhibits = [path+"image02.jpg", -200, 0, "Exhibits" ];
eco = [path+"image03.jpg", -200, 0, "Ecoadventures"];
functions = [path+"image04.jpg", -200, 0, "Functions"];
media = [path+"image05.jpg", -200, 0, "Media"];
contact = [path+"image06.jpg", -200, 0, "Contact"];
foundation = [path+"image07.jpg", -200, 0, "Foundation"];
education = [path+"image08.jpg", -200, 0, "Education"];
kids = [path+"image09.jpg", -200, 0, "Kids"];
shop = [path+"image10.jpg", -200, 0, "Shop"];
/////////// initialise component variables
dummy = sns;
_root.placeholderA._y = dummy[2];
_root.varhead = dummy[3];
/////////// preloader for external images
MovieClip.prototype.preloadJPG = function(jpg, trgt, clr) {
_global.preloaderCount ++;
this.createEmptyMovieClip("preldr" + _global.preloaderCount, 100 + _global.preloaderCount);
var mc = this["preldr" + _global.preloaderCount];
mc.createTextField("statusText" + _global.preloaderCount, 100, 100, 100, 150, 40);
var tf = mc["statusText" + _global.preloaderCount];
tf.type = "dynamic";
tf.selectable = false;
tf.textColor = clr;
style = new TextFormat();
style.font = "_sans";
style.size = 11;
tf.setNewTextFormat(style);
trgt.loadMovie(jpg);
mc.onEnterFrame = function() {
this.prcnt = Math.floor((trgt.getBytesLoaded()/trgt.getBytesTotal())*100);
if(!isNan(this.prcnt) && trgt.getBytesTotal() > 50){
tf.text = this.prcnt+"% loaded";
this.clear();
with (this) {
lineStyle(.25, clr, 100);
moveTo(trgt._x - 3,trgt._y + 17);
lineTo(trgt._x + 102, trgt._y + 17);
lineTo(trgt._x + 102, trgt._y + 33);
lineTo(trgt._x - 3, trgt._y + 33);
lineTo(trgt._x - 3, trgt._y + 17);
endFill();
}
with (this) {
beginFill(clr, this.prcnt);
lineStyle(.25, clr, this.prcnt);
moveTo(trgt._x,trgt._y + 20);
lineTo(trgt._x + prcnt, trgt._y + 20);
lineTo(trgt._x + prcnt, trgt._y + 30);
lineTo(trgt._x, trgt._y + 30);
lineTo(trgt._x, trgt._y + 20);
endFill();
}
}else{
tf.text = "0% loaded";
}
if(this.prcnt == 100 && trgt.getBytesTotal() > 50){
mc.removeMovieClip();
delete this.onEnterFrame;
gotoAndPlay("reveal");
_root.endYpos = dummy[1];
slide.gotoAndPlay("move");
}
}
}
preloadJPG(dummy[0], placeholderA, 0xFFFFFF);
HELP?
I suspect the problem occurs here...
Code:
/////////// initialise component variables
dummy = sns;
_root.placeholderA._y = dummy[2];
_root.varhead = dummy[3];
...as it works fine if i replace...
Code:
dummy = sns;
...with...
Code:
dummy = welcome;
Basically, I need 'sns' to become 'welcome'[x] or 'about'[x] where x is the variable from the arrays listed above.
How come then, does it not behave the same way when called from the server at runtime?
I would really appreicate any pointers - I'm starting to get very exicited about this scripting lark, if only I could compelte this one!
Thanks heaps,
Vaughan aka Stress ...(>_<)...
View Replies !
View Related
|