I'm new to AS3, but our teacher thinks we're all amazing geniuses and assigned us this project which was due last class. Great, I know, I have to do it even if it's late. Only 5 students out of 28 were able to finish the assignment.[code]Those are all the assignment details he gave us.All I have so far. What I have only adds the array to the list. Nothing much else.[code]Also, when the array prints on a new line, the prior item on the array must not print as show above.
I have 4 buttons and an empty array. When a button is clicked,I'm adding a element to an array with array.push. However, I want to check the array 1st to see if that element exists. If so, then don't add it. Here's what I have thus far
[Code]...
Now I'm taking it I'd have a conditional statement to see if the element already exists. Unfortunatly I cannot just disable the button. I searched the AS dictionary but oddly enough it doesn't have an easy way to search an array. And IndexOf seems to only work for a string.
I'm getting the following error in my compiler when I run this, even though it does exactly what I want it to do.
Quote:
TypeError: Error #1010: A term is undefined and has no properties. at boxes070909_fla::MainTimeline/drawboxes()
I'm more interested in understanding why the error is occurring and how to correct it, than rewriting the code in a way that I don't understand it anymore.(Which was my friend's solution)
box_mc is an 80x80 grey square movieclip, of class Box.
ActionScript Code: var i:Number=0; var j:Number=0; var totalColumns:Number=5; var totalRows:Number=5;
i have an array that generates a list of buttons. What i would like to do is split the list into two columns of 5 buttons each rather than one column of 10 buttons.I thought of creating two arrays of 5 items each, but couldn't figure out how to assign my dynamic button to the second array or set a second x/y position for the new column
Code: public class Actions extends MovieClip { private var off:Object;
i defined a global array in the first frame.When the user clicks on a button a value is inputted into the array, and they can click on several so all the different values are stored in an array.I want to display the last value of the array, so the last button they clicked on, on a separate frame.so i define my array like:
_global.purchases = new Array();
and the code on my button is:
on (release){ _global.purchases="awhite"; _root.gotoAndPlay("checkout_page"); }
and the code on the frame with the text box is:
var arrayCount = purchases.length; var latestValue = arrayCount-1; if (purchases[latestValue]=="awhite"){ imagename_txt = "A White"; }
However, the text doesnt display at all. If I trace my array then I get "awhite". If i trace arrayCount I get "6" and "5" for latestValue. But if i try and trace purchases[0] then I get "undefined".
i defined a global array in the first frame.When the user clicks on a button a value is inputted into the array, and they can click on several so all the different values are stored in an array.I want to display the last value of the array, so the last button they clicked on, on a separate frame.so i define my array like:
_global.purchases = new Array();
and the code on my button is:
on (release){ _global.purchases="awhite"; _root.gotoAndPlay("checkout_page");}
and the code on the frame with the text box is:
var arrayCount = purchases.length;var latestValue = arrayCount-1;
if (purchases[latestValue]=="awhite"){ imagename_txt = "A White";}
However,the text doesnt display at all. If I trace my array then I get "awhite". If i trace arrayCount I get "6" and "5" for latestValue. But if i try and trace purchases[0] then I get "undefined".
I am trying to display few data from a PHP (which communicates with a second php that uses a database) into flash.I have created the code needed, but when tracing the php I get "Array" as a result of the trace. How can I display the data that is inside that php array into flash?
Say I have: public var usersOnlineArray:Array = new Array(bob,jim,tim,marry,luke);
and when i put that into my datagride like this:
buddylist.dataProvider = new DataProvider(usersOnlineArray); buddylist.rowCount = buddylist.length; bldBuddyList(buddylist);
how could i, lets say prevent luke from appearing in the data grid? basically make him not appear but technically "still be there" so i can make him reappear later but?
i defined a global array in the first frame.When the user clicks on a button a value is inputted into the array, and they can click on several so all the different values are stored in an array.I want to display the last value of the array, so the last button they clicked on, on a separate frame.so i define my array like:
_global.purchases = new Array();
and the code on my button is:
on (release){ _global.purchases="awhite"; _root.gotoAndPlay("checkout_page"); }
and the code on the frame with the text box is:
var arrayCount = purchases.length; var latestValue = arrayCount-1; if (purchases[latestValue]=="awhite"){ imagename_txt = "A White"; }
However, the text doesnt display at all. If I trace my array then I get "awhite". If i trace arrayCount I get "6" and "5" for latestValue. But if i try and trace purchases[0] then I get "undefined".
I'm trying to get values of an array to display into a single text field but I'm also trying to bold the first few letters dynamically using the setTextFormat() method.Basically trying to achieve what the google search function does when it comes up with auto suggestions and each keyword gets un-bolded.
i have two different library objects which i add to stage and have them moving around. I have no problems getting the number of all the objects on stage into one dynamic text box, but i want to have the number of each of the two different objects shown in their separate text box. When i try this code, all i get in the dynamic text-boxes, are the name of the objects.
I have a project I am working on and I am stuck on this. I have an array that holds songs. I want to somehow print these items out and make them buttons so that when I click on it, it will call a function. For proof of concept, i will just make my own code here and you guys can give me insight:
Code: Select all var a:Array = new Array("song1.mp3", "song2.mp3", "song3.mp3", "song4.mp3");
Now i want this to firstly display:
song1.mp3 song2.mp3 song3.mp3 song4.mp3
I tried a for loop and a dynamic text field but that just overwrites itself. Next, it would be nice if it could add an event listener or call a function loadSong(curentSong[1]) ===with whatever position it is in the array between the brackets==
This sounds so simple, but its to save me doing things like this:
Code: var Lol:Array = new Array(); Lol["Rofl"] = 0;
_root.Lol_Rofl = Lol["Rofl"]; Just to get the array value to display in a dynamic textfield, is there any other more efficient way so that I do not need to declare a seperate variable with the value of the array data to get it to display?
I used an array called lane because it wasn't working without the array, but still isn't. I kept the array just because it keeps it just a bit organized. The trouble is the line: lane[number1].text = number2; Because lane[number1].text isn't recognized as a text box, well not a text box with the same name as I want at least... Each four text boxes do not show anything?
I'm trying to create something that will load a bunch of images into an array and then be displayed whenever needed via using the attachMovie() function.
Code: for (var i=1; i<list.length; i++) { //list is an array full of urls to images _root.createEmptyMovieClip("img"+i,i); loadMovie(list[i], "_root.img"+i); }
I dont think this is what I want because I don't actually want the images to appear right here (this is the loading part). What I want is each image to be in a separate symbol with a unique identifier so that I can create them dynamically during runtime.
I'm in the process of trying to work out how a scoring system will work in the game that I'm developing.I've added Code:var counter:int = 0; at the beginning of my code, and when the player mouses over objects to destroy them the killObject function includes the line Code:counter ++;The bit I'm struggling with is displaying this number in a dynamic text box.I've had a search around but can't seem to find what I'm looking for.All of the gameplay code is written in one frame of the main timeline and it begins after a short introduction animation. When the gameplay is over the AS3 code will instruct the movie to move on to the next frame of the timeline so that an outro animation can be played. The player's final score will be displayed at this point.
I have a variable call php_variable that loads from the php. It echos all the necessary variables. I have 2 array, Tel_start and Tel_area. The messages.text is just a text field I use to test if things are loading properly.
[Code]...
It display the correct string. But when I use Tel_start[0] like above, I got undefined. So here, the actual quesetion, what's the proper way of storing those variables and displaying it?
I'm utilizing this code for a photo gallery, and I'm having issues with adding movie clips to arrays. This code compiles with an error stating "Label must be a simple identifier."
Code: //Encapsulating mc for thumbnail images. var mcMaster = new MovieClip();
I have 4 buttons and on release of any of the buttons it will call a function. How do you apply a function to any member of an array?I've placed "any_btn" into my code below to show what I mean
This program has a green ball (var ballplayer) that theplayer moves around in 3D space using the numpad keys (8, 2, 6, 4)to move the green ball (up, down, right, left). And it also usesthe up and down arrown keys to move the ball along the z-axis.There are also five red balls moving around the screen. As the redballs collide they turn blue. The red/blue balls are z-sorted, sothat the balls closer to the viewer appear in front. The balls allmove around in an invisible cube that they bounce off. Problem: How do I get the player's green ball to be z-sortedwith the other balls? I think I either need to add the green ballto the array called balls before it is sorted. Or create an arrayfor the green ball and then add the two arrays together (if that'spossible) before z-sorting. I tried to add the green ball directlyto the balls array but it didn't seem to work. I'm new to AS3 andprogramming, so I may have made a simple mistake.
Trying to add MC's to the stage from the library using their class name, but its not working out. I'm convinced the below should work, but it does not so there must be something wrong.I get the following error:TypeError: Error #1010: A term is undefined and has no properties.at tesVars2_fla::MainTimeline/frame1()
I have an array, strictly numbers, how could I add... say array[0](value=2)+array[1](value=1) to equal 3? What I come up with is an undefined error, or not a number...
i have a clip on the stage that is 650px wide. i am placing dynamicaly sized clips on top of that clip. when they are created, their names are placed into an array. I am trying to take the items out of the array, find their widths, and then figure out if the width will be greater than 650 if the next clip is placed down. i'm stuck on the loop.
("track1Clips" is the array i have the clips in) here's what i have for (i=0; i<_root.track1Clips.length; i++) { clipName = _root.track1Clips[i];
I have some 2D arrays. I would like to add a 3rd dimension. How do I add this 3rd dimension?
I don't know if I'm stating this correctly but what I would like to do is have an array that holds a bunch of [thumb.jpg, number, bigpic.jpg]. This way all the values entries are related. So if I wanted to get any of these values I could use the same key value.
I don't know if this makes sense. Plus, do I get the values of the 3rd dimension by using [i][2] in a for-loop? I know that [i][0] gets the 1st dimension and [i][1] gets the 2nd dimension.