Flash :: Pass Arrays From It To PHP?
May 20, 2011I am having a problem passing an array variable from Flash (AS2) to PHP. In action script I have several arrays defined like this[code]...
View 3 RepliesI am having a problem passing an array variable from Flash (AS2) to PHP. In action script I have several arrays defined like this[code]...
View 3 RepliesI try pass my Arry to Class. I try to pass it and it look like this: Frame 32 earlier are some animations.
[Code]...
What i'm trying to do is creating an array of objects, little squares that are positioned in a grid with coordinates and when i click on the coordinates i need to select only the elements which fit with the value. So, what i'm trying to do now is to pass a value to each element of the array but it doesn't work:
[Code]...
I do not understand how to pass an array to PHP! I have a number of multidimensional arrays that I would like to pass over.
Example:
array1 -
character[0][0] = "dog";
character[0][1] = "cat";
character[1][0] = "dog";
character[1][1] = "frog";
I'm trying to pass an array of X arrays as parameters to a function such as :
var someArray = [0, 1, 2];
var someOtherArray = [A,B,C];
array = [someArray, someOtherArray,...];
myMC.someFunction(array);
The problem is that the function doesn't see where the 1st array stops, it's like passing a big array such as
myMC.someFunction(someArray,SomeOtherArray, ...) becomes
myMC.someFunction(0,1,2,A,B,C) instead of myMC.someFunction([0,1,2],[A,B,C]);
I even tried to make a string such as str += "[array[0]]"+","+"[array[1]] ..but it still passes everything as one big array....how to pass X arrays to a function??
I am running into some trouble adding an array into another array to create a multi-dimensional array.The code appears as below:
var slideDataArray:Array = new Array();
var slideShowDataArray:Array = new Array();
slideDataArray[0] = xmlData.SlideShowParameters.SlideShowImagesDirectory;[code]........
I am looking for a means of placing the slideDataArray into a 'slot' or value of slideShowDataArray so that I can in the end pass the slideShowDataArray as a parameter to another function.As of now, the last slideDataArray appears 11 times (the loop runs 11 times) in slideShowDataArray and the way the code is written the slideDataArray is unique every iteration of the loop.
I've got a bit that loads a big chunk of xml data about products.I push product info into an array(e.g. productArray), then add that array to another array (e.g. allProductsArray)How do I sort those arrays? For instance, if I want to sort the allProductsArray based on the info in productArray[0]?Alternatively, would something other tha an array of arrays be a better route?This loader loads the same sort of info for many different clients, so the bit to sort on will change.
View 5 RepliesI'm trying to write a function where I can specify any amount of array, and the return value will be an array containing the contents of all of the specified arrays.I've done this, but it seems like a really slow and ugly way of doing it:
var ar1:Array = [1,2,3,4,5,6,7,8,9];
var ar2:Array = ['a','b','c','d','e','f','g','h'];
function merge(...multi):Array[code].....
Is there an inbuilt and more efficient / nice way of achieving this? The result does not need to be in the same order as the input - completely unsorted is fine.
A little explanation: Im making a random arranging number Array. So instead of using a loop and assigning 0 to first array element, 1 to second, etc.I need to make it totally random but without repeating any numbers. To do that I made a second Array that will have the same number of children to serve as a reference.Each of them will be an Object with a property "num" , wich will be its actual number, and a property "called" wich defaults to false.Like this:
ActionScript Code:
for(var i:int=0;i<vQuantity;i++){
ranArray.push( new Object() );
[code].......
I've had a problem for awhile that was really odd. After some intense debugging, I realized the problem lied in setting an array equal to another array.[code] When setting one array equal to another, the values aren't copied over, but a reference to that memory is stored. So no matter which variable you change, they are both references to the same memory and thus both will reflect the changes.With other data types, this doesn't happen.I could fix it by looping through t1 and using push() to add each index from t1 into t2, but that seems a little messy.
View 7 Repliescorrect syntax for pushing variables to arrays within arrays? I have searched many threads but found nothing that exactly answers my query.I have a class (Brigade) which amongst other variables contains an array (BrigadeUnits) This is the third element.. My Brigades are stored in an array called AllBrigades. I now need to fill the BrigadeUnits array with objects of my Units class.The hierarchy I want to create is as follows:
AllBrigades (array of Brigades)
Brigade (object)
BrigadeUnits (array within Brigade object)
Unit (Object to be stored in BrigadeUnits array)
I have tried various approaches including the following, assuming that I am addressing the first Brigade in the array:
AllBrigades [0] [2].push (MyUnit);
But when I trace this I just get undefined.
I'm having to pass data (originally read via an XML file loaded by the parent class) to a child class upon instantiation, and I can't decide which is the better method.I could parse the XML in the parent and throw the data into an Object and pass that object to the child class....or just pass the part it needs as an XMLList and let the child class do the parsing.Seems like a trivial decision, yes, but I'm not sure of longer-term implications.
View 3 RepliesTrying to pass a variable as well and cant seem to escape to pass it. How can I pass using window.open as such: Trying to pass (pid) all i get back is (pid) and not actual pid.How to on a jscommand?
Code:
something.onRelease = function () {
var jscommand:String = "window.open('http://www.someform.php?proj= + (pid)','win','height=200,width=300,toolbar=no,scrollbars=yes');"; getURL("javascript:" + jscommand + " void(0);"); }
I can do a standard getUrl("http://www.someform.php?proj=" + (pid), "_blank"); works fine but no control over window properties.
I'm trying to figure out how to work with arrays in OOP AS3.0. This is what I've got:
[Code]...
everything breaks down. How should I get the value of myArray into the main Class file (Gallery.as)?
how to send the whole array from php to flash using loadvariables? Well... i can send string and then use "split" to put variables into the array but is there any way to do it directly?
View 1 RepliesOverview of Issue: A person will enter up to 8 words. Each word is then stored in a dynamically generated text box (responseTextArray[i]) within a dynamically generated movie clip (responseBubbleArray[i]). From here they will drag the bubbles into positions on the stage. Finally all of this information is to be stored in a database. To identify each entry, I put them into arrays. How can I pass all these arrays to a PHP script,so that I can store them in a MySQL database? Or, is there a better way to accomplish what I have described? The plan is to have each user entry and its attributes (response time, response text, x position of bubble, y position of bubble) stored as a row in the database.
View 2 RepliesI was wondering if it was possible to create an array of classes in Flash. Is it possible to do like in C++ where you can do the following?
CDog dog[100];
for ( int i = 0; i < 100; i++ ) {
dog[i] = new Dog();
[code].....
I need to compare two arrays to see if they are identical.
var _array1:Array = new Array();
var _array2:Array = new Array();
_array1.push(1,2,3,4,5);
[Code]....
Basically what I'm looking to do is hitTest bullets inside an array (spawn via addChild -> pushed into an array) with another array containing ships (spawn via addChild -> pushed into an array as well).At the moment I have:
function moveEnemyLarge():void{
var target2:EnemyLarge;
for(var i2:int=0;i2<enemyShipArray.length;i2++){
[code]....
.. and a near identical function for the bullets (using variables: i, target).What is the easiest way for me to hitTest the objects within my bullet array with the objects in my ship array. Putting "target" in the PLACEHOLDER slot doesn't work, and from what I've seen some people will shove the one for() inside of the other.
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 viaCode: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.
View 4 RepliesI finally decided to start learning about arrays in AS3 and i could use a I learned how to create an array and add references to movie clips in the library, next thing i want to learn is how i can add multiple instances of one movie clip to the stage without having to name each one and do the addChild thing.
View 5 RepliesI'm having a new problem today- referring to arrays with getDefinitionByName. Anyways, in my map editor, I will have two layers of objects, and the user is responsible for choosing which layer of the map to write to. Because of this, I won't know the exact name of the array to write to until I piece together the string "map0Layer" and selectedLayer (chosen by the user):
Code:
var targetString: String = "map0Layer"+selectedLayer;
var mapTarget = getDefinitionByName(targetString) as Array;
trace(mapTarget);
Through this, I'd like to refer to an array, but every variation of the above code I've tried resulted in
ReferenceError: Error #1065: Variable map0Layer1 is not defined.
(This is subject to change because it could be "map0Layer2" as well, but you get the idea.)
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 figure out that the data has actually been received 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. How to be able to use arrays to transfer data.
I loop through two arrays and im checking their data, i have collison working for them but I want to add more A.I. by making them stop when they are a certain distance from each other. so i need a way to pull EACH object that is in the arrays x,y, pos and use that data. my distance var keep bouncing all over the place...
THIS is my code:
//check events between 2 objects
function CheckEventsEnemyFighterFighter():void
{
[Code]....
P.S. i need some tips for my coding... like should have i used a break in these for loops?
So basically I have this map. On this map I have points, and when you click on these points it goes to a URL.The code setup is as follows:
Arrays to define the movieclip locations and another for the urls (this one is an associative array). I then create a function loop to make an event listener for each point. When the point is clicked it will run another function that handles the URLs. The URL function is to grab the target point that has been click, use the url array type to find the key, and then throw it in to the URLRequest.
So far I have this code:
var places:Array = new Array();
places = [
map.paulsens, map.paraburdoo, map.plutonic, map.wiluna, map.gwalia, map.wallaby,
map.sunrise, map.moora, map.marvel, map.flyingFox, map.ernest, map.rosebery,
[code]....
So it's obvious to me that the openLink(); function isn't doing what I want it to. I can kind of guess because event.target isn't being turned in to a string or not pulling the array's type?
How can I animate and form rows together?One 'for loop' is for animation, the other 'for loop' is for making rows. I want to understand how to use arrays and create a row of sprite animations. I understand how to loop through an Array and create a Sprite for each index of the Array, but I'm having trouble putting my animation in rows.I got my number animation to play in a single row. When I add the loop to multiply it across the stage, it just blinks while continuing to animate.'for loop' for animation.[code]
View 1 RepliesThe help page on the BindUtils.bindProperty function:url...Has this to say:"For example, to bind the property host.a.b.c, call the method as: bindProperty(host, ["a","b","c"], ...)." But what if I need to bind to host.a.b[2].c? How do I do that?
View 2 RepliesHow do I change the values of arrays from different classes? i've array in one class called creation all the array are global variable
[Code]...
I have Flash var array that I want to swap for another array on mouse click. It currently loads the initial array into the empty MC perfectly. Now I need it to swap to var productTxt2 when the user presses buttonMC. My code is below.
AS2 code:
var productTxt1 = new Array(
"Product Name 1", "Price 1", "Headline 1", "Copy 1");
var productTxt2 = new Array(
"Product Name 2", "Price 2", "Headline 2", "Copy 2");
_root.createEmptyMovieClip("productInfoMC", 0);
[Code] .....
I have an array of movie clips (representing band members) which have various properties, among them them a property which tells where the band member went to after they left their current band. For those who formed a new group, I want to create an array. Within that array, I want to group all the ones that left for the same group into secondary arrays. So, if you had five band members and 2 of them left for group X and 3 left for group Y. What's the best way to do this? This is, roughly, my code:
[Code]...
Alternatively I suppose if I could do without a multidimensional array and just loop through all the members and say - for those members whose group is the same, perform this function, with the name of that same group passed as the parameter for the function. I guess the trouble I'm having is identifying who's the same.