ActionScript 3.0 :: Get A Variable Containing The Drug[?] Arraynumber And Then Applying It To The Second Array?
May 9, 2009
when it comes to AS3 and I'm creating a drugdeler game in the spirit of old DopeWars. On my main timeline i have placed out 6 movieclips containing pictures of drugs and named the instances. In my actionscript i have created 2 arrays, one containing the instance-names of the drug movieclips and one containing the name and price of each drug in string
Now what I want to do is when you mouse over a drug-movieclip a textfield will appear containing the string associated with that particular drug.The problem is, I have no idea how to get a variable containing the drug[?] arraynumber and then applying it to the second array to get the string into the textfield.Here's my script;
var drugText:TextField = new TextField;var drugIndex:Array = ["Ganja $500", "Heroin $10,000", "Cocaine $25,000", "Hasch $600", "Acid $1,000", "Ectasy $1,500"];var drugs:Array = [ganja_mc, heroin_mc, cocain_mc, hasch_mc, acid_mc, extacy_mc][code].....
View 8 Replies
Similar Posts:
Aug 22, 2010
I am having trouble applying a different array for a combobox
I have created a datagrid, and then I am trying to use cellrenderer to put a combobox in a column.
Normally I set up the datagrid, then use the following code to create the column that the combobox is going in:
var column = new DataGridColumn("species_id");
column.headerText = "species_id";
column.width = 70;
[Code]....
View 4 Replies
Feb 3, 2010
How do I apply one variable and one function to many movieclips?[code]The reuseFade function works if I target the movieclip by name on the stage,ex: var T1:Tween = new Tween(mc_black1, "alpha", Strong.easeIn, 0, 100, 5, true);using "this" doesn't work.The only way I know how to make this work is creating four functions to handle the event
View 7 Replies
Dec 30, 2009
I have a VBox containing a bunch of panels. I have implemented dragging and dropping but I need to be able to scroll automatically when the item is drug near the edge. I am having mixed results. I can get it to work, but not well. My example is below. It works if the user bounces their mouse around a little near the top or bottom edge, but I want it to work if they just hold the mouse there.[code]So if they are within 50px of an edge then it should scroll by 50px. I've exaggerated the numbers just to get an affect.
View 1 Replies
Feb 18, 2008
I'm using the following script to apply a blur effect on rollover/rollout. For some reason it's only applying to the last clip in the array:
Code:
import flash.filters.BlurFilter;
import mx.transitions.Tween;
import mx.transitions.easing.Strong;
[Code]....
View 2 Replies
Sep 5, 2008
I have 3 movie clips (MC's) on the stage. The instance names of these objects are in an array:
var navItems:Array = new Array("nav1_mc", "nav2_mc",
"nav3_mc");
I want to loop thru these movie clips and modify them with the following:
for each (var item:String in navItems) {
item.anyMethod = asdf;
}
If I trace item at this point, I get the correct string name that matches the MC, but it won't let me do this kind of operation at compile time. It throws a "1061: Call to a possibly unidentified method ..."
How to get at a MovieClip using only a string of its name at runtime?
View 3 Replies
Mar 20, 2012
regarding adding multiple childs to an array these childs are added using timer after a time interval.actually there two classes and child of both classes are added to stage one through timer as i described and other through keyboard event. now is it possible to do this if yes than how?? and is it possible to apply hittest object between these two array.
View 6 Replies
Aug 16, 2011
I think it would be simplest to explain it like this:
[Code]...
View 1 Replies
Oct 12, 2006
I'm going to post the full code of the two functions, disregard the "fluff" unrelated to the two functions as it is all working flawless, I've tested this HEAVILY and cannot understand why it keeps setting the entire array to undefined!
Code:
// processReplace Function
function processReplace(transferFiles) {
var processArray:Array = transferFiles.slice();
[Code]....
Basically it's supposed to check to see if the file exists and return as true if it does and add it to a replace array, then the replace array is processed into a single string and put into a dialog box through the flash wrapper prompting them to "replace the files or not".
It makes the replace array just fine, it actually even has the right "count" in it but it's setting all the "filenames" to undefined because of the exists = processSearch function.
I even tried to make a new array and run the search just from that one and set the values from the old one and it's still failing.
Is it because of the "break" or can anyone figure it out? Iknow it's hard because you can't use the code
View 1 Replies
Aug 25, 2008
I want to change the value of a variable listed in an array using the array. for example:
Code:
var theVariable:Number = 15;
var theArray:Array = [theVariable];
now if I try this
Code:
theArray[0] = 20;
I just get an array with 1 value of 20 in it and it no longer references theVariable what i want to do is change the value of theVariable with out removing it from the array but referencing it from the array in a loop or something.
View 5 Replies
Sep 25, 2009
I want to loop through an array and use the array value to reference a variable.
The Setup:
(For illustration only. Not actual script)
My MCs:
triangle_mc
square_mc
[Code]....
View 1 Replies
Jan 27, 2011
Sorry if the title is a little confusing. Here's what I meant - I have an array and and object. Let me give a visual:
This is my object:
obj["id"] = ["1","2","3"];
obj["name"] = ["na","no","ne"];
my itemArray:
itemArray = ["id","name"];
[Code]....
but it doesn't work. How do I actually use the arr[i] variable in the array? :s
View 1 Replies
Feb 8, 2011
Wanting to add an array to a MC like:
var mc:MovieClip = new MovieClip();
mc.myarray[0] = movieclip1; // some mc name
mc.myarray[1] = movieclip2; // or push it
[code]....
View 2 Replies
Oct 22, 2011
I basically need to load information from an XML. Then depending on which button is clicked(apartment in a building) that specific info from the xml needs to load in a txt field.
Here is my actionscript and xml code. I'm stuck on how to assign " i " to each apartment in the building.
[Code]...
View 1 Replies
Jun 19, 2009
I have an array variable called ball[#], which value starts at 0 and is incremented up to 8. I also have a corresponding array variable called _ballPlaced which returns true or false if a ball is placed in a target zone. What I would like to do is retrieve the array value variable from the ball[#] at any time. For instance, the ball[#] variable can be clicked and dragged, so when it's selected it becomes the event.target. E.g. How can I put the array value of the ball[0] in the ball _ballPlaced array.
ActionScript Code:event.target._ballPlaced[/* retrieve vale of ball[0] array i.e. 0 and put it in here */]
View 1 Replies
Jun 15, 2009
I am desperate about this.[code]...
Another thing: how to access array values from outside of function?
View 2 Replies
Sep 25, 2009
I want to loop through an array and use the array value to reference a variable. The Setup:(For illustration only. Not actual script)
[Code]...
View 3 Replies
Oct 11, 2011
I have a app that currently gets event data from facebook and displays this into a list[code]...
View 1 Replies
Feb 15, 2009
I have global variables:
_global.var1Array
_global.var2Array
_global.var3Array
_global.var4Array
and so forth.The issues is I need to call a variable from within the array but depending on an option the user has chosen it needs to call the right one.At the moment I am trying
end = "_global.var"+userOption+"Array["+array#+"]";
userOption being the needed array
array# being the needed entry within the array.
However when I try and use this I of course just get it like a string, not as a variable...
View 4 Replies
Jun 19, 2009
I have an array variable called ball[#], which value starts at 0 and is incremented up to 8.
I also have a corresponding array variable called _ballPlaced which returns true or false if a ball is placed in a target zone.
What I would like to do is retrieve the array value variable from the ball[#] at any time.
For instance, the ball[#] variable can be clicked and dragged, so when it's selected it becomes the event.target. E.g. How can I put the array value of the ball[0] in the ball _ballPlaced array.[code]...
View 0 Replies
Feb 3, 2010
What I have: 2 buttons on stage (NEW_YORK and CHICAGO) which are given an onRelease function trough a forLoop (so far so good).
What I need: For those to buttons to trace their own array item when i press them.
The problem: If I summon the array item static (array[1]) it works, but when i try to make it dynamic (array[i]) it comes back as undefined.
I enclosed the .fla.[code]...
View 2 Replies
Feb 9, 2010
I'd like to use a variable for the field name of the associative array, but my brain is not remembering what I did long time ago when I needed it.
[Code]...
View 9 Replies
Feb 22, 2010
Does anyone know if it is possible to have an Array containing predefined variables - then modify a variable using the array?
For example
ActionScript Code:
var data1:String = new String;
var data2:String = new String;
[Code]....
This will currently trace 111 - can I get it to trace "Hello"?
View 9 Replies
Mar 17, 2010
I have a series of buttons within an array called (a,b,c,d,e,f,g,h,i) see below
ActionScript Code:
var myArray:Array = [a, b, c, d, e, f, g, h, i];
for (i in myArray) {
[code]....
View 2 Replies
Feb 18, 2011
I have four checkbox and store the value in the Array. So if check all the boxes than I have an Array which have value = 1,1,1,1
I want to compare that with a variable which has same value 1,1,1,1
If the both value is same than it will display correct feedback.
var user_response:Array = ["0", "0", "0", "0"];
var correct_answer = "1,1,1,1"
Here is the code
if (user_response == correct_answer ){
trace("Correct");
}
else {
trace("Incorrect");
}
I keep getting "Incorrect" even if I had selected all checkboxes.
View 3 Replies
Mar 21, 2011
I have an array named "lagers1" when I trace lagers1[0] I get: lagers1[0]= _level0.firth_l0
Now I want to decide if "firth" is in the name of "_level0.firth_l0". I have tried with slice but all the time it shows undefined. Is there a way to get a part of an arraymname in a variable?
View 9 Replies
Jan 11, 2012
Is there a way to obtain the variable name that is inside an array?[code]...
View 2 Replies
Mar 14, 2012
I have three array holders that hold different text and numbers. First I need if(_root.achievements[0][i] (Needs to be evaluated as a string variable name for example _root.pKills because before I set _root.pKills to 10) == _root.achievements[1][i] (Need to be evaluated as a number so I can compare it to the string variable name))
[Code]....
View 2 Replies
Jun 9, 2004
im doing a loop to attribute the values to _x property, and use it to make random movimets with movieclips.i ve got 16 movieclips in my stage, named b1, b2, b3....b16 and the code is
Code:
count = 0
chama = setInterval(function () {
count++[code]....
so... after 3 time that setinterval execute this function, i�d like to call a function to get this movieclips, in their current positions and take them in especifics positions on stage.so I created an Array and I�m trying to use this code to define variables with values from the Array, and make a moviment to the especifics positions
Code:
xC = [63.9, 16.95, 45.85, 65.55, 18.75, 26.2, 55.85, 55.25, 28.85, 21.95, 36.6, 35.75, 14.7, 45.7, 14.45, 60.75]
function cPos () {
for (a=1; a<=16; a++) {[code]...but it�s not working...why??what can I do to Take the variables inside the array and use them to respectives movieclips b1, b2....b16?
View 2 Replies
Sep 29, 2004
Is it possible to get values for a variable from an array.How would i do this?
View 2 Replies