Flash Arrays HELP
Hello i am reaching a level of action script i got no idea of so i am sorry if i not make much sence.
is it possable in flash to make an array it can store and value and if the value in the array it dones somthing different like.
Sets value Check if value in array
If not in array add it
If in array show error message
end if end if
Any help i would love thanks in adavnce
nig1985
Ps sorry if there is spelling errors
FlashKit > Flash Help > Flash Newbies
Posted on: 03-26-2006, 12:56 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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?
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.
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
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;
}
Can Flash Do This? (arrays)
Can flash handle more then one variable in an array. Let me explan.
user=new array()
user[0]=bob,30,male
user[1]=mary,23,female
Can flash do this? If so what is the correct syntax for it and how do I pick out the variable I want.
Thanks for any help.
Php, Flash And Arrays...
Hi all,
I was a-wondering if it was possible to pass an array to a php script from Flash using loadVariablesNum...
thanks for any help, Chi
Flash Arrays And Asp
any idea how i can update the x and y values as i move my movieclips around?
pos="chair1,100,100,chair2,200,200";
//lets say this string has come from asp
clips = pos.split(',');
for(i=0;i<clips.length;i++){
if(isNaN(clips.charAt(0))){
duplicateMovieClip(ChairMC,clips,i);
obj= this[clips];
obj._x = clips[i+1];
obj._y = clips[i+2];
}
}
Flash Arrays
I have an array called Name_Array
I have 8 different names in there
Name_Array [0]= Jim
Name_Array [1]= Jason
Name_Array [2]= Mike
Name_Array [3]= Raymar
Name_Array [4]= Yell
Name_Array [5]= Linda
Name_Array [6]= Debbie
Name_Array [7]= End
I have an MC with a Dynamic Text box (info) that duplicates based on how many Name_array's there are.
I have a button that I want to have someone click on and bring up the proper name. So if I were to click on Jim it would bring up Jim in the display area. Like wise for Raymar or Linda or Jason.
How do I get that to work?
Thanks for the help
Arrays In Flash 5
Hi all. I have a problem in that I have inherited a project from an old programmer/designer and it is a bit of a mess. The project is an interactive map that can have unlimited hot points (each of which is a movie clip). These hot points have two values, 1 and 0 which tells flash whether they should be visable or not. Alot of these hot points are set in big groups and to make them stand out sit on top of a semi transparent rectangle.
The person using the map has the ability to view specific sets of hotspots and hide others which means that the rectangle box they sit on changes size and position dynamically. Here is the code that does this:
if (_root.royalc == 1 && _root.hall == 0 && _root.europ == 0) {
_root.map.places.royalc._y = -275;
_root.map.places.w7._height = 21;
_root.map.places.w7._y = -275;
}
if (_root.royalc == 1 && _root.hall == 0 && _root.europ == 1) {
_root.map.places.royalc._y = -275;
_root.map.places.europ._y = -255;
_root.map.places.w7._height = 42;
_root.map.places.w7._y = -265;
}
As you can see, each and evey eventuality has to be coded in. So for example, say there were just 8 partners in one rectangular box, then I would have to write 57 variances of the above code. This is very time consuming and not practicle. The only solution I can think of is to use arrays so I could state that if one is visable use these values, if two are visables use these values, thus the box with 8 hotspots would only require 8 variances of code instead of 57!
Problem is I have absolutely no knowledge of arrays. I checked out the tutes on this site but they didn't really help...... maybe I'm just too stupid but this is really bugging me and I have no idea why the old guy wrote the code the way he did!! If you can help, or point me to more advanced tutorials that could help me with this problem then I would be eternally grateful. TIA.
PHP To Flash - Arrays
Hi guys,
If i have the following:
PHP Code:
$i = 0;
while ($row = mysql_fetch_assoc ($result_2)) {
while (list ($key, $val) = each ($row)) {
$r_string .= '&' . $key . $i . '=' . $val ;
}
$i++;
}
print "status=You're in&".$r_string."&checklog=1";
i recieve the following output:
Code:
status=You're insky&n=2&userid0=0001&name_First10=mic&name_Last10=mac&fire_text10=Fire Text to go here....&randomno0=23&str_date0=2003-12-14&yourscore0=101&userid1=0002&name_First11=soon&name_Last11=yu&fire_text11=More Fire Text here....&randomno1=32&str_date1=2003-12-13&yourscore1=200&checklog=1
What i want to know is how can i write this back to flash dynamically?
Cheers,
Suzy
Flash, Php, And Arrays
PLEASE HELP!
i have a flash movie that activates a php script that includes this:
$this_db='starving_games';
$rs2= mysql_list_tables($this_db);
for($num=0; $num < mysql_num_rows($rs2); $num++)
{ $list.=""".mysql_tablename($rs2,$num).""".","; }
print("roomname="."[".$list.""bz""."]");
this php code lists the tables in a mysql database:
this returns a variable that looks like this:
roomname=["thing","hr","bz"]
i want flash to read this as an array.
when i trace it, or view it in a text box it appears just as it should. like this: ["thing","hr","bz"]
and if i type:
roomname=["thing","hr","bz"]
into the root timeline, it works fine with some code and text boxes im using.
BUT...when i try to load this info with the php code from the database, and the same thing comes in, it does not respond to:
roomname=["thing","hr","bz"]
i think what might be happening, is that it's reading ["thing","hr","bz"] as a string rather than an array. how do i get flash to know it's reading an array and not a string?
any suggestions?
thanks!
Flash Arrays And Php
can you pass arrays from flash to PHP, edit the arrays and send them back ?
any examples would greatly appreicated.
Thanks
Drew
Flash Arrays In Cfx
Hi all this is my 1st post i hope u can help.
i am using flash remoting to save some values from an array to a database using coldfusion the thing is how do i pass the values from flash the array name is xpos. i think this is right. myservice.save(xpos) this passes the value xpos to the service function called save in my coldfusion page. i understand the sql i am, just learnin coldfusion and unsure on how to access the flash array now? any help would be great thanks..
Flash Arrays And XML
Hi to all you geniuses,
I have a frustrating problem : I am trying to build a flash dynamic menu (the principle of which is visible at www.torkerecords.com/econe) where every thing is totally dynamic.
That is there is a CMS that builds an XML on the fly that contains all the menu structure. The thing is that the menu has three levels : Main link - sub link - and sub sub links.
The whole code is ready and functional when I fill in the data manually via AS, but I can't manage to build my arrays dynamically.
Basically, what I want is three arrays - one for the main links, which is a normal array - another one for the sub which is an array of arrays and the last one an array with araays of arrays...
ActionScript Code:
var mainArray:Array = new Array(1,2,3,4,5,6,7)
var subArray:Array = new Array([1,2,3], [1,2,3,4], [1,2,3,3])
var subSubArray:Array = new Array([[1,2,3], [1,2,3,4], [1,2,3,3]], [[1,2,3], [1,2,3,4], [1,2,3,3]])
quite a headache isn't it?
so the thing is that I can fill the first one perfectly, but I can't manage to fill the others what I tried is
ActionScript Code:
for(i=0 i<10 ; i++){
mainArray[i] = whatever // this obviously works
for(j=0;j=4; j++){
subArray[i][j] = whatever // this DOESN't work...
for (k=0; k<6;k++){
subSubArray[i][j][k]= whatever // this obviously doesn't work either
}
}
}
So if anyone has any suggestion on the question or another idea on how to store my menu links and related sublinks without using components...
Thanks a lot
D.
Arrays In Flash
Little help please. I want to be able to record the current value of my health bar in my simulation. So for my simulation which for now say lasts for 24hrs but is excellerated, i want to be able to record the value of health every minute or second/ hour. Can anyone advise me if this can be done at all if it can give me some guidance please. I want to be able to record the value of health using a array. Can this be done thankyou.
Flash And Arrays
i am using this code below to read an array of videos and play them in a sequence. I want to send this array to flash from PHP, how would i go about this?
The array is the videoList and i want to be able to dynamicaly load this.
Code:
myVideo.playPauseButton = play_paus_btn;
myVideo.muteButton = mute_btn;
import mx.video.*;
var videoList:Array = new Array();
videoList[0] = "blue.flv";
videoList[1] = "red.flv";
videoList[2] = "green.flv";
videoList[3] = "purple.flv";
videoList[4] = "yellow.flv";
var currentlyPlaying = 0;
// Initialize first play
myVideo.contentPath = videoList[currentlyPlaying]; // Changed this as it is a specific function for changing the file
myVideo.play(); // Should start the player without the parameters from the component
trace(currentlyPlaying);
var listenerObject:Object = new Object(); // create listener object
listenerObject.complete = function(eventObject:Object):Void {
currentlyPlaying++;
//if (currentlyPlaying > videoList.length) { // Resets counter if reaches end of array
//currentlyPlaying = 0;
//}
trace(currentlyPlaying); // Just traces new file in testing
myVideo.contentPath = videoList[currentlyPlaying]; // Change source file
myVideo.play(); // Play new file
};
myVideo.addEventListener("complete", listenerObject); // Initialize listener
thank you for any help
Arrays In Flash 6 Vs 7
i have:
PHP Code:
var dDoors:Array = new Array(doorS);
var uDoors:Array = new Array(doorN);
and both doorN and doorS are MovieClip instances. so, if i trace dDoors[0] while publishing in flash 7, it gives me the full instance path:
_level0.scene.doorS... which is fine.
when i publish in flash 6, however, and trace dDoors[0], i get:
_level0.scene.doorN,,_level0.scene.doorN,,,
doorN isn't even in that array... anybody know why that would be, and more importantly, how to fix it??
Arrays In Flash
hi
is it possible to break apart a number and enter it into an array i.e. if a number was 123, then an array[3] could record the 1, 2, and 3, numbers separately?
cheers in advance for any response
sifu
Flash And Arrays
i am using this code below to read an array of videos and play them in a sequence. I want to send this array to flash from PHP, how would i go about this?
The array is the videoList and i want to be able to dynamicaly load this.
Code:
myVideo.playPauseButton = play_paus_btn;
myVideo.muteButton = mute_btn;
import mx.video.*;
var videoList:Array = new Array();
videoList[0] = "blue.flv";
videoList[1] = "red.flv";
videoList[2] = "green.flv";
videoList[3] = "purple.flv";
videoList[4] = "yellow.flv";
var currentlyPlaying = 0;
// Initialize first play
myVideo.contentPath = videoList[currentlyPlaying]; // Changed this as it is a specific function for changing the file
myVideo.play(); // Should start the player without the parameters from the component
trace(currentlyPlaying);
var listenerObject:Object = new Object(); // create listener object
listenerObject.complete = function(eventObject:Object):Void {
currentlyPlaying++;
//if (currentlyPlaying > videoList.length) { // Resets counter if reaches end of array
//currentlyPlaying = 0;
//}
trace(currentlyPlaying); // Just traces new file in testing
myVideo.contentPath = videoList[currentlyPlaying]; // Change source file
myVideo.play(); // Play new file
};
myVideo.addEventListener("complete", listenerObject); // Initialize listener
thank you for any help
Help Where Does Flash Keep This Arrays From VB ?
Somebody HELP me !!! I am a newbie.
I am using Flash in VB. I am sending a series of SETVARIABLE from VB in a loop in the form of an array like vbarray[i],value(i).
Flash Module:
Only one timeline with one frame.
I am able to view the value[i] when I assign a textbox to the variable of vbarray[i]. So, I know that vb is sending the array and its values properly.
Since I am unable to find out where Flash saves this array that it receives from VB, I am unable to access this array for using in code.
I have tried using _root.vbarray[i], _level0._root.vbarray[i], still the vbarray.length shows zero.
I am unable to use my debugger and thus unable to track it.
I am willing to send the fla file if necessary
Thanks much.
PHP To Flash - Arrays
Hi guys,
If i have the following:
PHP Code:
$i = 0;
while ($row = mysql_fetch_assoc ($result_2)) {
while (list ($key, $val) = each ($row)) {
$r_string .= '&' . $key . $i . '=' . $val ;
}
$i++;
}
print "status=You're in&".$r_string."&checklog=1";
i recieve the following output:
Code:
status=You're insky&n=2&userid0=0001&name_First10=mic&name_Last10=mac&fire_text10=Fire Text to go here....&randomno0=23&str_date0=2003-12-14&yourscore0=101&userid1=0002&name_First11=soon&name_Last11=yu&fire_text11=More Fire Text here....&randomno1=32&str_date1=2003-12-13&yourscore1=200&checklog=1
What i want to know is how can i write this back to flash dynamically?
Cheers,
camcim
Flash MX - Arrays
Hello,
I was wondering if Flash MX's array object could handle multi-dimensional associative arrays similar to:
Array[0]['ID'] = 1;
Array[0]['Name'] = "test 1";
Array[1]['ID'] = 2;
Array[1]['Name'] = "another test";
etc...
If so, how do I set it up?
Thanks,
-jbuckle24
Html To Flash Arrays
Hi ive got this long standing problem and noone ahs been able to fix it if you fancy a challenge Id be really grateful to see the outcome.
TIs a mailing list form for flash going to a PHP script, the html works but flash doesnt.
HTML:
form action="listmessenger.php" method="post">
<table cellspacing="1" cellpadding="1" border="0">
<tr>
<td><font face="Comic Sans MS" size="2">E-mail Address: </font></td>
<td> <font face="Comic Sans MS" size="2">
<input type="text" name="email_address" value="" />
</font></td>
</tr>
<tr>
<td><font face="Comic Sans MS" size="2">Full Name: </font></td>
<td> <font face="Comic Sans MS" size="2">
<input type="text" name="full_name" value="" />
</font></td>
</tr>
<tr bordercolor="1">
<td> <div align="center"><font face="Comic Sans MS" size="2">Subscribe:<br>
<input type="radio" name="action" value="subscribe" CHECKED/>
</font></div></td>
<td> <div align="center"><font face="Comic Sans MS" size="2">UnSubscribe: <br>
<input type="radio" name="action" value="unsubscribe" />
</font></div></td>
</tr>
<tr>
<td colspan="2" align="right"> <font face="Comic Sans MS" size="2">
<input type="hidden" name="group_ids[]" value="1" />
<input type="submit" name="submit" value="Proceed" />
</font></td>
</tr>
</table>
</form
Ive attached the flash form i programmed, and the result for it can be found at www.lawsofshotgun.com/test.htm where i get a PHP error.
Flash MX 2004 And Arrays
I think what I want to use is an array but here is what I am doing. I downloaded a panoramic view (FLA) that takes a picture and makes it look like a 360 degree view. I didn't want to move the picture up or down so I took that out but now I do not want the picture to move with the mouse. I want it to scroll by itself because it is going to be in the backround of a different image. Any help would be great. Thanks.
Passing Arrays Into Flash
Hi,
Is there a simple way to pass an array into Flash?
I have a database that I want to query.
I need the results of the query passed into an array in Flash.
I'm using Flash MX 04, SQL DB, and ASP.
My Process is currently as follows:
I've got a DB in SQL with data.
I'm using ASP to query the database and return the results.
In asp, I'm formatting a string of variables -
&item1=a|b|c&item2=d|e|f&item3=g|h|i and so forth
In Flash I'm using LoadVariablesNum and pointing to the asp page.
I parse the string so that item1's data will be in array[0], item2's data will be in array[1] and so forth.
The data to be passed into flash is a bit long so the strings are quite long.
Is there an easier way to do what I am doing?
Thanks.
Returning Arrays To Flash From PHP
Hi,
I have a php file that have just executed
$query = "some mysql query";
$result = mysql_query($query);
$sarray = mysql_fetch_array($result, MYSQL_NUM);
Where the array should be an array of integers representing all the rows from the query (1 column, X rows).
My question is:
how do i return this array into my flash file?
Will print "nameofarrayinflash=sarray[sarray]"; work? I'm not quite sure how that function works when it comes to arrays, as I only know how to use it when it comes to single variables.
Thanks.
Passing Arrays To Flash From PHP
Hi
I need to let my admin guy enter dates into external files for my calendar in my swf to load onto an events calendar.
The events calendar is actually more of a timeline, and these dates will place dots on the timeline.
Any ideas on the best way to do this??
Thanks a lot,
Chris
http://emma.dar.cam.ac.uk/~cdj21/smrtj/aru
Flash Calculations / Arrays
Hi I am new to flash and I am trying to create a vending machine interface. I have made buttons which are images of the products available. I have a seperate section which I want to add up the cost each time one of the products/buttons are clicked. I have been told to look at arrays but I do not understand how they work or what to put in.
Could someone please explain what would be needed to calculate the cost and what each individual button would need to contain. Example coding would be much appreciated.
Thank you for your time.
Sam
Arrays From A Php Page Into Flash
Hi, I have a PHP containing an array that I want to load. http://www.stacybuckley.com/vars/pics.php. I think my syntax is wrong - I am probably going about this all wrong actually. Would I use LoadVars to do this? And then can I reference he variable within the array access operators?
Attach Code
var myPicArray:LoadVars = new LoadVars();
myPicArray.load ("/vars/pics.php");
var picnames:Array = [myPicArray]
Flash <-> PHP Communications Via Arrays
hi everyone,
i am new here and would first of all like to ask you to explain things well because i am a real beginner in actionscript (i am using flash mx 2004)
i have made up a php page (you can find here) that retrieves data from a mysql database and well should send it to my flash application using arrays via
Code:
loadVariablesNum("get.php", 0, "POST");
(note that at the end of the long string on my php page there is a &maxx=21 (that will be used to show the maximum number of items in the arrays i want to transfer)
well then when i try and start debugging my actionscript, i can fugure out that the data has actualy been recieved from the php code because i have _root.maxx == 21 is true but the remaining data i intended to transfer in arrays is not transfered : _root.xpos[1] == 9.5 is false.
could anyone please tell me how to adapt things explained in this tutorial in order to be able to use arrays to transfer data.
thank you,
khaan
[PHP->Flash]Problem With Arrays
Basically what I'm doing is pulling information from a MySQL database and putting into a string and then loading that information into Flash using LoadVars. I've used this tutorial to get me off the ground.
This is the PHP file (named posts.php) and here is the string is outputs.
All should be well and good from there, I think. There are four separate things for each entry's information: ID, title, content, and date.
Here is the Actionscript code that loads it and displays it:
ActionScript Code:
#include "textformat.as"_root.site.createEmptyMovieClip("blogPage", 2);loadEntries = new LoadVars();loadEntries.load("http://localhost/fblog/posts.php");loadEntries.onLoad = function() { myIDs = new Array(); myTitles = new Array(); myDates = new Array(); myContent = new Array(); for (var a in this) { //this is where the magic needs to happen //but I have no idea what to do! if (a != "onLoad") { myIDs.push(this[a]); trace(myIDs); } } var e:Number = 0; for (e=0;e<myIDs.length;e++) { _root.site.blogPage.attachMovie("entry", "entry"+e, 50+e); _root.site.blogPage["entry"+e]._y = 150*e; _root.site.blogPage["entry"+e].dateText.text = myDates[e]; _root.site.blogPage["entry"+e].contentText.text = myContent[e]; _root.site.blogPage["entry"+e].titleText.text = myTitles[e]; _root.site.blogPage["entry"+e].idText.text = myIDs[e]; }};
It's very primitive at the moment.
Here's my problem, I have no idea how to pull apart the string to get the right information in the right spots.
What I want to do is split the string into it's elements (ie. id0, title0, date0, content0, id1, etc.) and once I've accomplished that, I want to sort out each ID into an array called myIDs, and each title into an array called myTitles, etc.
It's been a long while since I've dealt with actionscript and I've never loaded data from a MySQL database for use in Flash before, so any comments are welcome on how to best accomplish this.
Thanks a lot,
Colin
Note to Mods: I put it in this forum because it really has very little to do with PHP and a lot to do with the Actionscript to get this working. If you feel this belongs somewhere better, go ahead and move it.
[Flash 8] Mulitdimensional Arrays
Hi, i'm using a multidimensional array and want to send it to php and add the data inside it to a mysql database. I'm using flash remoting and wondering is there any difference when using mulitidimennsional arrays in flash and php, are they the same?
thanks in advance to anyone who knows
Flash <-> PHP Communications Via Arrays
hi everyone,
i am new here and would first of all like to ask you to explain things well because i am a real beginner in actionscript (i am using flash mx 2004)
i have made up a php page (you can find here) that retrieves data from a mysql database and well should send it to my flash application using arrays via
Code:
loadVariablesNum("get.php", 0, "POST");
(note that at the end of the long string on my php page there is a &maxx=21 (that will be used to show the maximum number of items in the arrays i want to transfer)
well then when i try and start debugging my actionscript, i can fugure out that the data has actualy been recieved from the php code because i have _root.maxx == 21 is true but the remaining data i intended to transfer in arrays is not transfered : _root.xpos[1] == 9.5 is false.
could anyone please tell me how to adapt things explained in this tutorial in order to be able to use arrays to transfer data.
thank you,
khaan
Instance Arrays In Flash Mx?
Is it possible to have a symbol array in flash MX? For example, let's say I have a movieclip symbol and 8 instances of that symbol in the frame. Do I have to give each instance a unique instance name before I can refer to them in my actionscript? or is it possible for me to address each instance as a member of an array?
Like
symbol[0]._alpha=0;
symbol[1]._alpha=50;
etc...
Help is greatly appreciated, thanks .
Using Arrays And Functions In Flash
Hi
I am making a project by using arrays and functions.
Functions are quite easy but in arrays i stucked...
Any one know how to add array values in runtime.
Ex:
var mind = new array();
i want user to add values and store it in this array for further use. I heard of push method but no idea how to use it.
Any help will be appreciated.
Thanks in advance...
Flash And Integers/ Arrays :(
I have an array with the following in:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 512 1231 763 167 1624 736 3243 643 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
I am trying to find the highest num, I am using the code below:
but it keeps returning 763 as the highest.
Code:
var High = 0;
for(i=0;i<=GCount.length;++i)
{
text = text + GCount[i] + " ";
if(GCount[i] > High)
{
High = GCount[i];
}
}
Thanks
FLASH JEDI's Please Help Me (arrays & Variables)
i have this:
3 dynamic text fields with variables for each called:
"artist","title" & "combined"
-----------------------------------------------
here's my code
digit = 1
artist1=["name", "title"];
artist2=["name", "title"];
artistArray = "artist"digit;
artist = artistArray[1];
title = artistArray[2];
combined = artistArray
-----------------------------------------------
I can sucessfully get the text field "combined" to show "artist1[1]".
but the text field "artist" does not show "name" from the array I set up.
what am I doing wrong?
I appreciate any help from you "FLASH JEDI's" out there.
Dennis
P.S. for extra credit, I need to know how to make it so that when I click a button, an action ads 1 to "digit" so that the variables "artist" & "title" are updated to show for example: "artist2", then "artist3" & so on.
Flash MX...txt Files,arrays,MC Components
I need alittle help...Im trying to apply data from a text file to
an array with in turn will be applied to variables in an MC component
on the stage.
for example my text file:
e1=one,two,three,four
e2=five,six,seven,eight
e3=nine,ten,eleven,twelve
I want to be able to make an array for each variable in the text file,
duplicate a MC component on the stage for each array, and set the
variables in the component to the variables in the array
(basically the array values go to the dynamic text fields in the MC component)
I'm sure this is possible I'm just stuck, I think I need a Loop or nested Loop....or maybe setup an object()? Any help would be much appreciated.
Arrays, External Xml And Flash Components
hi,
I have a few questions concerning arrays, external xml files and flash components. Any help will be really appreciated.
1)Let’s say I have several items (with labels and data) – item_a = 10, item_b = 15, item_c = 25. How to put them in array? How to write this array in Actionsript?
2)How to write this array in XML file and how to load it in Flash?
3)I would like to build a Combo box from the items of my array. I want to show items labels as drop-down list, but use items data as variable. How to write this in Actionscript?
thanks.
Flash 8 Help With Arrays And Movie Clips
i am in dire need of help right now. I have a flash file which shows 4 names next to four radio buttons. When you click the radio button, text will show up next to the person's name. Right now, as soon as you play the movie, all the text automatically shows up. I only want it to come in when you click the radio button. Everything is contained inside a movie clip. This is the actionscript I have on the first frame of the timeline inside the movie clip.
Code:
for (i=1; i<5; i++) {
letterArray = new Array(0, "A", "B", "C", "D", "E", "F");
for (j=1; j<7; j++) {
this["text"+letterArray[j]+i].onEnterFrame = function() {
if (this._alpha<100 && this.fadeReady == true) {
this._alpha += 5;
} else if (this._alpha>=100 && this.foo != true) {
//nextMC = "text"+letterArray[nextMCnum]+i;
//_root.maincontent.contentloader.anim[this.nextMC].fadeReady = true;
trace(":::::nextMC= "+this.nextMC);
this.foo = true;
}
};
this["text"+letterArray[j]+i].nextMC = "text"+letterArray[parseInt(j+1)]+i;
this["text"+letterArray[j]+i]._alpha = 0;
if(j<7){
this["text"+letterArray[j]+i].fadeReady = true;
}
}
}
there are 6 columns of text next to each person's name, which is what the array and the letters are for. Each piece of text is it's own movie clip with an instance name of textA1, textB1, etc until it gets to textF1.
Now the radio buttons are buttons inside their own movie clips and this script is on each button
Code:
on(release){
btn._visible = false;
_parent[movID].fadeReady = true;
_parent[movID2].fadeReady = true;
}
How can i made the text in the array textA1, etc show up only when I click the button? I have been picking apart this code since yesterday and I can't seem to figure it out. Any help will be greatly appreciated.
Passing Arrays Back To Flash
Hi All,
I am currently using PHP to retrieve content from a database dynamically, I have been successfull in generating basic text content and then displaying it in the swf, now I need to pass data back to Flash so that Flash recognises it and puts it in array...
Ive tried passing the data back as:
- stores[0]=bla bla abla&stores[1]=blalblablba
- stores=blablablbla&stores=blablabla
but they dont work...
Is this possible?
Thanks,
Craig
Flash And Arrays Making Me Scream
Hi,
I'm attempting to set up a simple quiz involving a cursor graphic that moves over 9 squares in a 3x3 grid using the arrow keys, say. There are going to be a few of these grids and, on some, the cursor will not be able to move over all the squares.
I was told that dimensional arrays were a useful tool with which to solve the problem of 'how does the cursor know which squares it can go on and which it can't?', so I wrote some code that I thought would work for me. I'm a graphic artist and I tend to bodge code quite a lot, my syntax is often poor as is my structure, but I tend to think 'if it gets the job done, cool!'
I thought this code HAD got the job done. Depending on which button you press, the cursor will move through a 'grid' of three nested arrays, each holding three values. It's difficult to explain, so I've included the flash if you want to have a look, as well as posting the code. As the cursor is moved it saves it's progress in a variable (currentPos) so that if it moves onto a square that it shouldn't it will reset itself to the last place where all was OK.
Flash is doing something that is inexplicable to me, however. When they get the answer wrong, everything's cool and it sends back the correct variables for the position of the imaginary cursor..........and then changes one of the two variables (XPoint or YPoint)!!!!!! It just changes it and I can't work out why - nor are any other functions, commands etc run afterwards.
I set up an onEnterFrame test to catch it doing it, and now I don't know of anything to do to solve it. It's crazy. Sure I could start from scratch using some other method, but I hate it when this sort of thing happens, I want to know what I've done wrong!!!! All takers appreciated.
Please try downloading the attachment if poss - you will see exactly what is happening.
Cheers
Caff
PS:- I've stripped out certain things from the code to make things easier for anyone looking at it, but fragments of some things might remain.....
ActionScript Code:
function testAgain() {
//runs a test to see when it changes it back
trace("start Test");
thisTimer = 0;
this.onEnterFrame = function() {
thisTimer++;
trace("xPoint= "+xPoint);
trace("yPoint= "+yPoint);
trace("currentPos "+currentPos);
trace("endPos "+endPos);
if (thisTimer>=3) {
delete this.onEnterFrame;
trace("test end");
}
};
}
//variables
//
//
//
//
//the grid Array eachmovies
grid = Array();
grid.row1 = Array('', 0, 1, 1);
grid.row2 = Array('', 0, 1, 0);
grid.row3 = Array('', 1, 1, 1);
yOrig = 2;
yPoint = yOrig;
//yPoint being either row1, row2, or row3
xOrig = 2;
xPoint = xOrig;
//xPoint being the []pos of row1, row2, or row3
currentPos = grid["row"+yPoint][xPoint];
trace(currentPos);
//
//
//button functions on remote - moves the square and checks answer
//
//
//
function checkArrayGrid(yPoint, xPoint, whichDirection) {
endPos = grid["row"+yPoint][xPoint];
trace(endPos);
if (endPos != 1) {
endPos = currentPos;
xPoint = xOrig;
yPoint = yOrig;
trace("can't");
trace("xPoint= "+xPoint);
trace("yPoint= "+yPoint);
trace("currentPos "+currentPos);
trace("endPos "+endPos);
testAgain();
} else {
currentPos = endPos;
xOrig = xPoint;
yOrig = yPoint;
trace("can");
trace("xPoint= "+xPoint);
trace("yPoint= "+yPoint);
trace("currentPos "+currentPos);
trace("endPos "+endPos);
testAgain();
}
}
function buttonPress(whichButton) {
switch (whichButton) {
case "button_left" :
xPoint--;
yPoint = yPoint;
checkArrayGrid(yPoint, xPoint, "left");
break;
case "button_right" :
xPoint++;
yPoint = yPoint;
checkArrayGrid(yPoint, xPoint, "right");
break;
case "button_up" :
yPoint--;
xPoint = xPoint;
checkArrayGrid(yPoint, xPoint, "up");
break;
case "button_down" :
yPoint++;
xPoint = xPoint;
checkArrayGrid(yPoint, xPoint, "down");
break;
case "button_ok" :
checkAnswer();
break;
case "button_tvdrive" :
if (firstTimeClick != true) {
firstTimeClick = true;
startQuiz();
} else {
checkAnswer();
break;
}
}
}
//
//
//
//
//
Arrays Not Working In Flash Lite
I could not get a multidimensional array to work in flash lite, then tried a regular array - it is not working either.
This code works:
var myVar;
myVar = 5;
answer_true_button_btn.onPress = function() {
points_txt.text = String( myVar );
};
This code does not work:
var myVar:Array = new Array(5);
myVar[0] = 5;
answer_true_button_btn.onPress = function() {
points_txt.text = String( myVar[0] );
};
Now do multidimensional arrays.
I have tried in Flash Lite 2 and 2.1.
Flash Arrays, Button.Enabled
Gonna try my best to explain.....
I have an array..
var menuNames:Array = ["", "Nav01","Nav02","Nav03","Nav04","Nav05","Nav06","N av07","Nav08","Nav09"];
I have the same amount of movie clips on the stage, these reference the array one way or another to create mouseover effects (off,on,down).... This is working fine...
Now, what I would like to do is disable the button that has been clicked, and at the same time, enable the rest of the buttons......
So, if Nav05 had been clicked, that would become inactive, and the rest of the buttons in the array would become active......
Im trying to achieve a fourth state for the buttons, whereby when one is clicked it will show a different color........
Probably simple stuff..... but im pulling me teeth out here....
Thanks in advance
ICC
Loading External Arrays Into Flash 8
I am currently working on a tile based videogame and am using arrays to stroe what tile goes where, hewever these get to be really big so I want to save them in a text file and load them as needed, and I have tried the following code:
varReceiver = new LoadVars();
varReceiver.load("external.txt");
varReceiver.onLoad = function() {
trace(typeof (this.myArray)); // string
this.myArray = this.myArray.split("|");
trace(typeof (this.myArray)); // object
trace(this.myArray.length); // 4
};
However, everytime I run this, it says:
Error opening URL "file:///C|/Documents%20and%20Setting...p/external.txt"
Any thoughts on what I can do to get it to open the file told?
My other question is what would the code look like the split it into an array readable by flash like myMap = [[1,1,1],
[0,1,2]]; for example.
Thanks in advance for your help.
Creating Multidimensional Arrays In Flash
Hi
this is just a simple question about the creation of multidimensional arrays in Flash
Is a loop the only solution to create such arrays in flash?
Let's say I want to create a 2 dimensional array with 10 raws in it, something like
Code:
myArray[0]['foo'] = 'AAAAA';
myArray[1]['foo'] = 'BBBBBB';
...
then I have to do:
Code:
var k;
for(k=0;k<10;k++){
myArray[k] = new Array();
}
But what happens if I need 20 rows in the future, instead of 10? Does that mean I'll have to update the loop count each time I want to add a new element?
Is there any simpler way to deal with multidimensional arrays in flash? I guess not but I just wanted to be sure
thanks
|