Simple And Simple Array Question
Hi all
Do Flash understand array list items that uses paths?
Example:
Code:
var submenus:Array = new Array( "sub_menu.portfolio" , "sub_menu.contact" , "sub_menu2.about" );
for(var i:Number = 0; i<submenus.length; i++) {
this[submenus[i]].onRollOver = function(){
this.colorTo("0xAAEEFF",0, 0.0);
trace("dfklgödfk")
}
}
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 08-10-2006, 05:12 AM
View Complete Forum Thread with Replies
Sponsored Links:
Array (simple I Think..)
Im new to actionscript so this is probally pretty simple...
I have a menu bar with four buttons each button has the following
script:
on (release) {
submenuArray = ["Welcome", "Industry Challanges", "Overview"];
gotoAndPlay ("SubSlide");
}
I change the values of the items in the array but it always reverts to the
values contained in the first array. Why does the new array not load when
the button is "released". Is this the wrong way to handle this?
Thanks
-Sean
View Replies !
View Related
[F8] Simple Array Help
I have created one button and placed 3 instances of it on the stage:
I put the instance names in an array and set up a variable (in Blue)using a for loop
Code:
var pButtons:Array = new Array("portBtn_1", "portBtn_2", "portBtn_3");
//trace(pButtons[0]);
var i:Number
for(i=0; i<pButtons.length; i++){
_global.buttons = pButtons[i]
//trace(buttons);
}
I am trying to avoid repetetive actionscripting by using a variable to execute a rollover function for all the instances of my movieclip/button.
the variable returns the correct strings, but i can't get the rollover function to work: (I included the .FLA)
Code:
buttons.onRollOver = Over;
buttons.onRollOut = Out;
function Over() {
this.gotoAndStop(2);
};
function Out() {
this.gotoAndStop(1);
};
View Replies !
View Related
A Simple Array
morning...
ive wrote this simple code which i would like to duplicate for x number of movie clips... the only change is the box number which will count from 1 upwards...
im guessing that an array would work to simplify this but i have no idea how to write an array..
can anyone point me in the right direction?
////////
/////// BOX20
this.boxes.box20.onRollOver = function() {
boxes.box20.swapDepths(100000);
boxes.box20.gotoAndPlay("zoom");
_global.box20Status = "roll";
boxes.bar_mc.swapDepths(10000)
};
// BOX ROLLOUT
this.boxes.box20.onRollOut = this.boxes.box20.onDragOut=function () {
if (_global.box20Status != "clicked") {
boxes.box20.gotoAndPlay("shrink");
_global.box20Status = "rollout";
}
if (_global.box20Status == "clicked") {
boxes.box20.gotoAndPlay("click_shrink");
_global.box20Status = "srinked";
}
};
//BOX CLICK
this.boxes.box20.onRelease = function() {
if (_global.box20Status == "roll") {
boxes.box20.swapDepths(100000);
boxes.box20.gotoAndPlay("click");
_global.box20Status = "clicked";
} else if (_global.box20Status == "clicked") {
boxes.box20.gotoAndPlay("click_shrink_roll");
_global.box20Status = "roll";
}
};
View Replies !
View Related
Help With An Simple Array
Hi all, I worked out a few things to do with my xml loading on this thread here: http://www.actionscript.org/forums/s....php3?t=149349
Now I want to load different nodes of the xml into different instances of the movieClip I'm attaching, how would I go about this? as I'm not very familiar with arrays
BTW the Mc "table" has 'node1, node2, node3' inside it.
Cheers
Code:
xml = new XML();
xml.ignoreWhite = true;
xml.onLoad = function() {
nodes = this.firstChild.childNodes;
numOfNodes = nodes.length;
for (i=0; i<numOfNodes; i++) {
_global.node1 = nodes[i].firstChild.firstChild;
_global.node2 = nodes[i].firstChild.nextSibling.firstChild;
_global.node3 = nodes[i].firstChild.nextSibling.nextSibling.firstChild;
}
attachResults = function () {
attach = attachMovie("table", "table", r);
attach._x = 0;
attach._y = table._height*r;
};
for (r=0; r<numOfNodes; r++) {
attachResults();
}
};
date = '04-10-07';
xml.load('results'+date+'.xml');
dateTitle.text = date
View Replies !
View Related
XML Simple Array
Because I am working on this and others are probably curious too... I found a well explained example that should help you get your XML data put together perfectly... if you are unfortunate enough to be working with XML.
http://proto.layer51.com/d.aspx?f=611
View Replies !
View Related
Really Simple Array Q
I can't get my head around arrays...
Ok so basic I know it can be displayed as blah = ["blah","blah blah","blah blah blah"]
then you can retrive with trace(blah[x]); or in a text box.
I can't be bothered with the var blah:Array = []ect.. I want to stay simple.
I want to load a random vaule from an array but I want to keep the code simple so I can come back to it and instantly understand and make changes.
I know this is really stupid I probably didn't explain very well but oh well its late. Good nigh, from me I will check this in the morn.
Thanks in advance.
View Replies !
View Related
Simple? Array To Array Problem
I am trying to pass the value from one array element to an element in another array. I believe the value is getting there, but it won't display when the 2nd array element is used as the variable in a dynamic text block. Here's the simplistic code I'm trying to learn the concept with:
one = new Array(5);
one[0]=1;
one[1]=2;
one[2]=3;
one[3]=4;
one[4]=5;
two = new Array(5);
two[0]=one[4];
two[1]=one[3];
two[2]=one[2];
two[3]=one[1];
two[4]=one[0];
I then set up individual dynamic text boxes for two[0] through two[4], but no value will show.
View Replies !
View Related
Array? Simple Question
Hi,
It's late and my mind and reference books are failing me. All I want to do is have one button randomly address ten different MC's. Do I put their names in an array, define a variable as the array name[random number between one and ten], then make the button tell _root.(variablename).gotoAndPlay("start")???
I'm following the directives to the letter-no code errors, but I cannot address the different MC's like this, randomly or otherwise. Am I barking up the wrong tree? This seems like a simple thing to do; is an array the wrong approach?
Surely I can randomly target several MC's with one button???
Thank You,
Bryan T
View Replies !
View Related
Simple Array Problem
Hi
I want to to delete a sepcified item out of my array:
Here is the code:
Code:
for (/checkbox1/:i =0; /checkbox1/:i<= /:Songlist.length; /checkbox1/:i++) {
if (eval(/:Songlist[/checkbox1/:i] ) =/:id1) {
/:Songlist.splice(/checkbox1/:i,1);
}
}
Now if the array songlist has the elements 1,2,3,4,5
Then if i run this script with /:id1 = 3
This is what happens
Songlist array becomes: 2,4
i want it to be: 1,2,4,5 (with the 3 being removed)
what have i done wrong?
Thanks
Ash
View Replies !
View Related
Simple Question - Array
Hi all,
I have a question in using and creating 2 or more dimentional Arrays.
For Example:
map = new Array();
map = [[1,2,1],[1,0,0],[1,0,0]];
If I am correct, this is a 3 x 3 dimentional array. But how do I use it?
For Example: I would like to get the 2 out of the array:
text = map[0,1];
But it doesnt work! it gives me the whole 0 element: [1,2,1], why does it do that?
Please help me
View Replies !
View Related
Simple Array Question(i Think)
so i got an array and i want to get the value of the variables and sort them out for example
car=1
toster=3
tub=3
boat=1
bike=1
so every thing that is equal to 3 should go in to the house array and every thing that is equal to 1 should go in to the transportation array
View Replies !
View Related
Simple Array() Question
Code:
createLabels(["username", "firstname", "lastname"]);
function createLabels(labels){
for(i = 0; i < labels.length; i++){
trace(labels);
}
}
Why does the trace return:
username,firstname,lastname
username,firstname,lastname
username,firstname,lastname
I want it to return:
username
firstname
lastname
Can someone tell me how to fix the code to do that?
View Replies !
View Related
Simple Array Question
Okay i am not too fond of flash's array concepts, I use 1D arrays all the time, but when I try to make a 2 or more Dimensional array i get lost... i need to make something like this... An item say a sword and then i need to store all the swords stats inside of an array, then the second main element of the array would be say sheild then all the stats of that sheild.. understand?
I thought it would be something like this..
Code:
items = new Array();
code = [["Sword"[100, 23]], [["Sheild"[34, 65]]];
then all of the other items, now the problem arose when i wanted to acess just the first sat of sword:
Code:
trace(items[0, 1);
but that game me the entire first element
OUTPUT:
Sword, 100, 23
I just need the 100 in this instance, I am hoping you understand what I mean by this, I am guessing i am just way off on the array set up(as I Have no clue how to, that was just an educated guess) so please, i need your help flashers
~Zakarus2001
View Replies !
View Related
Array Problems So Simple I Am Sure
Hi everyone,
I am having such a problem with a stupidly simple thing. I am trying to copy from one array into another array. I have really simplified the script below but it still doesn't work! Any help would be much appreciated! Why doesn't it work!! Maybe becasue it is the weekend and I am tired but I can't figure it out!
Code:
stop();
categoryVar = new Array("doubles", "tennis_playing");
categoryArray = new Array();
for (j=0; j<2; j++) {
var temp2 = categoryVar[j];
trace(temp2);
_root.categoryArray[j] == temp2;
trace("loaded "+_root.categoryArray[j]+" into array");
}
trace("Category array: "+_root.categoryArray[0]+"|"+_root.categoryArray[1]);
this is in frame one! layer 1, nothing could be simpler!
WHere am I going wrong?
Thanks
A
View Replies !
View Related
Simple Array I Hope(MX)
Hi I suck at this so I really could use some help.
I have a php script that loops all the content of a databas.
While doing so it generates a name and a message.
I want to fetch that into flash but all that comes up in my dynamic box is the last post of my databas. I want them all in the same dynamic box called box.
My actionscript goes:
status="FETCHING COMMENTS";
loadVariables("comments.php", _root.container, "POST");
if (status eq "FETCHING COMMENTS") {
gotoAndPlay (8);
} else {
gotoAndPlay (9);
}
So I should have some sort of array i guess in the if statement.
But I have no clue on how to make an array in flashMX.
View Replies !
View Related
Simple Array Problem- Please Help
hi,
im trying to make a card game (choi dai di) using flash. so far im even getting stuck on the basics like shuffling the cards into 4 hands. i have got this far, but although i can trace the contents of each hand, it wont let me do anything with it (ie then convert it into displaying the appropriate cards). its pretty inefficient at the mo but i just want to get it working at the moment. below is some code!
_global.cardArray = new Array();
//sets up deck of cards. each item in array has 2 numbers- 1st is rank 2nd is suit
for (i = 1; i < 14; i ++)
{
for (j = 1; j < 5; j ++)
{
_global.cardArray.push(new Array(i, j));
}
}
Array.prototype.copy=Array.prototype.slice;
tempArray =_global.cardArray.copy();
tempArray2 = new Array();
tempArray3 = new Array();
tempArray4 = new Array();
//randomly picks cards from array of all cards, assigns it to new
//array and then removes it from original array
for (i = 0; i < 52; i ++)
{
randomise = Math.round(Math.random()*(tempArray.length-1));
tempArray2.push(tempArray[randomise]);
tempArray3 = tempArray.slice(0,randomise);
tempArray4 = tempArray.slice(randomise+1, tempArray.length);
tempArray = tempArray3.concat(tempArray4);
}
//then splits final array into 4 different hand arrays
hand1 = new Array(tempArray2.slice(0,13));
hand2 = new Array(tempArray2.slice(13,26));
hand3 = new Array(tempArray2.slice(26,39));
hand4 = new Array(tempArray2.slice(39,52));
trace (hand1);
trace (hand2);
trace (hand3);
trace (hand4);
//traces fine upto here, but if i say
// trace(hand1[0][1]);
//ie explicitly reference it then it does nothing.
What am I doing wrong- any help would be much appreciated!!
Thanks
View Replies !
View Related
Simple Array Question
How do I tranform
header_array = ["id", "text"];
id_array = ['1', '2', '3', '4'];
text_array = ['asdasd', 'asdasdas', 'asdasd', 'asdasd'];
into
item[0] = {id : '1', text : 'asdasd'};
item[1] = {id : '2', text : 'asdasd'};
item[2] = {id : '3', text : 'asdasd'};
item[3] = {id : '4', text : 'asdasd'};
Im sure its quite simple
thankz all
View Replies !
View Related
Simple Array Question
Hello,
I'm not sure if using an array is correct in this instance, but i'd like to change the color of several movie clips at once by a using a function. Each clip has a unique name. Currently, I'm using the following code, and i know it's not accurate, or complete.
function setColor() {
states = ["fl","ga"];
myColor = new Color(states);
myColor.setRGB(0xD8D0C7);
}
setColor();
Any help in advance is greatly appreciated, as i can't seem to find any help elsewhere
View Replies !
View Related
Simple Array Question
I'm trying to add up all the numbers in my array. For example, if my array had these numbers:
10,15,5
I want to add them up (30).
I've found tutorials for arrays, but I haven't seen this answer yet. Any ideas?
Thanks.
View Replies !
View Related
Simple Array Problem...
Ok, I'm just having the hardest time wrapping my brain around this. Hopefully someone can help me.
So I want to create an array (myTestArray2), and make it a duplicate of an existing array (myTestArray). I then want to empty out the original array (myTestArray) but keep the new one intact.
You can see from this code that when I trace myTestArray2 in the end it is empty... yet I didn't even touch that one in my loop.
Code:
myTestArray = new Array(5,6,7,8);
trace("myTestArray = " + myTestArray);
myTestArray2 = myTestArray;
trace("myTestArray2 = " + myTestArray2);
testItemsToShift = myTestArray.length;
for(i=0;i<testItemsToShift;i++){
trace(i);
myTestArray.shift();
}
trace("myTestArray = " + myTestArray);
trace("myTestArray2 = " + myTestArray2);
So how do I create myTestArray2, make it a copy of myTestArray, but then have it left alone while I manipulate the original myTestArray?
Thanks much in advance.
Mike
View Replies !
View Related
Simple Button W/ Array
Hi
I need a button inside an MC that when clicked, plays the MC and does a push to an array.
The problem I'm having is that when the button is inside the MC it does not work and comes up as undefined in a trace. When I place the button outside the MC, it works fine. Unfortunately the button has to be inside.
Any ideas for the way around this?
Thx in advance.
View Replies !
View Related
Simple Array Problem
temp_horz_1_arr=new Array("Sam","Joe","Mary","Alex");;
array_num=1;
element_id=1;
trace(_root["temp_horz_"+array_num+"_arr"])
trace(_root["temp_horz_"+array_num+"_arr["+element_id+"]"])//This statement is resulting undefined
This is returning me the whole array but not exactly the element. Plz Help
View Replies !
View Related
Simple Array Problem, Please Help
Hi.
I am trying to display 10 random sums from an array. The code I have is...
for (i=0; i<10; i++) {
count = sums_array.length;
index = Math.round(Math.random()*(count-1));
sum[i] = sums_array[index];
}
Everything seems to be working ok apart from the sum[i] part. Is this the right way to then be able to display the sum in text boxes named sum1, sum2, sum3 etc??
Thanks
Simon
View Replies !
View Related
[MX] Simple (?) Array Sorting
Hi there
I was trying to do what I supposed it would be a simple array sorting, but I don't know what I'm doing wrong.
I have an array with several numerical fields of which I'd like to use three to perform a descending sort. The fields in question are "P", "PF" and "DIF". My intention was to use the "P" field as the main sorting criteria, and if there where two identical values for it, use the "PF" field as a second sorting criteria. Same would apply for the "DIF" value. Here's what I tried:
Code:
matriuClasLLIGA.sortOn( ["P", "PF", "DIF" ] , 18 );
You may see the results here the fields used are those listed in the columns. It doesn't work.
A closer version to my original intention, which sadly (and obviously) doesn't take into account the "PF" and "DIF" values was achieved by using this code
Code:
matriuClasLLIGA.sortOn( "P", 18 );
you may see the results here
Any help would be highly appreciated,
Thanks a lot
View Replies !
View Related
Random (simple) Array
I am trying to setup an array of 2 moviclips which are on the stage and then once the button is pressed it plays frame 2 of one of the random clips. If I write the array like this;
Code:
var clipArray:Array = Array["clip1_mc","clip2_mc"];
How do I then implement the rest of this? I know I need to write the Math.round code but not sure how to use this. Any help would be great.
thanks
jb
View Replies !
View Related
Simple Question: Array
If this code creates 10 nodes that shape the arm of a sea anemone,
Code:
var nodes = [];
var i = 0;
var xOffset = 150;
var yOffset = 150;
var node = (nodes[i] = attachMovie(i == 0 ? "nodeLabel" : i == 9 ? "chain2" : ((i % 2) == 0 ? "chain0" : "chain1"), ("pt" + i), (i % 2) == 0 ? i : (i + 10), {_x:(i * 20 + xOffset), _y:(-i * 20 + yOffset)}));
QUESTION 1. how can I create 10 arms?
ANSWER 1. var arms:Array = Array(nodes)??? wht's next?
QUESTION 2. how will you change the rotatión of the whole arm?
ANSWER 2. node._rotation = offset??? It doesnt work...
Thank you very much!
View Replies !
View Related
Simple Array Question?
Hi
I have an array:
Code:
var test_arr = [null, null, 1,2,3, null]
I want to loop through it to get rid of the null values.
Im sure I've done this before but this doesn't work:
Code:
var num:Number = test_arr.length
for (var i:Number=0; i<num; i++) {
if (test_arr[i] == null) {
test_arr.splice(i, 1)
}
}
trace(test_arr)
Giving me "null,1,2,3"
I understand why this doesnt work but I cant work out how to do it. This is very simple but I have a deadline and Im having a breakdown!!!
Thanks
View Replies !
View Related
Simple Array - What's Wrong?
I have a bunch of buttons, and want to set the visibility off for all initially. All btn are on stage and named accordingly.
I put all in an array, but perhaps my loop didn't work. What's wrong?
Code:
menu_array = new Array("dinner_btn","lunch_btn","wine_btn","rollmenu_btn");
for (i=0; i<menu_array.length; i++){
menu_array[i]._visible = false;}
I trace menu_array and it displays the list ok.
View Replies !
View Related
Simple Array Question.
I have an element in an array that comes from an alphabetical listing. The element might be something like "Frog, The" I need to remove the comma from the element and reverse it so it reads "The Frog" The code I have is as follows, but the comma is still there, any help is appreciated.
cols[1] = cols[1].split(",").reverse.join();
View Replies !
View Related
Simple Array Question
Hi, so I'm using an array to store a list. I have two buttons which are used to scroll through a movieclip using nextFrame and prevFrame. I have an input text object which I want to display a string which is associated with each frame of the movieclip (keeping up?)
I've created the array of 3 values and can assign one of the array values to the text object using array[]; but how can I have it so it 'scrolls' through the array values, so clicking the next button will move onto the next array value, and clicking previous will move onto the previous one?
I have this in terms of this so far (buttons and all):
ActionScript Code:
var gapArray:Array = ["0.3m","0.4m","0.5m"];
gap_txt.text = gapArray[0];
// gap up/down buttons
gapUp_btn.addEventListener(MouseEvent.CLICK, gapUpClick);
gapDown_btn.addEventListener(MouseEvent.CLICK, gapDownClick);
function gapUpClick(event:MouseEvent):void
{
this.gap_mc.nextFrame();
}
function gapDownClick(event:MouseEvent):void
{
this.gap_mc.prevFrame();
}
Thanks
Babs
View Replies !
View Related
AS2 Simple Array Question
I'm missing something simple so I'm sure there's a quick answer here.
I have an array of buttons, and when they are on stage they are initially set to _alpha = 0. I have one "All On" button (btnAllOn) that should turn every button on stage to _alpha = 100.
The array is set up as follows:
Code:
var navButton:Array = new Array();
navButton[0] = "btn1";
navButton[1] = "btn2";
navButton[2] = "btn3";
navButton[3] = "btn4";
navButton[4] = "btn5";
navButton[5] = "btn6";
navButton[6] = "btn7";
navButton[7] = "btn8";
navButton[8] = "btn9";
navButton[9] = "btn10";
Here's the function, the trace does return the correct # of array items. My buttons on stage do have instance names matching "btn1" etc. but nothing happens other than seeing the trace result.
Code:
btnAllOn.onRelease = function() {
for (var i = 0; i < navButton.length; i++) {
trace(i);
navButton[i]._alpha = 100;
}
}
Thanks for the help.
View Replies !
View Related
Simple Array Question
I have a simple menu made up of 10 instances of the same movie clip arranged into an array that are to show different pieces of work for each client we have in our portfolio. For each client there are different numbers of work so I want to deactivate certain buttons in this list of 10. The only problem is that I'm not sure how to access seperate clusters of an Array so that I can deactivate and activate certain ones. The way it would work is that i would assign the elements 0-4, for example, of the "sampleBtns" array, make the variable 'deactivate' equal to false and make their alpha=100 while 5-9 'deactivate' would be set equal to true and their alpha to 20. Can anyone help me out?
View Replies !
View Related
Array Problem--must Be Simple
I have created two arrays from XML the first array (QuestionArray) contains the second array (AnswersArray). The answers to each question in the XML are:
Question 1
-True
-False
Question 2
-Hartford
-Bloomfield
-New Haven
-Washington D.C
But when I trace the answers in my array I get:
True, False
Washington D.C, Bloomfield, New Haven, Washington D.C
Here's my code:
Code:
function buildQuestionArray() {
_global.QuestionsArray = new Array ()
for (var i=0; i<TestNode.childNodes.length; i++){
curQuestion=TestNode.childNodes[i];
var AnswersArray = new Array();
for (var j=0; j<curQuestion.childNodes.length; j++){
curParts=curQuestion.childNodes[j];
for (var b=0; b<curParts.childNodes.length; b++){
if (curParts.childNodes[b].nodeName==null){
curImage=curParts.childNodes[b];
}else if (curParts.childNodes[b].nodeName!=null){
curImage=null;
curAnswers=curParts.childNodes[b];
}
AnswersArray[b]= curAnswers.childNodes
}
}
_global.QuestionsArray[i] = new Question (curQuestion.attributes.number, curQuestion.attributes.format, curQuestion.attributes.correctanswer, curQuestion.attributes.text, curImage, AnswersArray)
}
makeQuestion (currentQuestion);
ClickTrue (currentQuestion);
}
function Question (numbers, format, correct, Text, Image, Answers) {
this.numbers=numbers
this.correct=correct
this.Text=Text
this.format=format
this.Image=Image
this.Answers=Answers
trace (Answers)
}
View Replies !
View Related
Simple Question - Array
Hello there,
How to set properties in array ?
here's the code :
ActionScript Code:
img = new Array();
for (z=1; z<=12; z++) {
img = "gb"+z;
img._visible = false
}
._visible seems didn't work.
Anyone can help ?
thanks in advance
View Replies !
View Related
Help With Really Simple Array/menu
OK. This is probably excruciatingly simple to most of you, but it's driving me a bit mad. I have movieclip names, and the links they should link to.
In my "for" statement, it should run through each movieclip and associate each with its link.
The problem is that onRelease, the getURL always goes to the last URL (oLinks.link4 = "free.html").
I understand that this is because that's the last value the thisLink variable is given, but I really don't know how to fix it. Any ideas?
Cheers
Code:
var oLinks:Object = new Object();
oLinks.mc0 = mcAbout;
oLinks.mc1 = mcCoaching;
oLinks.mc2 = mcTraining;
oLinks.mc3 = mcContact;
oLinks.mc4 = mcFree;
oLinks.link0 = "about.html";
oLinks.link1 = "coaching.html";
oLinks.link2 = "training.html";
oLinks.link3 = "contact.html";
oLinks.link4 = "free.html";
//
var numberOfLinks:Number = 5;
//
for (var i = 0; i<numberOfLinks; i++) {
thisMC = oLinks["mc"+i];
thisLink = oLinks["link"+i];
//trace("thisMC is"+thisMC+" and thisLink is: "+thisLink);
thisMC.onRelease = function() {
//trace("onRelease called");
getURL(thisLink);
};
}
View Replies !
View Related
Simple Array Compressor
Hi all, I was working on allowing my users to save a jpeg and in doing so
was researching some ways to compress the data before sending to the server
for reconstruction. After finding Base64 and LZW way too slow for my needs,
at least in AS2/VM1, I hit upon a simple and very fast array compression
technique that is reminiscent of RLE. Have a look at my blog to check it out
and see my results on a few different images:
www.dmennenoh.blogspot.com
--
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/
View Replies !
View Related
Simple Array Question
hi
how do I access pArray outside the lv-function??
lv.onData = function(text){
pArray = text.split("&");
}
}
And how can I make a copy of an array? working best with a for-loop?
regards, henrik
View Replies !
View Related
V.simple Array Understanding
Just getting my head around simple arrays. I mean simple arrays using flash.
What am I doing wrong! - All I am doing is trying to perform an action on all the elements in the array.
ActionScript Code:
myArray = new Array("one", "two", "three", "four"); myArray = _root._rotation = 45;
I can see the issue, basically everything on the _root timeline would be rotated by 45 degrees
So how do I refer to anything in the actual array itself, i also tried.
ActionScript Code:
myArray = new Array("one", "two", "three", "four"); myArray = _root.myArray_rotation = 45;
Any overview would help, sorry for the simplicity of this.
T
View Replies !
View Related
Simple Array Question
Say my array is ["apple", "orange", "cherry"].
Is there a way to search "orange" to find out what index# it is in the array?
myArray[find the index# of "orange"] which would result in "1"
("apple" being "0" and "cherry" being 2.)
Hopefully that makes sense.
Thanks in advance for any help.
View Replies !
View Related
Simple Array Question
the below code works:
var buttonArray:Array = new Array (button1, button2, button3, button4, button5);
for (var i = 0; i < buttonArray.length; i++) {
buttonArray[i].onRelease = function () {
this._x += 5;
};
}
but this doesn't:
var buttonArray:Array = new Array (button1, button2, button3, button4, button5);
for (var i = 0; i < buttonArray.length; i++) {
buttonArray[i].onRelease = function () {
this.onEnterFrame=function(){
this._x += 5;
}
};
}
Why won't the onEnterFrame work?
View Replies !
View Related
Simple Array Question
I have an element in an array that comes from an alphabetical listing. The element might be something like "Frog, The" I need to remove the comma from the element and reverse it so it reads "The Frog" The code I have is as follows, but the comma is still there, any help is appreciated.
cols[1] = cols[1].split(",").reverse.join();
View Replies !
View Related
Simple Array Problem
I have an Array looking like this;
Code:
var images:Array = ["large/00.jpg", "large/01.jpg", "large/02.jpg", "large/03.jpg", "large/04.jpg"];
I have an container_mc clip to load the images into and a forward_mc and a back_mc button to click through them. My simple question is; how do I load the jpeg's into the container_mc clip from the Array? Anyone?
View Replies !
View Related
Really Simple XML/Array Question
Hello all,
I am rewriting a slideshow to be AS3 compliant and having some problems with some relatively simple things. The slideshow reads and XML file and then using a dynamic resizer displays the image and comments. So far, I am stuck at creating the arrays for the images and comments. Here's an example. The trace(imageElement) is working fine, but the push seems to be doing nothing whenever I query the array. So something simple is going wrong here. If anyone has a link to a tutorial for a slideshow like this, I'd appreciate it.
ActionScript Code:
var xmlLoader:URLLoader = new URLLoader();var xmlData:XML = new XML(); xmlLoader.addEventListener(Event.COMPLETE, LoadXML); xmlLoader.load(new URLRequest("images.xml"));function LoadXML(e:Event):void { xmlData = new XML(e.target.data); ParseImages(xmlData); }var imageArray:Array = new Array(); //creating a new array for the imagesfunction ParseImages(imageInput:XML):void { var imageChildren:XMLList = imageInput.ImageInfo.FileName; for each (var imageElement:XML in imageChildren) { trace(imageElement); imageArray.push(imageInput.ImageInfo.FileName); } }
View Replies !
View Related
Simple Array Question
hi
how do I access pArray outside the lv-function??
lv.onData = function(text){
pArray = text.split("&");
}
}
And how can I make a copy of an array? working best with a for-loop?
regards, henrik
View Replies !
View Related
Simple Array But, But Its Still Not Working
Hi i have the following code on a fla
ActionScript Code:
var list:Array = new Array ()
list[0] = "<ul>"
add_btn.onPress = function(){
list.push("<li>"+myText.text+"</li>")
myText.text = ""
}
fin_btn.onPress = function(){
list.push("</ul>")
//trace(list.join(""))
var myString:String = new String()
total = list.length
for (i=0; i<total; i++){
myString += list[i]
}
trace( myString)
}
then on the screen is
input text field called myText
button called add_btn
button called fin_btn
as you can see im trying to get out a working html <ul></ul>
it gives out this trace when you click fin_btn
<ul><li>item one
</li><li>item two</li><li>item three</li></ul>
anyone know its putting the first </li> on a new row as its causing a gap to occure in the html list
hope someone can help
Stephen
View Replies !
View Related
Comparison To An Array - Should Be Simple...
say I have an array:
ActionScript Code:
myArray = new Array(3,5,14,16,24)
now I have a variable, myVar that I want to compare to each element in this array. I DON'T think it can be done this way:
ActionScript Code:
if(myVar==myArray){success}
What's the simplest method this can be done? Essentially I'm looking to use the array to avoid an if() statement like this:
ActionScript Code:
if((myVar == 3) || (myVar == 5) || (myVar == 14) etc...){success}
I know it can be done using a for() statement to search through each array element, but I'm wondering if there's an easier way. I'm using AS1. Thanks in advance for your help!
View Replies !
View Related
Simple Array Question
I'm wondering how to create an array on the main timeline that references buttons in a movie clip..
so the setup is like this:
instance: nav
inside nav: button1, button2 button3, button4, etc..
i tried all sorts of ways to create an array that would access these buttons, but it kept tracing out undefined..
var buttonArr:Array = new Array("button1", "button2")
//if i trace this, i get button1,button2 but not inside nav obviously...
var buttonArr:Array = new Array("nav.button1", "nav.button2")
//this will give me nav.button1, nav.button2 - but i can't figure out how to access the buttons..
buttonArr[0].onRollOver = function(){
};
i know this is probably simple for one of you AS heroes out there... any suggestions? Thanks in Advance..
View Replies !
View Related
|