ActionScript 2.0 :: 'For' Loop Not Changing ._y Variable?
Jul 7, 2004
I have the following code:
PHP Code:
on (release) {
cNum = cNum+1;
for (b=1; b<8; b++) {
trace(["box"+b]);
["btn"+b]._y = ["btn"+b]._y+25;
[code]....
on release, the objects labeled btn1, txt1, box1, btn2..... should all be shifting 25pxs. It doesnt do anything.
View 5 Replies
Similar Posts:
Nov 9, 2010
Should I declare the _mcContainer var before the loop or no? (performance increase?)
for(var i:uint = _startIndex; i <= _endIndex; ++i){
var _mcContainer:MovieClip = _mcParent["i_" + _position];
}
[Code]....
View 1 Replies
Mar 2, 2007
I have some code that seems to have a problem. I can't seem to pass the x variable from one loop to within another loop.
Code:
var myLv = new LoadVars();
var myNv = new LoadVars();[code]....
View 2 Replies
Dec 21, 2006
I know that
Code:
for (var i = 0; i<5; i++)
will loop through some script adding 1 to i until i equals 5
[code].....
View 1 Replies
Nov 3, 2009
i'm trying to get it so a MC1 on top of MC2 slowly fades in. It starts with alpha of 0 and i put it in a while loop (on MC1):
onClipEvent(load) {
this._alpha = 0;
var i = 0;
[code]....
View 2 Replies
Jan 12, 2010
i was trying to save these data and changing with for loop
povDisp1 = mySO.data.cas1;
povDisp2 = mySO.data.cas2;
povDisp3 = mySO.data.cas3;
povDisp4 = mySO.data.cas4;
povDisp5 = mySO.data.cas5;
[code]....
problem is that it is showing only my last variable ( i don't know what is problem in for loop)i've solved it with these
//thanks
for (var n:Number = 0; n < 51; n++)
{
mySO.data["cas" + n] = this["povDisp" + n];
}
View 3 Replies
Jan 19, 2009
I am trying to create a loop that changes the colours of my dynamic vectors inside my sprite however I am not sure if I putt the following var names in the right place in the end of my statement attached or if i need another variable :[code]
View 5 Replies
Apr 22, 2009
I am working is CS3 and am experiencing problems changing the first frame on a graphic symbol. When I type in a new number it jumps back to the old one. When I try to change play once/loop/single frame setting it jumps back to the previous setting. I am trying to simply modify this on a keyframe in the symbol's layer on the main stage. I've experienced this on multiple occasions, but can't get the workaround this time. I know I can do what I am attempting. In fact, I do it at a couple of spots earlier in this symbol's instance without problems.
View 4 Replies
May 3, 2010
I have a movieclip called 'Sitecontent'. Within this movieclip I'm using a variable to determine on which page my website is. The pages are seperate movieclips which I load throug addchild.When I load (for example) page 1, it start playing a openingAnimation which stops at a specific frame. After it stopped, I want to update my variable in the SiteContent mc. How to acces the variable from a other movieclip?
View 4 Replies
May 25, 2011
I'm very new to Flash, but I have been learning loads and getting some good results so far. Browsing these forums has been a massive help. However today I have hit a problem in what should be almost the simplest line of code I know how to write (variable = x), and could do with some advice. I have a simple program containing a button which will change a variable when pressed. There is also a text-box that will output that variable. However when I press the button, the variable will change, but then immediately revert to it's previous value.
[Code]...
View 3 Replies
Jun 16, 2010
I have used setProperty up till now, and it have met my needs needs so far.However, this one thing it cannot help with:
I have several different textfields all within different movieclips. I want to only change the content of only one of these textfields, however which textfield is changing all the time. Therefore the path of the textfield that needs changing has been put into a variable. Now I need to change the text of this textfield by using the variable(tempRevis1). i placed the path of the textfield within a variable:
_root.tempRevis1 = "_root.level1a_mc.AIRB237_mc.textMe1_txt";
Now this is what I hoped to have done:
setProperty(_root.tempRevis1, text, newTextValue);
View 0 Replies
Mar 29, 2004
I have one swf file that containes a mc using an easing function to move an arrow around.That mc has the instance named myruler. The arrow moves based on the value of a variable named "y". This swf also has a mc that I use as a container to load movies into.The movies that are loaded into the container mc have buttons that I would like to use to change the value of the variable "y" in the movie clip named myruler found in my base swf. Did that make sense? The code I'm trying to use on those buttons goes as follows:
on(release){
_root.myruler.y = 300;
}
The my ruler movie is in the swf that loads the swf with these buttons. So how do I point to that original swf.myruler.y?
View 2 Replies
Apr 29, 2003
I�m having some trouble with changing the value of my variable.I declare my variable in the first frame of the _root timeline.
currentSlide = 1;
When the _root movie plays it stops on a movie clip that contains four sub movie clips each is labelled sequentially( slide1, slide2, slide3 and slide4).I would like to know how to increase the value of my variable by 1 each time it progresses to the next slide. I can�t seem to get the variable currentSlide to change its value.
View 1 Replies
Jun 18, 2010
There is probably a better way to do what I'm trying to do, but I simply want to make a variable change its value when I press the arrows keys. For example if I wanted to cycle through weapons, if weapon=0 then the character is holding a certain weapon, then I press the down arrow key and weapon=1 and if weapon=1 the character is holding another weapon. And if I press up weapon=0 again so he's holding the first weapon again. And say there's 8 weapons, if weapon>8 then weapon=0 again so its a cycle. I tried arrow key functions and all they worked for was making a symbol move. I think I knew how to do this stuff in gamemker pretty well but Flash is very different.
View 2 Replies
Jul 10, 2010
I am making a game in flash, that uses several resources to build different buildings, that help you to gain resources, etc. I'm trying to make it so that the more "_global.food" you have, the faster your resources will go up. I have it so that the variable "_global.woodBoostMeter" goes up as fast as "_global.woodBoostSpeed" and when it reaches 500, it gives you 1 wood. I want it so that "_global.woodBoostSpeed" is modified by "_global.food" divided by whatever 200 is. (So that you will get resources faster for the more food you have)
Here's the code I'm using:
Quote:
_global.woodBoostMeter =0
_global.woodBoostSpeed = _global.food / 200
_global.woodBoostObtainRate =1
[Code]....
I think the problem seems to be with the "_global.woodBoostSpeed = _global.food / 200". it doesnt go up slow like it should, since "_global.food" starts out at like 200.
View 3 Replies
Sep 3, 2010
Below is decription of the file
1. I have a flash file which is loading php variable through flash vars.
2. The flash var variable contains the .txt filename in which data is kept.
3. When I open the php page the swf loads with variable having .txt filename and value containing swf path.
4. I have created timer in flash which check for change of value.
5. When value changes the other flash file loads.
6. All this works fine in all browsers except IE 7
View 1 Replies
Feb 16, 2009
im making a achievements page and i want flash to change a variable to 1 how do i do it
View 9 Replies
Jun 21, 2011
I'm working on code for collision. My question isn't about how to make it work. I have a bizarre problem with a variable that is NOT changing when I want it to.
ActionScript Code:
public function movement(e:KeyboardEvent){
var yesobject:Number = 0;
var thecode:Number = e.keyCode;
if(thecode == Keyboard.LEFT){
[Code] .....
I've had this problem before. the trace(); commands outputs so why does the variable not change even though it's in the same if statement?
View 1 Replies
Jan 11, 2012
trying to make my first game using flash. I have done the main thing, setup a character which can be moved by the user to catch some falling balls. Every time a ball is caught, the score goes up by 1. To count and display the score, i have used a number variable called "caught" defined in the main timeline with initial value 0. The main timeline has only 1 frame and stopped by codes in the level "action". The "caught" variable is used in many movieclips in the scene and its value changes as the character catches the ball.
Now when the score is 10, i want to go to a new scene that shows a "congratulation you win" animation. For this, I have wrote the following code in the movieclip of the main character -
onClipEvent (enterFrame) {
if (_root.caught == 10) {
gotoAndPlay ("Scene 2",1);
}
}
But this does not work. The score goes upto 10 and then beyond 10.Is there anyway I can use the value of a number variable to determine when to play a particular scene?
View 4 Replies
Jul 9, 2010
To avoid a large segment of code I've set up button names that correspond with movieclips that are located in my library and exported for use with the code. I want to replace the movieclip currently on stage with another movieclip from the library depending on which button you click on. The code works fine, I'm achieving all the values I want, except for the fact that since the variables in the function are strings it gives me a coercion error saying that they're strings and not objects.
Here's the code:
Code: Select all// Holder
var holder:MovieClip = new MovieClip();
holder.x = 122;
[Code].....
View 4 Replies
Jun 5, 2006
I would like to have a button that when clicked changes a variable for 30 seconds and then changes it back. For example:
[Code]...
View 1 Replies
Sep 8, 2009
Its a simple adding "game" where 2 numbers are randomly generated and you have to input what you think the answer is (userAnswer). Then it adds the two numbers it just generated to produce correctAnswer, and checks it against userAnswer. When you hit the check answer button, it moves the the score dialog frame and says whether its correct or not. But I am having 2 problems I think - 1 - I can't get the input textfield to assign the typed-in value to userAnswer (I'm trying userAnswer = inputAnswer.text; ) and - 2 - the second frame that has the score and "Correct!" / "Incorrect!" dialog can't seem to access any variables from the first frame. I've tried using two layers and keeping the variables on the second layer that spans both frames, but then the functions in the frames that you actually see can't change the variable to update it with the user's input.
View 3 Replies
Nov 13, 2009
i have a probleme changing the value of a variable in movieclip from my scene. i explain: I have combobox on my scene containing categories,and in the scene i load an xml file containing links to php files that work with the combobox.Also on the scene i have a movieclip "filmstrip", inside this movieclip on the first frame i have a script loading the php file selected in the scene. i use a load() function with a variable "theUrl" inside like this : T.load(theUrl);.In my scene i want to change the value of "theUrl" inside the movieClip filmstrip. I tried filmstrip.theUrl = url; But it doesnt work
the xml file
<?xml version="1.0" encoding="ISO-8859-1"?>
<slideshow>[code]....
View 7 Replies
Feb 13, 2009
I have a problem with setting dynamic variables. How do I retrieve a value from a variable who's name is dynamically changing?
Example:
variable1 = 1,
set variable2 = variableList(variable1);
so...
if variable1 = 5,
then variable2 = variableList5
How do I do that?
View 0 Replies
Jan 9, 2010
I have a code, it is below. And i have two vars: coordx and coordy they both are 0 but when up button is pressed, coordx should change into 1 x remain 0 just like map scrolling and if pressed down it should return to default position, but instead of that variables keeps reseting and it starts from beggining. Here is the code:
ActionScript Code:
var coordx:Number = 0;
var coordy:Number = 0;[code].......
View 3 Replies
Sep 3, 2010
I have a website that I have to alter the <title> tag that shows up in the browser as the sites name through using Flash as3 and xml. I was wondering how to access the <title> tag so that I can create a variable in flash, that retrieves whatever string is within the <title> tag of the current xml document that is being accessed? All pages need to have the same title, so it doesn't need to be too complicated, I just need to be able to alter the tag through xml and as3.
View 1 Replies
Jan 27, 2011
Beginner question here. Basically I have the following code:
if (_root.obj1 == 1) {
n = _root.invArray.length;
_root.obje1._y = _root.inve(n)._y;
[code].....
View 1 Replies
Sep 24, 2009
I want to add some input fields together and can't seem to do it..
test_btn.onRelease=function(){
total = Number(input1) + Number(input2);
}
In the total field I get 'NaN'
View 4 Replies
May 4, 2007
I need to hold a couple of variables in an outside file that can be incremented by user activity -- not just during one interaction with the swf, but with every one.I have no problems with using loadVars and I get the loadandsend process; it is just that I have
no background in cgi or asp for holding the variable and being able to update it.I know I cannot write to a txt file -- that is what I have been using thus far with loadVars for importing values, but this will not help me here. I know it should be a fairly simple script -- I also know I ought to pick up php, but for the moment -- until a greater amount of time comes my way -- I turn to you.
View 3 Replies
Jan 11, 2010
I'm trying to change the colour of a movieclip.I want to send a variable from Javascript within the html that the swf will be embeded in.I'm not quite sure where to start with this but this is my code:
[code]...
View 3 Replies