ActionScript 2.0 :: Incrementing A String Variable

Mar 15, 2012

I basically have a text file with a username variable that assigns usernames to username1, username2, and so on. I would like to create a loop that checks to see if that username was created and if it was a conditional statement will follow. The problem I have is I want to do a loop with a counter(var i) and increment that counter in the loop and concat that with loginName to input that into a dynamic textfield labeled loginName1. (Actionscript 2)[code]I am using loadvars to load 2 text files, one has username and ip(username1 = blahblah ipaddress1 = blahblah and so on), the second file has an array that has ipaddress and data usage passed in an array. i want to check how many usernames there are and check the ipaddress of that username against the other file containing ipaddresses and usage.) I have everything setup, but im running into issues when writing a loop to check for username1, username2, and so on.

View 2 Replies


Similar Posts:


Actionscript 3 :: Why Isn't Variable Incrementing

Feb 18, 2012

When the user presses the space bar, I'm trying to take one string from a series of strings labeled c1-c9, break it into an array, display that array, and then increment the linenumber variable at the end of the function so that the next time the space bar is pressed, the next string in the series is traced and so on and so forth. Here is the relevant section of script (the strings and the linenumber variable have been declared earlier)

[Code].....

Every time I press the space bar, though, I just get the traces of the initial string and linenumber value repeated without any incrementing. I think it may have something to do with the "this" before the bracket in this line var displayarray:Array = this["c" + linenumber].split(" "); which I found in a code sample on some website and do not understand at all, but I get compiler errors if I try to join the "c" and the line number without the "this" there.

View 1 Replies

ActionScript 3.0 :: Rotation And Incrementing Variable?

Sep 28, 2009

I'm working on a flash movie that involves the use of rotating 3 objects in a matter that the first one moves 18000 degrees cw according to the value in the 'num' variable. The 2nd object rotates -1800 degrees. The third one rotates 180 degrees.

What I actually want to do is create a movie of the older analogue electric meters that had the 5 dials that represented each digit so if the far right dial moved from 0 to 5 the 2nd would move the opposite way to be between 0 and 1 and the third a hair to the right of '0' and so on in increments of 1/10.

When I run the below code the dials ( I currently useing jetplanes until I draw or locate a pointer image file as well as the circle with 0-9 marked off in it) stay on 500 and should be moving a bit since I have another variable that increments num by 1. I tried using the Timer event and would get several errors. I also know that the way it runs now doesn't work since num is going to be assign the same value of 18000 since I have it setup to gotoAndPlay(1) in frame 2. How would I be able to have it so that so it would increment without getting undefined variables. I also tried a for loop to increment the num but the stage would instantly show the end result after the loop was done.

code
--------------
var num:Number = 18000;
var i:Number= 0;

[code]...

View 0 Replies

ActionScript 3.0 :: Incrementing Values To A Variable

Jun 17, 2011

i'm trying to add values to a variable.[code]a simple drag and drop on a MC.i would like to store the X displacement when i drag. let say i have 30 in a variable wich store x position of myMC, if i drag the MC 200 units the variable should read 230 and so on.

View 2 Replies

ActionScript 2.0 :: Incrementing A Variable With Buttons?

May 20, 2005

I've followed several tutorials on how to do this, but my dynamic text box always returns a value of "Nan" when I try to increment it's value.I've been trying to use Code:_root.total = _root.total + 1;] in an on release function. Even if i managed to get this to work though, I still need to reuse the variable i'm incrementing within other calculations.

View 2 Replies

ActionScript 2.0 :: TweenLite - Assign Incrementing Variable To AttachMovie

Aug 13, 2008

I have a script which places a clip on the stage (well, just off it), and rotates the clip and then tweens it to a certain x/y coordinate based on the rotation using TweenLite, and all of this on a setInterval of 2 milliseconds. That works well. Thing is, I don't seem to be able to set a unique name based on the clipname and an incrementing number. Basically (and this isn't the whole thing, this is just the general idea), it goes:

Code:
interval = setinterval("dothis", 2);
var increment=0;
function dothis(){
attachMovie(movieICall, "movieICall" + increment; 1)
movieICall._x = ;
_y= etc;
increment++;
}

So when I set the interval to 2 seconds, it moves everything well and there are no problems. When I set the interval to 2 milliseconds, the clips only get just onto the screen before disappearing. I've tried creating a function to handle the x,y, tween. So I could refer to the clip with a "this", but it doesn't change anything. The only thing I can think of is that movieICall is not incrementing, and every clip on the screen is being referred to as movieICall, in which case the next case of x, y, tweening overwrites that last one and effectively kills the last one (but then why is it not just left sitting on the screen)? I tried adding an overwrite: false to the end of the TweenLite, but that only let the tween happen once and then...nothing.

View 1 Replies

ActionScript 2.0 :: For Statement Using Incrementing Variable - Dynamic Names

Dec 10, 2004

I have a for statement, using an incrementing variable "a." A dynamic amount of herbs are generated, so here is the for statement.
Code:
for(a=1; a<_global.herbAmount+1; a++) {
var herbMC = _root["herb"+a];
trace(herbMC);
}
When I trace "a," it traces 1, 2, 3 or however many numbers there are up to the global herbAmount number. When I trace _root["herb"], _level0.herb pops out. When I add "a" onto _root["herb"], undefined is traced....why?

View 8 Replies

ActionScript 2.0 :: Resize Multi Objects Through Loop & Incrementing Variable?

Jan 5, 2009

if i wanted to modify the xy size properties of several pieces of media through a looping function and an incrementing variable how could i do it? resize multi objects through loop & incrementing variable

View 1 Replies

Flex :: Incrementing A Global Variable In A Function Which Is Called Multiple Times?

Oct 31, 2010

I am trying to make a simple mp3 player using flash. The songs are loaded using an XML file which contains the song list. The following code is inserted into a new keyframe.

import flash.media.Sound;
import flash.media.SoundChannel;
import flash.events.*;
import flash.events.MouseEvent;

[code]...

The problem over here is in the nextSong() function. I am unable to preserve the value of currentIndex. Although I am incrementing currentIndex every time the function is called, but the value remains unchanged.

View 1 Replies

ActionScript 2.0 :: Create A String Variable...and Then Use The Value Of That Variable To Declare Another Variable?

Jan 3, 2006

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".

View 6 Replies

String :: Flex - Download A String Variable As A File To The Local Machine?

Sep 21, 2011

I have a String variable in my flex (flash builder 4) application containing CSV data. I need to allow the user to download this data to a local file. For example, giving them a "csv" button to click and it might present them with a save file dialog (and I would be sending the contents of my string variable).Is this possible / how ?I am using the ResuableFX component for the datagrid to csv. This the code I ended up with that works to save the string to a text file for the user (in a web browser):

var dg2CSV:DataGrid2CSV = new DataGrid2CSV();
dg2CSV.includeHeader=true;
dg2CSV.target=adgEncounters;

[code]......

View 1 Replies

ActionScript 2.0 :: String Variables - Consentrate A String To Call That Variable?

Mar 16, 2002

If i have an ASP page that is returning variables (and I can see them in the debugger) how do i consentrate a string to call that variable?

ie:
variables being returned are named:
"res1", "res2", "res3"...etc
for (var i = 0; i < 10; i++) {

[Code]...

View 4 Replies

Regex :: Replace Portion Of String With A Variable String?

Feb 10, 2012

Trying to replace a portion of a string with a "-" if it matches a string variable in AS3.

var re:RegExp = new RegExp(imageArray[j][1],"gi"); trace(imageArray[jTemp][2].replace(re,"-"));

imageArray[jTemp][2] is a string imageArray[j][1] is a string as well I'm not getting the result I expect. I would like trace above to return 'permanentContainer-' Here are the traces for the above variables

permanentContainer-temporaryContainer- temporaryContainer

View 2 Replies

Actionscript 2 :: Function's Local Variable Through A Concatenated Variable String?

Mar 7, 2012

how you would target a function's local variable through a concatenated variable string.For example:

var txt = "Hello World";
function testing(msg) {
var test1 = msg;[code].........

I'd expect the trace to be "Hello World" but rather is given "undefined". So if variables created outside functions are created on the main timeline, where are local function variables created and how would you access them?

View 2 Replies

As3.0 :: Append A String To A Variable So Flash Reads It As A Variable?

Sep 27, 2010

i'm getting a value from a class that gives me e.g "icon1" as data. i want to use this within a function to control the visibility of an item nested in a movieclip on the stage. the nested movie has the same name as the data being sent.

// here's what i want it to do:
mymenu.icon1.visible = true;
// but i cant append the 2 together as flash will see it as a string not read it as path.

[Code]....

View 1 Replies

ActionScript 3.0 :: Change String Variable To A MovieClip Variable?

Oct 10, 2008

I have been banging my head against a brick wall regarding the following problem which must be very simple to fix, just can't see the answer.I have a class assigned to a movieclip called canvas. The class is called drawClass. I have called the instance of canvas on the stage 'drawingCanvas'.When I trace "drawingCanvas" I get object drawClass] which is fine. Tracing drawingCanvas.name gets me the instance name 'drawingCanvas'.This is a String variable.Basically what I am trying to do is pass the MovieClip name to another class. In my example the class 'toolBar', which can then interact with the MovieClip.

The problem is passing 'drawingCanvas.name' results in a String, so I get an error saying :TypeError: Error #1034: Type Coercion failed: cannot convert "canvasArea" to flash.display.MovieClip.I can't for love or money find a way to convert a String variable to a MovieClip variable! I have the name of the MovieClip, I just need to tell the toolbar class. But I can't find a way of doing this as the instance on stage is an object of drawingClass, not a MovieClip (unless MovieClips with attached classes are not treated as standard MovieClips?).

View 9 Replies

ActionScript 3.0 :: String Variable In Place Of Int Variable?

Jan 2, 2012

This is sort of difficult to explain but I'll do my best. I've got 6 score variables that go up over time.

[Code]...

Each corresponds to a different color of "Monster" class I reated. "GreenMonster", "BlueMonster", etc. are all custom classes. Each class has a string property called "MonsterColor". So "Blue1.MonsterColor = "Blue".

To save lines of code, and learn, I'm trying to use a local string variable to take the place of whichever of these 6 int variables I need. So inside a for loop, I've created a variable called "colorscore".

[Code]...

View 5 Replies

ActionScript 2.0 :: Use A String Variable To Instantiate A Variable

Jun 11, 2002

I would like to dinamically create array variables, depending on a XML file. The problem I have is that I don't know how to create them dinamically using a name I have constructed into a string variable. What I would like is something like this:

var strVarName;
...
strVarName = "Var" + i;
var strVarName = new Array();
...

So I would have n arrays called Var1, Var2, ... Varn.

View 1 Replies

ActionScript 2.0 :: Variable Name To String?

Sep 11, 2009

Is it possible to convert a given variable name to a string?

Code:
function vartostring(mystring:String) {
//something like var newstring:String = parsevarname(mystring)

[code].....

View 3 Replies

String Variable With GotoAndPlay?

Apr 8, 2009

I am trying to go about a "smarter" way of setting up multi paged full flash sites. This has got to be something very simple that i can't seem to put my finger on.

I'm trying to create a variable called 'currentScen' that i can declare off the start and change depending on what page the viewer goes to in the site.

I could put a bunch of 'if' statements saying that 'if the current page is this page then do this, if it's this page do this' etc. for each individual page but i thought there must be an easier way.

I am trying to get the following to work:

Code:

// declaring what the starting page is
var currentScen:String = "welcomeMovie";
//function fading in called page with animation used on the 'over' frame label
function animateOn(page:String) {

[Code].....

View 1 Replies

ActionScript 3 :: How To Get Name Of Variable In String

Sep 23, 2010

Example:
public var myVar:Object;
// now I want to get the myVar string
// myVar is not instanced*
public var whatINeedIsThisVar:String = 'myVar';

View 1 Replies

ActionScript 3.0 :: Act On Change In String Variable

Apr 7, 2009

What is the best way to listen for and trigger a function when a string stored in a variable changes? I have a variable named source which is a string. When its value changes I need to run a function newVideo. What's the most efficient way to detect the string has changed?

View 3 Replies

ActionScript 3.0 :: Compare String To A Variable Name?

Sep 9, 2009

Compare a string to a variable name. Is there anyway you can do that?[code]...

View 1 Replies

ActionScript 2.0 :: CS3 Variable String / Boolean

Nov 9, 2009

having an issue with a variable set. It is set as a string to default "no" on the very first frame of my movie, as follows:

var myaccess:String;
myaccess="no";

Within my movie, there is an object. When this object is pressed, it is to change the _root.myaccess="yes"; I am tracing the variable within the movie clip and it shows me: I do not understand why it is changing my string definitition from "no" to false. Because of this, my variable does not seem to change to "yes' on object (button) pressed.

View 1 Replies

ActionScript 2.0 :: String Variable In If Statement

Jan 22, 2010

I have a movie clip on the main timeline that includes a button.When pressed, I want this button to conduct an if statement to check the contents of a textbox on the main timeline and if equal execute the statement.So far I have this but the text does not seem to 'read'. Do I need to pass the textbox contents into a string variable rather than read directly from what is in teh text?[code]

View 2 Replies

ActionScript 3.0 :: Converting A String In To A Variable

Jul 14, 2009

I have a string that stores an object's instance name: var instName:String = e.target.name; and now I need to use its information to do something like this: instName.alpha = 0.3; but since it is a string it causes this error: 1119: Access of possibly undefined property alpha through a reference with static type String.

View 1 Replies

ActionScript 3.0 :: Variable To String Mapping?

Oct 13, 2009

I'm new to flash and working to embed the flash player in a .NET application. It's going "well" for the definition of "well" that adding the COM control and getting it to play a movie was easy and took about 3 minutes.What's not going well is that I cannot find documentation on the variable to string mapping used the SetParameter variable parameter. To coordinate between the apps, I want to be able to say: "flashPlayer.SetVariable("flash_variable", "value_to_set"). Obviously SetVariable does this. What's not obvious is how "flash_variable" is constructed.
 
For example, in the actionscript for a button called "OneBigButton" I have the following code:
 
OneBigButton.addEventListener( MouseEvent.CLICK, onClick );var testSetValue = "value";function onClick(evt:MouseEvent):void {    trace("got the click " + testSetValue);    outputText.text = testSetValue;}
 
When I try this:
 
flashPlayer.SetVariable( "testSetValue", "foo" );
 
The results do not get set in testSetValue.
 
I'd love a pointer to the documentation on how namespaces, class instances, etc affect the string construction used in SetVariable and GetVariable as I can't find it anywhere.

View 3 Replies

IDE :: Pass A String To A Function And Use Its Value As The Variable Name?

Dec 21, 2009

Is there any way that you can pass a string to a function and use its value as the variable name you wish to change. For example.

Code:
var text:String = "Goodbye World";
function myfunction ( varToChange)
{
varToChange = "Hello World";
}
myfunction("text")

View 2 Replies

ActionScript 3.0 :: Cast A String Into A Variable?

Apr 5, 2011

i have a list of items that get returned from a database.  the list is composed of strings. what i need to do is convert each item into a variable so that i can use each item as an array.
 
for instance, my array will look something like this: deviceArray = ["osx106", "osx107", "winxp", "win7"];
 
what i want to do is turn each item into its own array.  in AS2 (iirc) we had an eval() method.  that is no longer supported in AS3.

View 2 Replies

ActionScript 3.0 :: Combine A Variable With A String?

Apr 15, 2011

Im trying to combine a string with varible so that on function can control a variaty of elements, depending on which varible is chosen. Here is my code:

[Code]...

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved