ActionScript 2.0 :: Putting Variables Instead Of Names
Jul 26, 2004
if i have mc duplicated or an object instance name thats stored inside a variable how can i call it? for ex: _root.mov1._x = 53; What if i want instead of mov1 a variable name. lets say randomname is a var and it holds the name of a duplicated object with a name i dont know since its random. now how can i call it just like the example above cause i tried
_root.varname._x=33; but it thought varname was an instance name instead of var.
View 5 Replies
Similar Posts:
Jul 26, 2004
if i have mc duplicated or an object instance name thats stored inside a variable how can i call it?for ex:
_root.mov1._x = 53;
What if i want instead of mov1 a variable name. lets say randomname is a var and it holds the name of a duplicated object with a name i dont know since its random.
now how can i call it just like the example above cause i tried
_root.varname._x=33;
but it thought varname was an instance name instead of var.
View 5 Replies
Sep 15, 2009
I worked again on a new Project and stumbled while trying Arrays. I have two cubes(cube_mc, cube2_mc) in my scene.
My code:
var gy:Number = 0;
var gravity:Number = .2
var moving:Array = new Array(cube_mc, cube2_mc);
this.addEventListener(Event.ENTER_FRAME, gravityFUNC);
function gravityFUNC(event:Event):void{
gy+=gravity;
moving.y+=gy;
};
I was trying to put both cubes into the array, and then affecting the whole Array with gravity. When I test it nothing happens, and it shows no errors.
View 2 Replies
Sep 15, 2009
I worked again on a new Project and stumbled while trying Arrays.
I have two cubes(cube_mc, cube2_mc) in my scene.
My code:
Code:var gy:Number = 0;
var gravity:Number = .2
var moving:Array = new Array(cube_mc, cube2_mc);
[Code]....
I was trying to put both cubes into the array,
and then affecting the whole Array with gravity.
When I test it nothing happens, and it shows no errors.
View 1 Replies
Jul 25, 2010
I am trying to create a list of names which is generated by a swf file that contains buttons representing letters of the alphabet. The user generates a name by clicking on the letter buttons until the letters of the name have been spelled out and then clicking on abutton to add each name to the list. The names are generated inside the swf file but I want the list of names to be deposited in a file within a folder of the computer and remain there as a permanent record after the swf file has been closed. I can do the Actionscript 3 programming associated with the letter buttons but I would like to know how to send the names to the computer file.
View 15 Replies
Oct 20, 2002
Im trying to optimise my code a bit so i dont have ten lines of identical code on each button. Actionscript is not my strong point. Currently on each of the menu buttons there is this code:
// sets the vertical position of all scrollbars (name0) inside their content movieclips //(name) to _y = 0
on (release) {
setProperty("work1.carni.carni0", _y, "0");
setProperty("work1.dead.dead0", _y, "0");
[code]....
what i'd like to do is some kind of function like this, which does all the work in a frame on the main timeline. For example:
on each button:
// tells every "name0" mc to set _y to 0 within their respective content movieclips
on (release) {
vertical = (_y = 0);
verticalHold(vertical);
}
on the main timeline something like this:
// Get the command from the buttons and run the function and set all "name0" _y to 0
function verticalHold(vertical) {
setProperty(allName0Clips(vertical));
}
i've played around with this function for loading external swfs, but i have no idea how to make it set multiple _y positions. what about putting all the mc names into an array (called "allName0Clips") and doing it that way?
View 2 Replies
Mar 24, 2010
How can I input varables value into a textfield?var i:uint=0
for(i; i<4; i++){
pageText.text=i+1
}
If i use i+"something" then it can get the i value, but other than that it could not get i value.
View 2 Replies
May 20, 2010
The thing is, I create a grid on the screen, and each of its element is given a name. The question is, how can I access those specific grid's fields by their names? Here's the code:
ActionScript Code:
private function drawGrid():void
{
var startX:uint = 0;
[Code]....
Now, If I wanted to remove, for instance, the box of the 13th row and the 25th column, how can I do that?
View 7 Replies
Aug 15, 2011
Is there a way to get the names of variables from a flash game? I have been playing with my players health with the code;
javascript:document.embeds[0].SetVariable("_root.player.intHP", 0)
I am looking for a way to find out the rest of the variables, like damage and such.
View 1 Replies
Dec 9, 2010
If I have a MovieClip called parent_mc and inside it I have another called child1_mc, I can use a variable for the "1" part of child1_mc and change the alpha for example like this:
ActionScript Code:
var myVar:Number = 1;
parent_mc['child'+myVar+'_mc'].alpha = 0.5;
What is the right syntax to use if child1_mc is not actually a child of anything and just sits on the stage? I have tried the following and it didn't work:
ActionScript Code:
['child'+myVar+'_mc'].alpha = 0.5;
and I tried:
ActionScript Code:
stage['child'+myVar+'_mc'].alpha = 0.5;
That didn't work either.
View 9 Replies
Jul 13, 2007
There's a way to get the instance name of objects/symbols for variables and use this in actions and/or functions?
View 4 Replies
Nov 11, 2010
So, I have something like..
Code:
select = ("block" + number);
trace(select._currentframe);
number++;
This is because I have 5 movieclips named block1, block2, etc. However, it returns undefined. When I directly state the instance name, like:
Code:
trace(block1._currentframe);
It works. How do I use variables as instance names?
View 2 Replies
Aug 7, 2009
I am using AS 2.0 and Flash Player 9.I want to change MC Instance names and target paths, by using variables.As an example, this is the traditional working code.
enter_btn.onPress = function () {
clip1_mc.gotoAndPlay("label1");
};
[code].....
View 2 Replies
Dec 26, 2009
I would like to make an Object that has key names taken from a variable. Probably this is not clear enough, so let me make an example.
I have two variables var str1:String = 'firstKey'; and str2:String = 'secondKey';
How can I make an object that would look like:
var obj:Object = {firstKey: 'some value', secondKey: 'some other value'}, note that firstKey and secondKey are values of variables str1 and str2.
Doing obj = {str1: 'some value', str2: 'some other value'} does not yield a result that I would like
View 3 Replies
Jul 19, 2009
i want to query about a point here,
Now, When i make a loop for example a "for" loop
ActionScript Code:
var i:int;
for (i=0;i<4;i++){
// Looping Code For 4 Times
}
in the looping code, when i use a variable, for example "myVar"
Can i make the variable name be "myVar0" in the first time looping, and the name be "myVar1" in the second time looping, and so on ..
View 6 Replies
Jan 24, 2010
I can't create new variables within a for loop:
ActionScript Code:
for(var i:int = 0; i<numBtn; i++) {
var this['menuBtn'+i] = new Sprite();
}
This doesn't work, saying I need an identifier before 'this'.
What I am trying to do is to make a dynamic menu, and the number of buttons depend on how many files there are in a directory, as each button links to each file;I get this value (numBtn in my example) from a php script, and I need to make a menu depending on it, but I can't seem to make it so that when I add a new file into that directory, a new button comes up on the menu and I don't have to change my flash file.
View 9 Replies
Dec 19, 2008
Still learning how to use for loops, I want to set a huge range of Boolean Variable to false. like:
var met0:Boolean = false;
var met1:Boolean = false;
var met2:Boolean = false;
etc... etc...
how can I dynamically name variables inside a for loop and set its data type? I know how to with movieclips but can't get it to work with variables
View 4 Replies
Jun 20, 2006
I have created movie clips using loops that names them box1, box2, box3.... via = i + 1;duplicateMovieClip (_root.box, "box" + i, i);but i then want to edit a textbox which is rooted inside each movie but related to the movieclip just produced. so if box1 had just been produced then:box1.textbox.text = " E cell = +j+"V";is done so effectively i am looking to do: box+i.textbox.text = " E cell = "+j+"V";
View 2 Replies
Oct 7, 2006
I've a problem with accessing different levels..
actually i'm in the 6th level of my swf and i need to access a movieClip in the 2nd level .
Is it possible to use variable names instead of giving the real level name and movieClip...
My code is something like this...
var levelData:String = _level2.mc_myMovie;
levelData.onRelease = function()
{
[Code]....
View 2 Replies
Oct 18, 2007
I am using the tween class to change the alpha value of a MC upon rollOver and rollOut. To refine the effect, I assigned a variable to the MC's alpha value so if the mouse moves off the MC before it has reached 100% alpha, it wont start immediatly fading from 100%, but from the value it had reached before the user stopped the rollOver action. Unfortunately, when I leave my mouse over the MC until it goes to 100%, and then I wait a second or two, the alpha snaps back to 50% (the starting alpha value).I can't figure out why this keeps happening, but I have run into it with other projects and I surmise it is the way I am using the tween class. Below is the code I used to make this happen.To see the problem, here is a link to the compiled file:
// image 1 Set 2
groupA.group2.image1.onRelease = function() {
loadMovie("main_resized/1.jpg", pictureHolder);
[code]......
View 1 Replies
Jun 29, 2008
var c = mainSubThumbs.SubThumbsHolder[materialType].subthumb_mc[id] what i have obviously doesnt work. materialType and id are my variables that I want to be added onto these mc instances..
View 9 Replies
Feb 4, 2010
What are rules for legal variables names?ie: A-Za-z0-9, hyphen, underscore, etc. must start with an alpha at least n characters, no longer than n characters, etc.
View 3 Replies
Nov 21, 2010
So, I have:
function respawn(enemyid){
clearInterval(respawnTimer);
enemyname = "enemy" + enemyid;
[code]......
View 5 Replies
Nov 4, 2009
Lets say there's a variable called banana1 (I'm just using it for example). Can I replace the 1 with another variable that's equal to 1 so I can modify banana2 just by changing the other variable.
View 3 Replies
Mar 19, 2010
How do you use variables to access Object attributes? Suppose I have an Object declared as follows,
var obj:Object = new Object;
obj.Name = "MyName";
obj.Age = "10";
[code].....
View 1 Replies
Jul 11, 2009
I'm trying to create a series of Loaders in a for loop whose names are created from an Array.If "eval" existed in AS3, the code might look something like this:
var i:int;
var tnArray:Array = new Array("tn0","tn1", "tn2");
for (i = 1; i <= 10; i++){
[code].....
View 1 Replies
Aug 15, 2009
The question is about producing a learning package for users to improve their mathematical skills.One part of it is for times tables. So the user will enter their name and then a question will appear e.g. "What is 6 X 9?" The user then inputs their answer and the system will compare and process the input, storing the incorrect and correct responses and then giving a final score at the end.The question is to; identify the names of the likely variables and processes required for the system generation of a question and the subsequent processing of the user's response.(10 marks)Then it asks to write some pseudo-code to describe 10 consecutive question/response activities and their final results showing their name too. (15 marks)
View 4 Replies
Sep 7, 2011
FDT can do it, but half the time it times out and needs to be restarted on renaming some objects. Can Flash Builder do this?
View 1 Replies
Aug 26, 2010
We've got an Illustrator file with something over 1,000 layers. We're trying to import this into Flash and keep the layer names intact, such that they become the names of the movie clips that are imported for each layer and can be used programmatically. (It is a diagram and arrows, boxes, etc all have callout names that will eventually allow them to link to a database.)As near as I can tell, the Import dialog will NOT pass this info across between the two parts of the dialog.
View 1 Replies
Mar 20, 2011
I started a thread about a reference to a symbol House, in the output window, which was: House_1. A lot of people said some useful things about that. All day I've been thinking about it, and I came to the conclusion that I don't understand things, at a very basic level.
Consider:I make a movieclip which I give the Symbol name Drawer. (I don't export it for AcitonScript.)On the stage I manually place two instances of this Symbol. The first one I give the Instance Name drawer (in the properties panel). The second one I leave nameless.Now if I trace the names of both these clips, by
trace(this.getChildAt(0).name);
trace(this.getChildAt(1).name);
the output window gives me
drawer
instance2
Now I know that the so-called "instance name" which I gave in the Properties Panel (drawer) is, in reality, a variable name which Flash gives my first instance behind the scenes. And instance2 is a name that Flash gives my second instance. What exactly the nature of that name is, I do not know.My point is: both names (drawer and instance2) are the .name property of these movieclips. Otherwise I could not have traced them through asking for the .name property, in the above. Yet only the first of these two can be manipulated:
drawer.x can be set;
instance2.x can (as we know) not be set.
But...why? What is the real difference between these two kinds of names? How can they both be the .name property of their underlying movieclip, yet be of such a different nature? What IS the nature of the instance2 name? If it's a String, how come the .name property of one movieclip can be a variable name, while the .name property of another (but identical) movieclip is a String?
I've searched every bit of web page on the net I could find. But it looks as if nobody addresses this issue. We all just work with it - but it makes no bloody sense. A name property = a name property, you'd think. Whether Flash set it or I set it should not make a difference. The x property of a clip, for example, does not change in nature according to who set it - me or Flash.So, again, just to emphasize the problem: how can a property (the name property) of a movieclip change in NATURE depending on who set it? After it's been set, shouldn't the name property of a clip be of exactly the same nature as the name property of another clip?
View 8 Replies