Arrays And Variables
i have an array done with multiple variables taken from a for instruction. How can i export each array´s element to use it in ASP?
For example like it would be:
for (i=0,miArray.length, i++)
myArray[i]=variable + i
More or less.
FlashKit > Flash Help > Flash ActionScript
Posted on: 07-12-2002, 08:11 PM
View Complete Forum Thread with Replies
Sponsored Links:
- Virtual Student Yrbook: Variables>Arrays>Variables? SOMEBODY RESCUE ME
- RE; Arrays, Variables And The Like.....
- Arrays And Variables Please
- Variables In ARRAYS
- Arrays And Variables?
- Variables & Arrays
- Variables Looking At Arrays
- Arrays As Variables
- Arrays And Variables
- Arrays As Variables?
- Variables And Arrays
- Targeting MC Variables With Arrays
- Urgent Arrays And Variables
- Urgent Arrays And Variables
- Arrays Loops And Variables
- Placing Variables In Arrays
- Making Arrays Into Variables
- Variables And Arrays? I'm Really Stuck
- Arrays, Variables...and Learning The Right Way
- [F8] Problem With Arrays And Variables
- [CS3] Variables And Arrays In A Function...
- Help With XML Variables -- Arrays, Functions, Etc
- Help With XML Variables -- Arrays, Functions, Etc
- Problems With Arrays And Variables
- [AS2] Variables And Arrays (cry For Skype Help)
- For Loop Variables/arrays
- Help With XML Variables -- Arrays, Functions, Etc
- Using Variables Inside Arrays.
- Loop, Arrays And Variables
- Variables / Arrays / Menu - HELP
- Arrays, Variables And POST Problem
- Arrays, Variables And The Hidden Movieclip..
- Looping Arrays & Variables In Same Frame
- New To Arrays... And Variables... And Dynamic Text LOL
- FLASH JEDI's Please Help Me (arrays & Variables)
- HELP Trying To Make Regular Variables = Arrays?
- Multi Arrays And Variables To Text
- Loading Variables With Arrays (or Smth Like That)
- Xch And Dynamic Variables Holding Arrays
- Load External Variables Into Arrays
- Increment Variables To Create New Arrays
- Problem Comparing Arrays With Variables
- Objects As Associative Arrays And Variables
- Accessing Arrays Of Existing Variables
- Is It Posibble Question Of The Day:Variables And Arrays
- Is It Posibble Question Of The Day:Variables And Arrays
- Sorting Arrays From External Variables
- Variables/arrays Assigned As Instance Names?
- Loading Multiple Variables In Arrays From Extern
- Passing Array Variables Into Functions (and Why I'm Hopeless At Arrays)
- Shared Object Arrays - More Efficient Than Calling Several Data.variables?
Virtual Student Yrbook: Variables>Arrays>Variables? SOMEBODY RESCUE ME
Hello, All.
I am totally stumped. I am creating a student virtual yearbook, which displays students names with pictures. I cant find a totally understandable tutorial that teaches me how to extract variables from an array. So I created an asp file that writes out all of the student records to different variable names, and load them using loadvariablesnum(). Using this ASP file works, but once I click the exit button to take me back to the front page, it is as if all of my other variables are erased.
I dont completely understand levels when it comes to loading variables, so everything is loaded like this
loadVariablesNum("http://10.0.1.2/tp/tpod/processGet_studentInfo.asp", 0, "GET"); --- "POST" gives me the same results...
To view the pictures you would click a button on SCENE 4, and it takes you to "VIEW STUDENTS PICTURES" - SCENE 11. 'EXIT' sends you back up to Scene 4, which runs an ASP file which simply grabs a message that is updated every 30 minutes. What Level would I use here??? I have tried many.
Everything works beautifully until I exit the VIEW STUDENTS PICTURES page from Scene11
I've written a pretty sizeable file that uses lots of variables.
I am pretty sure that the problem is with the ASP file: "processGet_studentInfo.asp" - because when I comment it out, the application works fine.
::::::::::::SUPPORTING INFO BELOW:::::::::::::::
Here are the variables that "processGet_studentInfo.asp" creates:
&varStudent1=Crystal&varImagePath1=http%3A%2F%2F10 %2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FCrystal%2Ej pg&varStudent2=Brandy&varImagePath2=http%3A%2F%2F1 0%2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FBrandy%2Ej pg&varStudent3=Angel&varImagePath3=http%3A%2F%2F10 %2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FAngel%2Ejpg &varStudent4=Cathy&varImagePath4=http%3A%2F%2F10%2 E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FCathy%2Ejpg&v arStudent5=Destiny&varImagePath5=http%3A%2F%2F10%2 E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FDestiny%2Ejpg &varStudent6=Amber&varImagePath6=http%3A%2F%2F10%2 E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FAmber%2Ejpg&v arStudent7=lester&varImagePath7=http%3A%2F%2F10%2E 0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2Flester%2Ejpg&v arStudent8=paul&varImagePath8=http%3A%2F%2F10%2E0% 2E1%2E2%2Ftp%2Ftschool%2Fimages%2Fpaul%2Ejpg&varSt udent9=Ginger&varImagePath9=http%3A%2F%2F10%2E0%2E 1%2E2%2Ftp%2Ftschool%2Fimages%2FGinger%2Ejpg&varSt udent10=Brittany&varImagePath10=http%3A%2F%2F10%2E 0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FBrittany%2Ejpg &varStudent11=chad&varImagePath11=http%3A%2F%2F10% 2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2Fchad%2Ejpg&v arStudent12=jaden&varImagePath12=http%3A%2F%2F10%2 E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2Fjaden%2Ejpg&v arStudent13=Jami+Lynn&varImagePath13=http%3A%2F%2F 10%2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FJami+Lynn %2Ejpg&varStudent14=kara&varImagePath14=http%3A%2F %2F10%2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2Fkara%2 Ejpg&varStudent15=Cody&varImagePath15=http%3A%2F%2 F10%2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FCody%2Ej pg&varStudent16=darla&varImagePath16=http%3A%2F%2F 10%2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2Fdarla%2Ej pg&varStudent17=Jenna&varImagePath17=http%3A%2F%2F 10%2E0%2E1%2E2%2Ftp%2Ftschool%2Fimages%2FJenna%2Ej pg&varStudentCount=17&varENDER=1
-----------------------------------------------------------
Here is the meat & potatoes of the ASP file that created this:
oRS.Open "SELECT * FROM STUDENTS", oConn, 2, 3
' Move to the first record
oRS.MoveFirst
'Loop to output all the query results to the document
do while not oRS.eof
' counter to give each record a sequential listing
counter=counter+1
Response.Write "&varstudentname" & counter & "=" & Server.URLEncode(oRS("studentname"))& "&varImagePath"& counter & "=" & Server.URLEncode(oRS("ImagePath"))
' move to the next record
oRS.movenext
loop
'LET FLASH KNOW THAT WE ARE DONE RETRIEVING
Response.Write "&varStudentCount=" & counter
Response.Write "&varENDER=finished"
:::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::
Please help.
View Replies !
View Related
RE; Arrays, Variables And The Like.....
okay,okay.... i think i need to tell you more...
i have 12 blocks, each with an instance name, block01 to block12.
these blocks are all movieclips which hold buttons.
within the movieclip part of them they hold a script which makes them move. eg:
onClipEvent (load) {
this._x = 94;
endPosx = 207.1;
movex = 0;
this._y = 63;
endPosy = 216.0;
movex = 0;
}
onClipEvent (enterFrame) {
movex += (endPosx-this._x)/50;
movex *= 0.82;
this._x += movex;
movey += (endPosy-this._y)/50;
movey *= 0.82;
this._y += movey;
}
within the button part of them they hold this...
on (press){
this._y = currentposy;
endPosy = 198.9;
movey = 0;
currentposy = _y
this._x = currentposx;
endPosx = 76.0
movex = 0;
currentposx = _x
movey += (endPosy - this._y)/32;
movey *= 0.85;this._y += movey;
movex += (endPosx-this._x)/32;
movex *= 0.85;this._x += movex;
stopAllSounds ();
loadMovie ("onestate.swf", "_level1");
}
of course each block has its own postion on the stage so the number above differ from block to block.
what i want to do is that when one of the blocks moves to its position (when the user clicks it) for any block no matter which one, that is in its destination position to be moved back to its correct starting place.
its kinda like a big record juke box, when you select one it replaces the one that is already there and the finished one goes back to its place... does this make more sense
any one who can help would be an absolute star...!!
View Replies !
View Related
Arrays And Variables Please
Hi,
I am in the middle of learning Gaming using Flash 5. So far i have been doing not to bad. My only frustrating problem is that i dont know how to set games up so that there are congratulation screens, and well done items etc when the user has succesfully completed the game. Obviously having these would give the games a purpose rather than just being neverending animations.
I already have a game online that i have been playing about with which can be viewed at:
http://www.gcal.ac.uk/bta/games/sliding_game/game.swf
What i would like to do is, when the image is complete and the squares are all in the correct place, the movie will either go to a frame, a scene or whatever to say well done, or congratulations.
i would assume that it would be done using some sort of if/then statment i.e if square 1 is there, and square to is there, and square 3 is there, then goto frame2.
However, i have been told i need variables and arrays. This is where i get stuck. Can someone please explain to me, in a way that a 2 year old would understand, how i would go about acheiving my congrats thing, using variables and arrays. And also explain why it is done that way if possible.
I hope you can help
Many thanks
spiderman
View Replies !
View Related
Variables In ARRAYS
having a problem with variables in an array.
lets say you have:
var1 = "whatever"
myArray = new Array (var1);
is there a way later to have var 1 change.
everytime i re-assign var1 - the array doesn't get updated. is ther something i'm mssing?
thanks
View Replies !
View Related
Arrays And Variables?
I hope some one can look at this .fla and help me out here, I think this is a problem with my understanding of arrays
As you will see, the sections are defined by an array, so the headings are also based on this....What I would now like to do is to add content to each of the sections....I am rather new to arrays, but I do understand most actionscript (btw this is FlashMX)
I assume that what I need to do is to create a dynamic text field in section_mc with a variable name such as "myContent" (in the same way as "mySection") and then assign a value to it...this is the bit I am stuck on. I need it to call up a text file or something similar, but it has to know what section it refers to
I hope this makes sense, Hopefully, the fla is a bit clearer
JennyJ
View Replies !
View Related
Variables Looking At Arrays
I have this bit of code which works great. It's basically looking at my array and placing the correct number of buttons. The problem is, I need it to place one button for every 5 items in the array. So say there were 15 items in the array, only 3 buttons would be placed, etc. I can't figure out how to do that.
Code:
for (h=1; h<=products.length; h++) {
_root.attachMovie("BtnMC", "Btn"+h, h+1000);
eval("Btn"+h).noText = h;
with (eval("Btn"+h)) {
_x = h*20-10;
_y = 240;
View Replies !
View Related
Arrays As Variables
I want a variable that is changed by an array.
Here is what I put in the first actions frame on the main timeline:
spin = 10;
This is put into a MC to rotate it:
onClipEvent(enterFrame){
this._rotation +=_root.spin;
}
This works. Now I want an array to control the variable spin. Such as
spinArray = new Array(0, 0, 1, 32, 64, 51, 33, 32, 36);
How do I get spinArray to act as the variable spin? I am using flash MX
View Replies !
View Related
Arrays And Variables
i have created a number of variables and arrays in my flash movie
drink="sodas";
food="lunch";
sodas = new Array("Coke","Sprite","Pepsi",...);
juices = new Array("Apple Juice","Orange Juice",...);
water = new Array("Tab Water","Bottled Water",...);
by using a number of on-release commands i have the variables drink and food changed.
later on when i want to display in a dynamic text field (display), the third item [2] in the drinks array by referring to the current variable drink, i am unsuccessful. i have tried the following lines:
display =drink[2];
or
display=Array("drink"+"[2]");
or
display="drink"+"[2]"
i think the problems lies in the fact that it reads the current value for the variable "drink" and concatenates it with "[2]" instead of displaying the proper array[2].
does it make sense? please help. any advice is appreciated.
thank you.
View Replies !
View Related
Arrays As Variables?
hi guys, so i have question
why cant the variable "height" modify the position of y? =S im new at ac so i dont know if an element of an array can be a variable? and how do i make it a variable?
this is a par of the code im writing to make a group of movieclips appear offstage in a random positions as long as it is offstage (i know the array is not random since i give the values of each element but i tried by putting y= math.random * number?... but in the coordinates i didnt knew how to specify that it could be any random number exept the lenght of the stage)
onClipEvent (load) {
myArray = new Array ();
myArray[0]=-100;
myArray[1]= 0;
myArray[2]=100;
myArray[3]=200;
myArray[4]=300;
variable= Math.random () * 4;
myArray2= myArray.slice (variable,variable+1);
Height = myArray2
trace (Height)
trace (this._y)
this._x = 200;
this._y = Height;
}
i really apreciate any help u guys can give me
peace out
View Replies !
View Related
Variables And Arrays
Another array question for everyone.
Let's say I have a student database. Each student has characterists, ie., Name, Age, and Hometown.
I have an overall array on my page that I want to process whatever student info that comes in. Whichever student is chosen (chosenStudent) will be set to a specific variable matching that student, i.e. , student_24, or student_23, or student_22, etc...
display= [[chosenStudent]_Name, [chosenStudent]_Age, [chosenStudent]_Hometown];
Eventually each part of this array points to a texfield that will display the
information.
My question is, whats the best way to format the data that I want sent into the array. I know one way is this:
student_24 = ["Bob"];
student_24= ["22"];
student_24= ["Springfield"];
student_23 = ["Lucy"]
student_23 = ["35"]
student_23 = ["Springfield"];
Is what I'm doing possible, and efficient?
Hope this isn't confusing, I'm a little confused myself.
thanks for the help everyone.
View Replies !
View Related
Targeting MC Variables With Arrays
Hi all,
I need some help targeting movie clip variables. I have a MC called "toolbar" and inside of that a script on the first frame that duplicates a movie clip. Inside that MC which is duplicated is a text field called "mcname".
Hence, the heirarchy is like this:
Code:
_root
toolbar
duplicated movie clip (toggle_bashful)
So I can change that variable like this:
Code:
toggle_bashful.mcname = "something";
The problem comes when I include it in a loop. The variable called "MC" grabs a value from an array. When i test it like this it returns the right value (in this case for the first item in the array it returns "toggle_bashful"):
Code:
trace (mc);
Yet it simply will not work when I do this:
Code:
mc.mcname = "something";
In theory, this should be the exact same thing as the first code block.
Help!
View Replies !
View Related
Arrays Loops And Variables
Hi - I am currently building a dynamically updating animated graphic, using a data file. The contents of the file are loaded into nested arrays e.g.
myArray = new Array();
myArray = [[hol_offer1, hol_date1, hol_price1, hol_company1, hol_url1],
[hol_offer2, hol_date2, hol_price2, hol_company2, hol_url2],
[hol_offer3, hol_date3, hol_price3, hol_company3, hol_url3],
[hol_offer4, hol_date4, hol_price4, hol_company4, hol_url4],
[hol_offer5, hol_date5, hol_price5, hol_company5, hol_url5],
[hol_offer6, hol_date6, hol_price6, hol_company6, hol_url6],
[hol_offer7, hol_date7, hol_price7, hol_company7, hol_url7],
[hol_offer8, hol_date8, hol_price8, hol_company8, hol_url8],
[hol_offer9, hol_date9, hol_price9, hol_company9, hol_url9],
[hol_offer10, hol_date10, hol_price10, hol_company10, hol_url10]];
I want to call each group of five variables on a looping basis starting with myArray[0][1]. so I need to change the first index going from 0-9. Does anyone have any idea how I can make this loop because I have been unable to get anything to work correct.
Thanks
View Replies !
View Related
Placing Variables In Arrays
Hi, Im trying to put variables into arrays, but I can't make it work.
Here's the code Im using, can anyone help me?
var count = 3
var dayArray = new Array(count);
var day1, day2, day3;
day1 = "2";
day2 = "3";
day3 = "4";
for(j=0; j < dayArray.length; j++)
{
I tried all these, but didn't work
dayArray[j] = day add j; <<---try #1
dayArray[j] = "day"+j; <<--try #2
dayArray[j] = day + j; <<--try #3
days.addItem(dayArray[j]);
}
}
Im just trying to make the combobox label display 2, 3, 4. I need the program written this way for a certain purpose, so please do not give a whole different kind of script, this would do fine, only if I can make it work, Thanx a miilion!
View Replies !
View Related
Making Arrays Into Variables
ok.... took ou the other code so its easier to digest...
----------------------------------
ACOUNT = 3;
for (i=1; i<>ACOUNT+1; i++)
{eval("gennum"+i) = myarray[i]};
----------------------------------
basically what I want to happen is
to make
gennum1 = myarray[1],
gennum2 = myarray[2],
gennum3 = myarray[3], etc....
but the eval statement is giving me an error.... shouldn't this work?
View Replies !
View Related
Variables And Arrays? I'm Really Stuck
hello all, i'm really stuck on how to do something... I have all this data which has been fed into an array (fine) but what i need to do is assign each item in the array to a variable, i tried toing this using a loop, now because there is gonna be anywhere between 5 and 15 types of a certain item, i need the variables to be unique; what i tried was looping through and using the loop counter as the number which will form part of the array, but i couldn't work it out!!! does anybody have any suggestions, comments or just any help at all really! Source available.
thanks
x
View Replies !
View Related
Arrays, Variables...and Learning The Right Way
To date when I author a site with multiple sections I start with a shell movie the load movies into containers for each section. I use variables on the main timeline to determine if lets say the mc contact_form.swf is running. What ends up happening is that when I launch a section, the onRelease runs through a set of conditionals to determine what's running, and if it's "running", it sends that movie to a park frame....it works....easy enough.
In getting deeper into actionscript (and wanting my code to be streamlined and clean), i thought that rather than run through all those conditionals on each onRelease, wouldn't it be better if I used a function whatsLoaded() that would load instance names of the mc containers that were running.
Code:
function whatsRunning(){
runningArray = new Array();
if (_root.movie1 == "LOADED"){
runningArray.push("movie1");
}
if (_root.movie 2 == "RUNNING"){
runningArray.push("movie2");
}.....and so on.
Populating the array with the instance names was easy and work as I trace the result (below). But next I wanted to create another line that runs a for loop through the array and sends each open mc to a park frame....I've got the script started, but am stuck...
Code:
_root.nav.contact.Button.onRelease = function() {
whatsRunning();
for (i=0; i < runningArray.length; i++){
//trace(runningArray[i]);
_root.runningArray[i].gotoAndPlay("fade_out");
}
it's that last line that I know is wrong...I've looked in all my books, etc...first to try and figure it out, but can't. I need help. Ideas???
View Replies !
View Related
[F8] Problem With Arrays And Variables
hi, this is a simplified version of my problem; i want to trace adress different arrays through a variable:
var array_0:Array = ["a","b","c"];
var array_1:Array = ["1","2","3"];
var array_2:Array = ["A","B","C"];
$number1 = random(2);
$number2 = random(2);
$instance = "array_" + $number1;
trace($instance[$number2]);
i know why it's not working like i want it to do, but i don't know any other solution...
thanks a lot for your help,
peter
View Replies !
View Related
[CS3] Variables And Arrays In A Function...
totalBannerTextes = mainNode.gallery.element.text.length;
var bannerTextes:Array = Array();
for (i=0;i<=totalBannerTextes-1;i++){
bannerTextes.push(mainNode.text[i].attributes.text);
}
when I want to retrieve bannerTextes from a function:
var setBannerTextes = function () {
for (i=0;i<=totalBannerTextes-1;i++){
banner_mc.createEmptyMovieClip ("bannerText_mc"+i,banner_mc.bg_mc.getDepth()+1 +i)
banner_mc["bannerText_mc"+i].createTextField ("bannerText_txt",1,0,0,0,0)
banner_mc["bannerText_mc"+i].bannerText_txt.text=bannerTextes[i]
banner_mc["bannerText_mc"+i].bannerText_txt.autoSize=true
}
}
It's undefined. The only way it seems to have a _global array...
any suggestion?
thanx
View Replies !
View Related
Help With XML Variables -- Arrays, Functions, Etc
I have been working on a Flash movie that loads variable data from an external XML file and dynamically displays the item names in a menu which may then be clicked to display other dynamically-loaded content that corresponds to the menu item that was clicked.
I have now come to a standstill in the project as there is something I'd like to achieve but simply cannot work out how. This is my first attempt at working with XML in Flash and one of my early attempts at using variables.
What I'm trying to achieve is; once the user has viewed the item's content, they can simply click "next" and "previous" buttons to display all of the content for the next or previous items in the XML document.
I know it probably sounds simple and I'm sure some of you could achieve this in 5 minutes (!) but I can't get my head around some of the coding. I assume previousSibling and nextSibling would come into play here as well as some sort of functions which access arrays of data for the previous and next items, but I'm just not sure how to correctly put these things to use.
Rather than post my code and example images of the stage up here on the forums, I've created an html page here: http://www.basemedia.com.au/hosted/help
Please, if you think you can be of any help, check it out. I would really appreciate it.
Thanks.
View Replies !
View Related
Help With XML Variables -- Arrays, Functions, Etc
I have been working on a Flash movie that loads variable data from an external XML file and dynamically displays the item names in a menu which may then be clicked to display other dynamically-loaded content that corresponds to the menu item that was clicked.
I have now come to a standstill in the project as there is something I'd like to achieve but simply cannot work out how. This is my first attempt at working with XML in Flash and one of my early attempts at using variables.
What I'm trying to achieve is; once the user has viewed the item's content, they can simply click "next" and "previous" buttons to display all of the content for the next or previous items in the XML document.
I know it probably sounds simple and I'm sure some of you could achieve this in 5 minutes (!) but I can't get my head around some of the coding. I assume previousSibling and nextSibling would come into play here as well as some sort of functions which access arrays of data for the previous and next items, but I'm just not sure how to correctly put these things to use.
Rather than post my code and example images of the stage up here on the forums, I've created an html page here: http://www.basemedia.com.au/hosted/help
Please, if you think you can be of any help, check it out. I would really appreciate it.
Thanks.
View Replies !
View Related
Problems With Arrays And Variables
Hello all,
I am having some weirdness with arrays and variables. I'm sure this is something basic but I can't get it to work. I have a an MC name "circle" this also contains dynamic text field name nameMC. Writing to that textfield is simply circle.nameMC.text = "New copy";
So below I have two arrays.
ActionScript Code:
var textArray:Array = [one, two, three];var newArray:Array = ["one", "two", "three"];for (var i:String in newArray) { this.attachMovie("circle", newArray[i], this.getNextHighestDepth(), {_x:Math.random()*300, _y:Math.random()*200}); textArray[i].nameMC.text = newArray[i];}
This doesn't work. I've tried swapping the various arrays but no luck. So why does the movieclip want to use the "quoted" array value and not the unquoted. Also, when I use"
ActionScript Code:
one.nameMC.text = "hello";
everything works fine, but the arrays won't. So:
ActionScript Code:
textArray[i].nameMC.text = "hello";
for example doesn't work.
Thanks for any guidance!
View Replies !
View Related
[AS2] Variables And Arrays (cry For Skype Help)
Hey,
As far as I've gotten with teaching a lot of this stuff to myself... I can't seem to get variables and arrays figured out. I think I've read a dozen basic AS2 tutorials on variables and yes, I see that it's a container for data that can be referenced when needed, and arrays hold and organize variables, but holy hell... something's not clicking. I'm using it in my code, but I just don't fully understand it enough to decide WHEN I need to use them in a project.
Anyway, I'm asking for someone to help... but, not through the forums... but through Skype. I think I need someone to explain it to me through voice, so I can immediately ask any follow up questions. I need to hear it. (Don't ask how that's any different.)
So, if anyone's willing to help though Skype... private message me so we can exchange Skype names. I'm on Eastern Standard Time, available only in the late evenings. If it's on a weekend... I can probably stay up later, if you happen to be in Japan or Australia.
Thanks in advance.
View Replies !
View Related
For Loop Variables/arrays
in a for loop, I want to assign new arrays and possibly their initial value as well.. I can do the values without problem, the array name has turned out to be tricky for me.
Example:
for(i=1;i<10;i++){
myarray[i]=[this.myvariable[i]];
}
with the intent of getting
myarray1=myvariable1;
myarray2=myvariable2;
myarray3=myvariable3;
I know Im missing something, just cant think straight.
View Replies !
View Related
Help With XML Variables -- Arrays, Functions, Etc
I have been working on a Flash movie that loads variable data from an external XML file and dynamically displays the item names in a menu which may then be clicked to display other dynamically-loaded content that corresponds to the menu item that was clicked.
I have now come to a standstill in the project as there is something I'd like to achieve but simply cannot work out how. This is my first attempt at working with XML in Flash and one of my early attempts at using variables.
What I'm trying to achieve is; once the user has viewed the item's content, they can simply click "next" and "previous" buttons to display all of the content for the next or previous items in the XML document.
I know it probably sounds simple and I'm sure some of you could achieve this in 5 minutes (!) but I can't get my head around some of the coding. I assume previousSibling and nextSibling would come into play here as well as some sort of functions which access arrays of data for the previous and next items, but I'm just not sure how to correctly put these things to use.
Rather than post my code and example images of the stage up here on the forums, I've created an html page here: http://www.basemedia.com.au/hosted/help
Please, if you think you can be of any help, check it out. I would really appreciate it.
Thanks.
View Replies !
View Related
Using Variables Inside Arrays.
I am trying to use a variable inside an array... the variable uses numbers which basically varry.... although the variable is what I want I still get
Code:
var testing:Array = new Array();
testing[x50y50] = "working";
one = 50;
two = 50;
varx = "x"+one+"y"+two;
trace(varx);
trace(testing[varx]);
//when i trace varx it = x50y50... but if i trace testing i get undefined...
//i put change to trace(testing[x50y50]) it works just fine...
is there any way to fix this problem? I've been struggling with this similar issue for a long long time... I always work around it somehow but this time its a requirement in my script.
View Replies !
View Related
Loop, Arrays And Variables
Last edited by phlop : 2006-07-10 at 15:34.
Hey there, trying to put some actions on buttons that are being dynamically created in a loop.
It worked fine, until I am trying to use the String.toLowerCase(); function.
The basic of my code is as follows.
The function gets run for each in the loop.
ActionScript Code:
var myString:Array = [];
function myFunction(i){
create new movie clip, move to position,
movieClip[i].onRelease = function(){
myURL = "http://www.blah.com"+variable[i]+".htm";
myString[i] = myURL.toLowerCase();
getURL(myString[i]);
}
delete myURL;
}
Anyone know why this remains undefined?
When I take the toLowerCase out, it works fine...
View Replies !
View Related
Variables / Arrays / Menu - HELP
Hello peops.
I am trying to make a two level menu... not to hard hey.
Well i have to control it all from an external file...
Still easy? - Thats good keep reading caus im about stuck here!
Through 6 text files i have to make the second level buttons. The number of second level buttons displayed also will be customised by the external text file.
Have you got any ideas of how i can do this?
I am more stuck than someone who has licked some ice on a sky slope... or someone who accidently trod in some quick drying cement and had a conversation for an hour... or someone who emptied 8 bottles of superglue on one hand and then pushed a brick wall for a min. Im STUCK! Like the examples?!!! LoL
Id be v v v v v grateful for anything, just anything you can tell me that can help me figure this out. Im v new to actionscript and have never used arrays or duplicate movie clips before. I think i may need this but i dont know. Been looking at tutorials for a long while now but i still dont know how i can implement my project.
Maybe im going about it the wrong way?
Thank youuuuuuuuuuuuuuuuuuuuuuu
View Replies !
View Related
Arrays, Variables And POST Problem
Hello everybody,
I have a problem thats driving me nutsssss
I have created a shop system which is array based.
The products ordered in the shop are passed to the basket array as objects.
BArray = [0,1,2,3]
BArray[0].identity = aIdentity
BArray[0].cost = aCost
BArray[0].quantity = aQuantity
I have a repeat loop which retrieves all shop array items and values correctly, and looks great when in trace mode.
order = order + "Identity_"+(BArray[x].identity)+"Cost_"+(BArray[x].cost)+"Quantity_"+(BArray[x].quantity)
<B>BUT</B> when i send the variables to the cgi script using loadvariablesnum .... ...."POST" (lots of items to send), the Browser and/or the swf has escaped (URLencoded) the BArray contents
My cgi echoes the variables back to the browser so this is how I know.
The strangest thing is that the 'Normal' variables (Text fields) work with the cgi, but are echoed back with a strange URLencoding (for instance a SPACE character is echoed back as + : Alien Joe == Alien+Joe)
View Replies !
View Related
Arrays, Variables And The Hidden Movieclip..
Hello!
Need some help with a movement problem...wait dont leave
just yet, its actually really complex thats why ive had to come to flashkit to ask the best...
right the idea is that i have 3 MC/buttons that each have their own code for where they should be on the stage.
lets say that they are in the following postions
A
B
C
D
"D" is their destination when they are clicked on and "A", "B", "C" are there intial postions. Here comes the hard bit.
lets say the clip on "A" has been clicked and has moved to position "D", all i want to happen is that when one of the other clips is clicked on, the clip on "D" moves back to its original position and is replaced by the clip that has just been clicked!!!!
ive tried several ways, including a movieclip that is empty bar from code that stores the name of the clip that has moved. when there is a mousedown or press event the clip is told to move back to it original position.. this however i cant seem to get to work in practice.
any help that any one could give would be greatly appreciated...
View Replies !
View Related
Looping Arrays & Variables In Same Frame
Hello,
I am editing a multi-column list that is placed into Flash and the variables are loaded from ColdFusion.
Due to the number of items I have, I want to place 10 names on a page and then click a button that will show me the next 10 names and so on.
I have the code so now it only shows 10, but when I click the button the loop seems to start over.
Here is my code:
Frame 1
loadVariablesNum ("variables1.cfm", 0);
i = 0;
screenno = 1;
depth = 0;
pageno=0;
Frame 2
stop ();
_root.next_button._visible = false;
// split up the array by looking for the commas
if (depth < 1) {
Name_array = Name_list.split(",");
Age_array = Age_list.split(",");
// depth
depth = 1;
}
// hide the origional clips
Name._visible = 0;
Age._visible = 0;
// get the length of the array
Name_length = Name_array.length;
Age_length = Age_array.length;
// set the start y position (x position depends on where you put it on the screen)
yposition = 38;
// set i
// looping everything
for (i=i; i<screenno*10; i+1) {
// Name
duplicateMovieClip (Name, "Name" add i, depth);
setProperty ("Name" add i, _y, yposition);
// Name.Name = Name_array[1];
set ("Name" add i add ".info", Name_array[i]);
depth++;
// Age
duplicateMovieClip (Age, "Age" add i, depth);
setProperty ("Age" add i, _y, yposition);
// Age.Age = Age_array[1];
set ("Age" add i add ".info", Age_array[i]);
depth++;
// Set the y position plus 30
yposition = yposition+30;
var i = i+1;
}
if (Name_length>screenno*10) {
_root.next_button._visible = true;
}
Button action
on (release) {
with (_root) {
gotoAndPlay (2);
var screenno=screenno+1;
var pageno=pageno+1;
}
}
View Replies !
View Related
New To Arrays... And Variables... And Dynamic Text LOL
HOwdy it;s me again.
Argh, I have a stupid stupid but very frustrating problem!
I have a dynamic text box called: number.
I have declared number = 0;
I have two buttons. When I press one, I want the number in the text field to go up, when I press another, I want it to go down.
Easy! Got that to work fine!
But-
How do I get it to only cycle thru 0-9... whenever it gets to 9 it of course displays 10, and I have been trying tons of things to get it to STOP
(I tried an array, but then read I can't access an array thru my text box? Is there some step I can do in between??)
I could do the easy way and make the text field a MC instead with 10 frames... a number on each frame... but I want to learn more about variables and such instead. Thanks for any help you can give me!
View Replies !
View Related
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.
View Replies !
View Related
HELP Trying To Make Regular Variables = Arrays?
i = 1;ACOUNT=10;myarray=new Array() ;
while (Number(i)<>ACOUNT+1) {
rnd = random(ACOUNT);
x = 1;
while (Number(x)<>Number((Number(length(Temp))+1))) {
if ((substring(Temp, x, 1)) eq rnd) {
rnd = "";
}
x = Number(x)+1;
}
if (rnd ne "") {
Temp = Temp add rnd;
myarray[i]= rnd;
i = Number(i)+1;
}
};
for (i=1; i<>ACOUNT+1; i++)
{eval("gennum"+i) = myarray[i]};
nextFrame();
this is the code....^^^^
the second to last line gets the error and I don't know how to phrase it.
basically I expect "{eval("gennum"+i) = myarray[i]};"
to make gennum1 = myarray[1], gennum2 = myarray[2],gennum3 = myarray[3], etc....
can anybody help me?
thanks.
-jonathan
View Replies !
View Related
Multi Arrays And Variables To Text
Hey guys-
I have to do a project involving this:
1. I have to have an input text field in which the user enters a baseball player's name.
2. Then a search() function is called that finds the information I have entered (Height, weight, DOB, L or R handed) in an array to the appropriate textboxes.. A photo is also loaded. Why an array? This seems logical.
Seems easy in principle, not so easy in AS. Do I make a seperate array for each stat, or do I...can I make a multidimensional array for each player, and just call playerName[1][2][3] etc.?
This is the code I am thinkin of.
code: playerName.onSetFocus = function() {
playerName.text = "";
};
function search() {
i = 0;
matchFound = 1;
playerName = new Array();
//how to make the array with all the names? Hmm....
for (i; i<playerNames.length; ++i) {
if (matchFound) {
//actions to display all the text in the appropriate boxes.
}
}
}
View Replies !
View Related
Loading Variables With Arrays (or Smth Like That)
Hi there,
I just wondered if u could help me solving a problem. It's a bit hard to explain but i'll try to put it in the easiest way to understand (i hope i'll manage that). Here it goes:
I've created a flash movie that loads an external txt file with different variables (var1, var2...). In the flash movie i've put an input textfield to have some values filled in. All i need, is that, when an user inputs some values into that textfield, actionscript would compare input values with (already loaded) txt-file variables, and rejects if these values are equal.
This is how far i am :
quantity = 2; // quantity of variables
for(i=0; i<quantity; i++) {
array [ i ] = (i + 1);
trace("var" + array[ i ]); // this outputs var1, var 2 in a column
So all i get here, is the names of variables from a txt, but how could I compare the values of input's and txt-file's variables? Any ideas will be appreciated... i still think it's hard to understand all this crap, so if u'd ask i'd try to explain further...
thanx for ur attention!
View Replies !
View Related
Xch And Dynamic Variables Holding Arrays
Okay, I have given up on putting and array within an array. The new thing is I dynamicaly create variables (instead of array eliments) and then keep arrays within them. The problem I'm having is I can't seem to assign an array dynamicaly to the xch object.
Now I tried without dynamic variable names and the only way I could get it to work was to use 'push'. This is what it looks like:
PHP Code:
// Get
trace(xch.myArray[1]); // Returns "Value 2"
// Set
xch.myArray = new Array();
xch.myArray.push( "Value 1" );
xch.myArray.push( "Value 2" );
However when I try this on my dynamic variables it doesn't work:
PHP Code:
// Get
getTargetVar = eval( "myArray"+1 );
trace(xch.getTargetVar[1]); // Returns "undefined"
// Set
setTargetVar = eval( "myArray"+1 );
xch.setTargetVar = new Array();
xch.setTargetVar.push( "Value 1" );
xch.setTargetVar.push( "Value 2" );
I also messed about with using the set() function rather than push, but that didn't seem to work either.
PHP Code:
// Get
getTargetVar = eval( "myArray"+1 );
trace( get( xch.getTargetVar[1] ) ); // Returns "undefined"
// Set
setTargetVar = eval( "myArray"+1 );
set( xch.setTargetVar, new Array() );
set( xch.setTargetVar[0], "Value 1" );
set( xch.setTargetVar[1], "Value 2" );
And I tried this variation:
PHP Code:
// Get
getTargetVar = eval( "myArray"+1 );
trace( get( xch.getTargetVar[1] ) ); // Returns "undefined"
// Set
setTargetVar = eval( "myArray"+1 );
set( xch.setTargetVar, new Array( "value1", "value2" ) );
But nothing seems to be working.
Help!
View Replies !
View Related
Load External Variables Into Arrays
Hi im wanting to load some external variables into some Arrays. Below is my code, I really want my "map,txt" file to have the values for the Arrays, not hard code them as seen in the code. Ive tried things in the .txt like:
myArr_x="200", "220"&myArr_y="40", "70"
...but clearly im missing something.
loadVariables("map.txt", _root);
//I'd like to load external values into the Arrays below
var myArr_x:Array = new Array("200", "220");
var myArr_y:Array = new Array("40", "70");
var myArr_location:Array = new Array("Region Name", "Region Name");
var myArr_dealer_name:Array = new Array("name1", "name2");
var myArr_dealer_region:Array = new Array("Regon1", "Region2");
var myArr_dealer_website:Array = new Array("http://www.site1.co", "http://www.site2.com");
var myArr_dealer_address:Array = new Array("someone1@somewhere.com", "someone2@somewhere.com");
var i:Number;
for (i = 0; i < myArr_x.length; i++) {
this.attachMovie("mark", "clip" + i + "_mc", i );
eval("clip" + i + "_mc")._x=myArr_x[i];
eval("clip" + i + "_mc")._y=myArr_y[i];
eval("clip" + i + "_mc").contento.what=myArr_location [i];
eval("clip" + i + "_mc").contento.the_index=i;
}
Like to say howdy to everyone, this is my first post.
Cheers
David
View Replies !
View Related
Increment Variables To Create New Arrays
I have been at this for days and I really need help.
I am getting numbers from an external XML document.
I need to have these numbers placed in arrays, so I can take last array, reverse it and concat to the first in order to draw a shape, and then go inwards through the remaining arrays. I can do all of this if I declare the new arrays and assign them values.
The problem is, I do not know how many xml nodes there will be, so I need to create the arrays in Flash dynamically and then pass them the xml data.
I have tried eval(increment var name) and I have tried set...but all that happens is the variables overwrite through a for loop or I end up with a string that has no connection with the array when I trace it.
Perhaps I could store the temp data in a text field and somehow work through the amount of text fields but that just seems bad practise.
How can I increment arrays and add the data to them?
This is typical of the ever dimishing circles I am going around in:
positionNode = firstNode.childNodes;
for(i = 0; i < positionNode.length; i++){
arrayVal = positionNode[i].firstChild.nodeValue;
var makeArray:String = "array" + i;
makeArray = arrayVal;
View Replies !
View Related
Problem Comparing Arrays With Variables
Hello,
I'm new in ActionScript, and I would want to make an application that sees if the text entered by the user is in an array.
So, if the array contains ("one","two","three") and the user writes "one" -> yes.
If the user writes, for example "five" -> no.
I've got a button "Search", a textfield with its variable (called 'usertext') for the user to insert text, and another textfield, a dynamic one (with its variable called 'dynam'), to see if the text that the user has written is in the array.
In the frame I've got this code:
fscommand("fullscreen","true");
numbers = new Array ("one", "two", "three", "four");
In the button I've got this code:
on(release) {
for(i=0;i<numbers.length;i++) {
dynam += "
"+numbers[i]+" - "+usertext+": ";
if(numbers[i] == usertext) {
dynam += "yes";
} else {
dynam += "no";
}
}
}
So I try writting "two" and what I get is:
one - two : no
two - two : no (this should be YES!)
three - two : no
four - two : no
What am I doing wrong?
Sorry for my English, if you don't understand something please tell me and I'll try to explain it better.
Lots of thanks!
View Replies !
View Related
Objects As Associative Arrays And Variables
I am trying to take form fields that were typed in and have them sent to an Object as an associative array. I think all I need to know is the method and syntax. I have 3 variables in the form, (Home1Name, Home1Number and Home1Position). I am trying to create a Player object for each player involved and then have all the info for that player associated with that one object.
Also, the trace tool shows me that the variables in the form fields are working, but all of the keys on the object show as undefined. Still new to these aspects of actionscript so explanations are most appreciated.
var homePlayer1Obj:Object = new Object();
// Adding property definitions
homePlayer1["playername"] = Home1Name;
homePlayer1["playernumber"] = Home1Number;
homePlayer1["playerposition"] = Home1Position;
trace(homePlayer1["playername"]);
trace(Home1Name);
trace(homePlayer1["playernumber"]);
trace(Home1Number);
trace(homePlayer1["playerposition"]);
trace(Home1Position);
View Replies !
View Related
Accessing Arrays Of Existing Variables
I have about 10 dynamic text fields that I've labled "comment0" to "comment9". I want to perform various actions on all of 'em but I can't figure out how to use a for loop to do it. Is there a way to either:
a) name them "comment[0]" instead of comment0?
b) access them by using something like this["comment" + i]
View Replies !
View Related
Sorting Arrays From External Variables
I thought I'd better start a new thread as I confused myself with the previous one on this subject.
With a bit of help from tripleaxis I've managed to import an asp file from an Access db into a Flash movie.
I've also managed to sort these variables into an array after loading them into an empty MC on the stage. The debugging window has also assured me that they are there all nice and neat.
The problem is that I need to make a dynamic table to show this array and found the fla from Moock that does the trick perfectly.
The actions for this table naturally, are in Frame 1 of the movie.
I've tried all forms that I know to call this array into the function that generates the table without success. Well, OK, really I only know one and it's not working.
In the tutorial Moock uses an array called "tiles". I'm using an array called "tiles" as well that is present in the empty MC "arraySort". But neither "_root.arraySort.tiles" or "arraySort.tiles" works.
Can anyone help me?
Thanx in advance if you can
View Replies !
View Related
Variables/arrays Assigned As Instance Names?
Hi,
I am using Flash MX 2004 Professional. I have a question about using arrays and variables as instance names. Please review the code below:
Code:
// Please be sure to add the Button Component onto the stage then
// delete from the stage as we just need the Button Component
// in our library.
// Numerical variables
var myWpos = 146.9, myHpos = 22.0;
var myXpos = 14.4;
// Arrays
var btnName:Array = new Array();
btnName[0] = "btnOne";
btnName[1] = "btnTwo";
btnName[2] = "btnThree";
var btnLabel:Array = new Array();
btnLabel[0] = "One";
btnLabel[1] = "Two";
btnLabel[2] = "Three";
var colorTheme:Array = new Array();
colorTheme[0] = "0x00CCFF";
colorTheme[1] = "0x0000FF";
colorTheme[2] = "0xFFFF00";
import mx.controls.Button;
for (iNum = 0; iNum <=2; iNum++)
{
// This code below appears to work as the buttons appears on the stage.
createClassObject(Button, btnName[iNum], iNum, {label:btnLabel[iNum]});
//The next three lines is where I am having problems with.
btnName[iNum].setStyle("themeColor", colorTheme[iNum]);
btnName[iNum].setSize(myWpos, myHpos);
btnName[iNum]._x = myXpos;
//trace(btnName[iNum]);
}
What I am trying to accomplish here is to use arrays to assign instance names, labels and color themes to my buttons.
The for loop is used to create the buttons and change the properties of my buttons. Instead of doing it the long and drawn way (listed below), I thought one for loop would make life easier.
Code:
/*
// Create Button #1
createClassObject(Button, "btnHorizon", 1, {label:"Horizon"});
btnHorizon.setStyle("themeColor", 0x00CCFF);
btnHorizon.setSize(myWpos, myHpos);
btnHorizon._x = myXpos;
btnHorizon._y = 103.3;
// Create Button #2
createClassObject(Button, "btnValidation", 2, {label:"Concept Validation"});
btnValidation.setStyle("themeColor", 0x0000FF);
btnValidation.setSize(myWpos, myHpos);
btnValidation._x = myXpos;
btnValidation._y = btnHorizon._y + 24;
// Create Button #3
createClassObject(Button, "btnAssessment", 3, {label:"Concept Assessment"});
btnAssessment.setStyle("themeColor", 0xFFFF00);
btnAssessment.setSize(myWpos, myHpos);
btnAssessment._x = myXpos;
btnAssessment._y = btnValidation._y + 24;
*/
Can arrays and variables be used as instance names as well as other methods to modify changes to properties?
Any help you can provide would be greatly appreciated.
Thanks,
- Alex
View Replies !
View Related
Loading Multiple Variables In Arrays From Extern
hi !
i've got a question
i'd like, for a news page, that it updates itselfs when a file is uploaded on the server, keeping the old news at the bottom and the new one at the top, so i thought i could use text files with the date as name (ex:220604.txt) holding variables (date,title, txt) as strings so that i could store them in an array that would sort each time the swf is loaded.
then the news could displayed in order where i want them to be
first:
does this seem right to you, will it work ??!!
second:
if i ask it's because i'm stuck between the loadVars and the Array and i'm not the super pro of the array so if you understood what i'm trynig to say please help me !!
Thanks a lot !
View Replies !
View Related
Passing Array Variables Into Functions (and Why I'm Hopeless At Arrays)
OK, I have spent a day on this now and have done some fairly extensive searching online. The problem is - I am hopeless with arrays (and probably just actionscript generally for that matter)
I want to create an array of buttons, so I set up an array of actions, step through each item and then try to pass that array action into an onclick button for an attached button
The problem I have is that the onclick function ALWAYS returns the last item in the array.
Help!
Code below:
----------------------------------------------------------------
Attach Code
//set up array
var myArray:Array = new Array("action1","action2","action3");
// for each item in the array
for (var i:Number = 0; i < myArray.length; i++) {
var myArrayNode = myArray[i];
myArrayIndex = i+1;
var myButton:MovieClip = attachMovie("workIndexBtn", myArrayIndex, this.getNextHighestDepth());
//ignore -- offset each button by 100px
myButton_x = myArrayIndex*100;
myButton._x = myButton_x;
//end ignore
//action button for each item in the array with correct action
myButton.onRollOver= function() {
trace(myArrayNode); //always returns action3
};
}
View Replies !
View Related
|