ActionScript 2.0 :: Cannot Get Number From Variable
Mar 31, 2008
So I have a variable decalred as a number like this:
Code:
function foo(index:Number) {
index = 1;
..}
[Code]....
I am pulling my hair out, as it is standing in the way of me completing a project.
View 3 Replies
Similar Posts:
Sep 18, 2005
lets say that when you click on a button the variable number goes up 1 or 2 but it picks it randomly
how would i do it
[Code]...
View 8 Replies
Feb 20, 2008
i have a project and i need that when a specific variable equals a specific value a random number decreases on the current number, its easy to make it decrease but i need to decrease instead of 4 to decrease a maximun of 5 and minimun of 3.ere is the code :
Code:
numeroDeTazos = 20;
quantidade.text = numeroDeTazos;
if (nrfinal2 == 33)
{
[code]....
View 1 Replies
Mar 7, 2012
Im having an unusual problem tracking the value of a number variable....I have a number stored in a variable that changes up and down from 0 to 1 i.e. 0, 0.1, 0.2, etc, etc. This variable serves as an audio volume that is used with the soundTransform class.Im using the .text property for a text box:
ActionScript Code:
trackVolText_txt.text = Math.floor(_trackVolumes[1] * 10).toString();
And here is my volume down code, there is a volume up section that does the same job but reverse:
ActionScript Code:
function volumeDown(e:MouseEvent):void
{
if(_trackVolumes[1] < 1)[code].....
If I manually type in "10" in the text box to represent full volume so as soon as the .swf file loads it says "10" in the text box, I only get the readings: 10, 1 and 0. If I leave the text box blank, it will then increment and decrement 10,9,8,7,6,etc,etc.
My question is: can I somehow have a value manually typed into the dynamic text box without the above problem happening?
View 1 Replies
Jun 7, 2010
i have something like this in the frame:
var number1 = 10
var number2 = 10
And in the stage i have 3 dynamic text boxes. The 1 one has the variable number1 the secound one has the variable number2. But how do i do so in the third box it says 20? I want it to substract number1 and number 2 and show that in the box.
View 1 Replies
Mar 3, 2010
I create game matching things. If icon 1 == icon 2 then i delete this icons. Player finish game when he match all icons. I try give points for correct unswers. And try to calculate this poits.
code:
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
[Code].....
View 2 Replies
Feb 6, 2009
Let's say i want to removeChild a movie clip instanced name: mcLife3 But instead of doing the correct: Code: removeChild(mcLife3); I need to use another Number variable called bonusLife which in this case = 3 Code: removeChild(mcLife[bonusLife]); Doesnt work...can anyone please let me know the correct syntax,
View 6 Replies
Jul 28, 2009
I have made a variable and am trying to store it as a number that the user enters from an input text field. I am trying this, but it does not work:
var myNumber:Number = myTextField.text;
when i trace myNumber, it comes out blank. How do i get the variable to be the number that is typed in the myTextField?
View 9 Replies
Jan 9, 2010
Im trying to do a hittest on a random movieclip... basically i have 4 'objects' and i am picking a random number to pick one of them... this is all fine except when i try to do a hittest on 'object' + randomNum...Below is the code that works first with a trace that is kicking out the name i want, and below is the code ive tried but doesnt work...
Code:
var randomNum:Number;
randomNum = Math.round(Math.random()*3)+1;[code].......
View 2 Replies
May 1, 2011
I'm trying to find the answer to make appears a "000" value (with all three "0"s) and I can not find any answer around books/internet.var nPoints:Number= 000;trace(nPoints);In this way we only receive "0".
View 5 Replies
Oct 24, 2006
I have this to build my nav;
Code:
// navigation
var picNum:Number = 3;
for (var i = 1; i<=picNum; i++) {
_root.nav["btn"+i].topText_mc.text = [i];
_root.nav["btn"+i].alphaTo(30, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
}
My XML:
What I want is to get this trace(parseFloat(i)); to be my picNum variable. Tried a bunch of different things but none worked. Maybe someone here knows?
Code:
var pArray = new Array();
var tArray = new Array();
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function (success:Boolean):Void {
[Code] .....
View 4 Replies
Nov 20, 2007
I'm trying to concatenate a name and variable number. Then trace it, so answer3 should output from my loaded xml data "water". Instead all I can get to trace is the word "answer3". If I type "answer3" in the trace I get the variable im looking for. If I type [this.getCorrectAnswerNumber()] in the trace I get number 3. How do I go about concatinating the word answer and a dynamic number.
Heres my code...
Code:
trace("answer"+[this.getCorrectAnswerNumber()]);
View 7 Replies
Aug 29, 2009
Once you load up your xml, how can you convert a certain node into a number variable?
View 2 Replies
Oct 30, 2009
Im running AS2 on Flash CS4 for this: I've found a million posts on similar topics, but none seem to do what I want, even though I feel like its very simple. I've tried a ton of different codes and can't get anything to work. All I want is for Flash to pull a number variable from an external file, lets just say a txt for now. I then want to be able to use this variable for calculations within flash. The only thing I can get to semi-work is having a txt file that says MyNum=5 and then putting the following in flash: loadVariables("Test.txt" , _root);
If I trace the variable "MyNum" it will output the right value, but its as a string no matter what I do. My most recent attempt to get it to be a number is to put the following on a later frame:
var NewVar:Number = MyNum;
var NewVar2:Number = NewVar + 1
trace(NewVar2);
Despite hardcoding multiple variables to be numbers, the output I get is 51, which means its still displaying as a string. My other issue is that you have to wait several frames before the variable is recognized. Do you have to wait numerous frames to use these loaded variables? If so, is there a way I can code it so that flash will just wait until it has the variable before moving on? I can't seem to get any loading function to work for it, but I don't just want to pull my next action down the timeline some arbitrary number of frames and hope its enough for flash to pull that number from the file.
View 10 Replies
May 30, 2010
So what I have here is a button that will take away a random number from a variable (in this case being money) this is nothing more than a learning experience and I just wish to broaden my horizons on flash AS.
Actionscript Code:
on (release) { money -= random(200); }on (release) {gotoAndPlay (2);}
While this code works just fine the only problem i have with it is that it will select a number from (0-200). Is there a way I can set this up to select a random number BETWEEN 2 numbers? EX: (150-200)
View 3 Replies
Feb 18, 2003
I'm trying to duplicate a movie clip when a variable reaches a certain number.. this is the code I used...
if (numBlts<300) {
_root.power = 1;
_root.p += 1;
duplicateMovieClip(_root.plus, "plus"+p, p);
}
The problem is that I just want to duplicate it once everytime numBlts gets below 300. After numBlts increases above 300 and then goes below 300 I want the clip to duplicate. All its doing now is duplicating infinite times...
View 1 Replies
Nov 2, 2004
im importing a few variables with this [code]but now how do i make a variable say root.cash into a a number which can be used in equations or used for logical compariosons such as < > ==
View 2 Replies
Apr 15, 2006
So I load a variable, length, into a LoadVars instance.
Code:
trace(this.length); //outputs 3
var tempLength:Number = this.length; //tempLength should be the number representation of the loaded value
thisObj.buttonLength = tempLength+2; //I need to add 2 onto the this.length value
trace(thisObj.buttonLength); //outputs 32, which kind of makes sense, but I need it to output 5.
thisObj.buttonLength is declared as a number, and Flash does not output a type mismatch.
View 3 Replies
Jun 12, 2006
Does anyone know, how to count the number of characters in a variable ?[code]...
View 2 Replies
Jul 29, 2007
Is there a way to get Flash to know what frame it's on and pass that as a variable? I can't use counters because I'm using a random frame function.
View 3 Replies
Jun 9, 2009
Is there a piece of code to test if a varibale is a full number?
[Code]...
View 6 Replies
Aug 10, 2009
I have several objects referencing one value in a number, and I need to tween this number but I cant figure out how.I'll use whatever, the built in tweens or tweener or anything.I cant figure out how to reference the value of the variable, since its not a display object and you cant just say myDisObj.y or something like that.If theres no way to do this i'll just have all of the display objects reference from one's property.
View 4 Replies
Aug 20, 2009
the variable Im interested in is numSound which at the moment is a random number between 1 and 5, but it repeats too much and a sequence would be fine. I know very little actionscript and nothing I have tried works,the code, or what seems the relevant code, is
Code:
private function randRange(min:Number, max:Number):Number
{
[code].....
View 2 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
Oct 5, 2009
i want to center some dynamic numbers in a circle... but of course it won't align properly when there a more digits. So i need to know how many digits there are in order to offset the numbers to center.
View 3 Replies
Oct 23, 2009
I have some data stored in an XML. The XML node has an unknown number of attributes. I want to cycle through the attributes and add them to an array.my current thoughts are to have somthing like this
XML:
Code:
<X>
[code]......
View 3 Replies
Jan 8, 2011
Need to send a user to different frames depending on a number input into a text field. Here is what I have, but regardless of number, it send them to Frame 20. New to AS and having a tough time figuring this out.
var HDLrange:int = int(enterRange_txt.text);
enterRange_btn.addEventListener(MouseEvent.CLICK, onClick);
function onClick(event:MouseEvent):void
[code]......
View 4 Replies
Nov 2, 2004
im importing a few variables with this
Code:
myVars = new LoadVars();
myVars.load("getinfo.php?user1="+userN+"&pass45="+passN+"&random="+refresh1,"0");
[code]......
View 2 Replies
Apr 2, 2009
[Code].....
What's the proper way to write this line so I can replace the "j" variable with a number and be able to call up the proper mc (i.e. product1_mc)?
View 5 Replies
May 24, 2010
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.
View 2 Replies