ActionScript 2.0 :: Changing The Way A For Loop Counts?
Dec 21, 2006I know that
Code:
for (var i = 0; i<5; i++)
will loop through some script adding 1 to i until i equals 5
[code].....
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].....
I need some help understanding for loop and timers and what I want to do is set the timer so it counts. Every 3 seconds add 1 to the count and then call a function. If the count reaches 3 then reset every thing and start over. But it isn't working the way I want it too.
Code:
//create timer for slide show
var delay:uint = 3000;
var myTimer:Timer = new Timer(delay);
[code]....
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.
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]....
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];
}
Basically I have an array map and I want to be able to create a little bit of code that counts how many there are of each number in the map:
[Code]....
Currently there are 3 number 5s but this will change and I want to create a bit of code that can change with them amount of 5s in each map. Unfortunately I have no idea where to start, can anyone give me a hand?
All variables start offset by 1 (a=1, b+2, c+3, etc..)I want the values to all start over when they reach 7.You can see the lower half of code displays these images, basically rotating around a circle.What is most efficient way to script? I assume an array.
a += 1; if (a==7) {a=1};
b += 1; if (b==7) {b=1};
c += 1; if (c==7) {c=1};
[code]....
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 RepliesI understand the basics of reference counting but I am having trouble getting my head around one possibility. What happens while a class function/method is running - suppose the class instance removes the last reference to itself while executing - how does that get dealt with internally and is it dangerous? Perhaps while a class' function is running a temporary extra reference is held or else the garbage collector is otherwise not allowed to delete it.
e.g.
class Something
{
function DoSomething
[Code].....
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 RepliesOk I want to make a button that changes a text to count 21+ so lets say we have our button
Code:
button.onRelease = function()
{
[code].....
all my loading functions I got from a book and some other stuff too -- is it ok to use someone elses loading function.
View 2 RepliesI have this code for my timer, it counts down alright. BUT it is very buggy it most commonly counts down by 2 when it is meant to count down by one I have even watched my brother play our game and it went fron 20 to 7
Code:
var cur_timer = 180;function timer()
{
if (cur_timer > 0)[code]....
Is there a script that counts how many time a projector has been open?I'm looking to make a demo projector that can only open a project 1, 2 or 3 times.
View 1 Repliesin AS2 I used to use this kind of code to get certain items in a movie clip :
PHP Code:
for (var sItem in this) { // do something with this[sItem]}
How do I do similar things in AS3? I mean, how can I access this[sItem] in AS3?
Does anyone know how to create a numeric display that counts down the time of a flv. For example if the time of the clip is 60, as soon as the clip starts to play it counts down 59 and so on.
View 1 Repliestimer = int(80-(getTimer()-/:starttime)/1000);
if (Number(timer) == 0) {
with (_root) {
gotoAndPlay(70);
}
timer = 0;
}
Above is my code on a frame in a movie clip. The movie clip contains a dynamic text box that counts down. The variable name and the name of the clip is timer. when the timer reaches 0 it is supposed to go frame 70 which says sorry you did not make it, instead it goes to the frame that says congratulations... What am I doing wrong?
-Firstly can some one please explain what is meant by Object and Function in a profiling environment.
-Secondly, why does the Object and Function count increase when I repeatedly set the text property of a textfield:[code]
I need to make a ticker counter that starts from 0 - 0 rand and counts up for this portion of dialogue.
a commission of between R6,000 and R12,000 per month,
again depending on the amount of each person's
purchases.
200 customers gives you R15,000 to R30,000.
And 600 customers gives you a return of R50,000 to
R100,000. Per month.
When i use time varaible and then minus the time. Ive noticed that flash does not count down in seconds, but the speed of light. My maths are not very strong so how can i get flash to count in seconds
var time =60;
sprite.onEnterframe = function(){
time -=1; ( this counts faster than seconds)
}
How do I change the corner radius of a Label component in Flex. Tried applying style name, and the setStyle('cornerRadius',9) methods, but doesn't work. How can I change the arrow image in the combo box control to a different image?
View 4 RepliesI want to create another button on the main menu of my flash site. I want to take one of the existing buttons (which are set as movie clips) and modify it to show a different menu name and page link. BUT when I go into my library and "duplicate" my movie clip, change the instance name, drag it to the stage and attempt to modify it, the original changes as well. I need to keep the original the same and create a new one with the same code, frames, etc but with different static text. I keep going in circles
View 1 Repliesbasically when you load the .swf it changed everytime u re-load it , i want it to keep on changing even when the user hasnt reloaded the image
[Code]...
I would like to create a loop so the icons in the menu continually loop indefinitly.[code]
View 2 RepliesI am attempting to use a loop to create text field with the loop's current value. The code looks like this:
ActionScript Code:
for (var i = 1; i<=10; i++) {
var 'nameHolder'+[i]+'_txt':TLFTextField = new TLFTextField();
'nameHolder'+[i]+'_txt'.x = 40
'nameHolder'+[i]+'_txt'.y = 40
'nameHolder'+[i]+'_txt'.text = "Hello World"
}
So essentially what it should do is create 10 text fields at 40, 40 with the text: "Hello World".
i'm trying to do an infinate loop for my m.clip.the looping part does not want to loop...it loops back to my firrst frame even though there are two same picture in the movie clip.....here's a sample of what i use for the infinate loop script..
[Code]...
I have need of loops / nested loops that pick different figures depending on where you are in the loop. The whole function needs to run through 'ml' times. 'ml' is a dynamic figure. Loop 1 = While the loop is within the first 12 iterations, 'exconemp' must equal 100. For iterations 13 - 24, 'exconemp' must equal 102.5, for 25 - 36 it will be 105.06, for 37 - 48 it will be 107.69. This needs to change every 12th iteration until it has reached 'ml'. The calculation takes the value of the previous 'exconemp' and then multiplies that by 0.025.
Loop 2 = While the loop is within the first 120 iterations, 'abc' must equal 0.015 and any further iterations must use 0.01. This must also work in a way to figure out whether 'ml' is higher or lower than 120 and work accordingly. My main issue is this - how do I get the loops to run through as this: While the iteration is < 12, do this, THEN take the final figure (12th iteration) and start on 13 - 24, do this THEN etc etc. How do I produce a THEN statement? I can get the code to pick up the final values, but not change along the way.
[Code]...
Say, I had a loop in a function...
[Code]....
How would I refer to a in another function
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]....
Recently I'd been criticized for structuring my for loops like so:
var i:MovieClip;
for each(i in array)
{
[Code]....
This reads better for me personally, yet I'm being attacked for it. Is there any difference?