ActionScript 2.0 :: Create A Variable That Concatenates Some Text With Loop Counter?
Dec 22, 2006I want to create a var that concatenates some text with my loop counter, this doesn't work:
[Code]....
I want to create a var that concatenates some text with my loop counter, this doesn't work:
[Code]....
I am just learning how to use Flash AS3. I have made a very basic animation that is a circle with a slice in it that grows larger over a couple of seconds until it is about a quarter of the size of the circle. It is designed for my research subjects to watch and follow for range of motion and speed as they complete a leg exercise task. I used a basic for loop in the animation to repeat it 10 times, then a frame appears that says "Set Complete." I would like to add a repetition counter to the screen so that subjects know which rep they are on throughout the animation. I know that I have to use a dynamic text box to do this, but I don't know where to put the script so that the new counter number will appear on the screen after each loop. Here is what I have so far for script:
Action Layer first frame of loop:
var count: Number=0;
Action Layer last frame of loop:
count++;
if(count<=9){
[code]....
I'm trying to create a "counter" element that uses a formatted dynamic text box to count up in .1 increments, starting from a specified value.[code]...
View 3 RepliesI'm trying to create a "counter" element that uses a formatted dynamic text box to count up in .1 increments 3 times a second, starting from a specified value (so viewer would see 3.1, then 3.2...etc.)
Here's the code so far:
var counter:Number;
counter = 3.0
counterText.text=(String(counter));
var timer:Timer = new Timer(300);
[Code]....
What I can't figure out is what should go in the function area, to add .1 seconds each time the timer cycles.
I 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 need to set a variable and create a loop with this to optimize.I can get it to trace what I want, but the code isn't working properly.
mainAccordion.s1.menu_btn1._alpha = 90;
mainAccordion.s1.menu_btn2._alpha = 90;
mainAccordion.s1.menu_btn3._alpha = 90;[code]....
I wished to create multiple copies of a variable in a loop.such as:
var pots:String = thisString [i]
and then i wish to reference one of these loop generated variables.Now how would you set it up so you could have all those variables of "pots" had their own names so one could reference say: "pots1" "pots2" or "pots17" ? This kind of situation would bee seen in a situation where I would be bringing in many array values and assigning certain parts of them to the variables. such as array[i][name]
I need to make a loop that can create (and use) incremented variable names. Basically I need to dynamically create a certain number of sprites and datagrids then I need to add these dynamically created datagrids and sprites to the stage. So the static code (which works, but I think is NOT the right way to go) would look something like this (I'm leaving out a bunch of stuff but this should give you the right idea):
[Code]....
But I can't figure out the syntax and how to make it work... This MUST be possible! My knowledge is pretty thin in actionscript,
so I have a class method that contains a for loop ... however, each time I call the class method, the for loop counter continues to count from where it left off! Agh - the loop counter get's reset?
[Code]...
I've seen similar threads but couldn't find one with the exact same issue. I've a PDF / Word document with arabic copy when I try pasting that text in flash all the joined letters start appearing as individual letters.I've tried the dynamic text box solution in which you create a dynamic text box and assign the text to its variable that doesn't work. But strangely when you write arabic in dynamic text box (with out assigning the text to the variable) and double click to select the text box and its content the text starts appearing fine .. but when published its again all individual letter.
View 1 RepliesI'm working on a simple todo app that has a column for each day of the week. On startup, the app checks to see if there are any incomplete tasks from before the current date. If so, they're moved to the top of the current date's column. The app is cloud-based, but the tasks are backed up for offline mode with an SQLite db. I can easily move the tasks by updating their date property, but I need the order property of each task to increment starting at 0 to place them at the top. I need to be able to define a count variable in SQLite alone and increment it with each update that's performed. I know this code doesn't work, but it's an easy way of explaining what needs to be done:
[Code]....
I want to create a counter that will take the number I put in a text file and display it......not sure how to do this.
View 3 Replieslooking for a way to create a counter. It needs to count from 0 - 1,000,000,000 at a speed of 45 counts per second. Can someone please give me a code or a webpage I can work with?
View 1 RepliesI need a counter to tick off 9 times per second....and it continually adds up weather you are on the site or not.
View 1 RepliesI've got an animation that plays, and then at the end of the timeline plays a movieclip. This movieclip displays a piece of text, which is extracted from an XML file, the piece of text is selected at random currently out of a list.
Then when the clip is pressed (button), it goes back to the previous timeline, and then plays through again, including the movieclip, and now a new piece of text is picked at random and displayed.I now want to make the pieces of text display sequentially, but am having some trouble.
put in a counter, and the text that is displayed from the array corresponds with the number on the counter, unfortunately, this gets wiped every time it plays, because the counter gets remade. Is there any way to create a variable outside of the timeline maybe, in a actionscript file maybe, so that I can just add to this. I have been running a trace, and can't seem to get it to not wipe.
I want to import a new image ever 5 seconds but how can I increment the counter variable from within the function?
PHP Code:
count=0;
function loadimage(count) {
trace(count);
[Code]....
i'm trying to create a flash counter.each time the movie clip is loaded, it loads an external variable (number of seconds).so lets say the variable is:
secondsToEnd = 260;
the timer will be working until it gets to zero, then the movie clip will go to frame number 2.after a refresh of the page, the "banner" will check again for a new xml variable. creating the counter (after receiving the variable secondsToEnd) till it gets to zero.
I'm trying to syncronize an audio and some text by highlighting it. In the main movie I have counter variable which calls charCounter3.as and timeVars variable which calls timeSettings.as I have onEnterFrame function that highlights the text while sound is playing.
My code is:
function onEnterFrame(e:Event):void {
pos=soundChannel.position;
var minutes:uint=Math.floor(soundChannel.position/1000/60);
var seconds:uint=Math.floor(soundChannel.position/1000)%60;
debug_txt.text='position: '+pos;
[Code] .....
Highlighted text needs to be updated on audio forwards and backwards. I think onEnterFrame isn't being able to catch the timeArr values.
I want when someone clicks the prev_btn for it to load imageCounter-1".jpg", but I do not know how to propperly code this. Also, is there a way to have a fixed positon for the loader's Y and also have it's X centered? The images are all the side hieht, but the widths are different.[code]
View 7 RepliesI am using the attachMovie script in as2 and I want to use a counter variable to increase the depth each time so it doesn't replace the last one. Every tutorial i've seen for attachMovie mentions this but I can't find any information on how.
Also is it possible to use a different counter variable to change to y position of the attached movieclip, so that it adds another beneath the last every time.
I am making a game that utilizes a keypress to play a movie clip. It runs perfectly but I am trying to add to the script. After twenty key presses play a different movie.In case that doesn't make sense this is a little more in depth description, The game is a boxing game and when Key "0" is pressed a movie clip plays(showing the boxer punching) that part is fine. I am trying to have it to where after Key "0" is pressed 20 times, it will que a movie clip to kick in(the boxer that is being punched will fall down).
View 2 RepliesI am wondering how to create a basic flash counter.
As in, when something happens, I want a variable to equal 1, and then, if something else happens, I want that same variable to then be 2.
Etc .etc.
I think there is something to do with ++ , but I'm unclear about the syntax.
i am trying to create a hit counter in the background of a flash application. However, i can't seeem to get the code in flash correct to access the php script.
Flash Code:
Code:
_root.checklot=0;
setInterval(check,1)
function check() {
[Code].....
So i have an external text file organized like this:
/* $file: data.txt */
&title0=Sacrum
&detail0=Detail text for Sacrum
&title1=L5
[Code].....
There are 28 of these 'title' and 'detail' pairs. The 'title' text is to fill a dynamic text box and the 'detail' to fill another dynamic text box depending on which section the user is mousing over.
My issue is getting the text from the file stored into arrays. For my test loop I keep getting undefined as the stored value, and i know it has something to do with converting a string value to object..
var lv:LoadVars = new LoadVars();
lv.onLoad = handleDataLoad;
lv.load('data.txt');
function handleDataLoad (success:Boolean) {
[Code]....
I would like to create a loop so the icons in the menu continually loop indefinitly.[code]
View 2 RepliesI'm using a hit counter according to this tutorial (http:url...)I'd like to have a text field with htmlText = "blablabla" + count;
but honestyl i can't get it done.
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]....
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]....
f you know PHP...then you know that you can create a string variable...and then use the value of that variable to declare another variable. like this:
PHP Code:
<?php$foo = "haha";$i{$foo} = "success";print $i{haha};?>
and it would display "success"...or like this:
PHP Code:
<?php$foo = "haha";$$foo = "success";print $haha;?>
and it would also display "success".
I am trying to increment a counter by one digit if a window (called searchItem_txt) contains text for more than five seconds. The code below activates the counter after five seconds but it keeps on incrementing until the count has reached 63.
[Code]...