Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Flash Number() NaN Problem



Does anyone know why this:

myData = new LoadVars();
myData.onLoad = function()
{

var bbbgames = this.numbbbgames;
var loadstatus = this.loadstatus;

if (loadstatus="loaded")
{
var thebbbgames = Number(bbbgames);
trace(thebbbgames);
}

else
{
gotoAndPlay(11); // Current Frame
}

};
myData.load("myData.txt");


gives me a NaN result? The text file is:


&numbbbgames=2
&loadstatus=loaded


How do you convert the loaded variables to a number if this doesn't work?



ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 12-26-2006, 09:51 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Shared Object To Store A Unique Id Number Var And Frame Number Var
Hi, I am a complete novice to action script when it comes to objects. I know what I want to do is done with the shared object. Basically I want to create a tutorial that stores a cookie on the users’ machine with a unique id variable telling flash what frame the user was at last. When the user revisits it would prompt "continue where left off or start the tutorial over. I read the action script dictionary regarding the shared object, but being a designer I really need to visualize it before I can comprehend this.

Thanks,

Justin

Limmiting A Number To A Certian Number Of Decimal Places
Ok for a currency i have

gold.silver which is the same as say 1.35g with 'g' being gold

When I calculate with tax it often goes to 10 decimal places. How do I limmit the amount of decimal places that it can access?

Random Number Then Delete Number Till Reset
Last edited by pixcels : 2006-10-18 at 22:41.
























I am trying to create a type of quiz thing. It is a stand alone move and can not have anything loaded into it.

Problem:
I need a random item from an array, then after the item is displayed I need it to delete itself so that it will not show again. After the array is down to the last item it calls in the array again and starts all over.

Below is code that I have found but it does not delete the array item after it has been show from the array, or restart.


Code:
Array.prototype.shuffle = function() {
var shuffledArray = [];
var copyArray = this.slice(0);
for (var j = 0; j<this.length; j++) {
randomNo = Math.floor(Math.random()*copyArray.length);
shuffledArray[j] = copyArray[randomNo];
copyArray.splice(randomNo, 1);
}
return shuffledArray;
};
testArray = ["1", "2", "3", "4", "5", "6", "7"];
newArray = testArray.shuffle();
//Text area component
theText.text = "newArray = "+newArray
//Button component
theBtn.onRelease = function(){
newArray = testArray.shuffle();
var tempArray = Math.floor(Math.random()*testArray.length)
var totalArray = Math.floor(tempArray+=newArray[0])
var slicedArrary = tempArray.splice(0)
theText.text = "newArray = "+newArray[0]
}

AS2 - Image Set Number Of Rows/dynamic Colum Number
I have a simple image gallery that is loading images in, creating movieclips, and then lining them up into 3 columns and rows. This woks fine as long as there is only 9 images, but I have more then that. If I have it pull more then the 9 it adds in more rows I need it to add in more columns no more rows.

Here is the function that creates the gallery:
title_array is the array of images.

Code:
function createGallery() {
nbrColumns =2;
leftMargin = 7;
topMargin = 5;
cellWidth = 165;
cellHeight = 165;
//thumbnails.setMask(albumHolder.albumHolderMask);
for (i=0; i<title_array.length; i++) {
thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
var cellX = i % nbrColumns;
var cellY = Math.floor(i / nbrColumns);
thumbHolder._x = leftMargin + cellX * cellWidth;
thumbHolder._y = topMargin + cellY * cellHeight;
thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 0);
thumbLoader.loadMovie(title_array[i]);
}
}

Script To Change Number To Formated Number
Hi, is there a free script to change a number to formated number (u know with dots and commas)
I know I probably can make my own.. but.. i'm in a hurry
thanks

Round Number To Next Number That Has Only Zeros Behind It (ie: 20, 100, 3000)
I want to make a graph and I want the highest number in the graph to be a solid figured number.

so if the highest part that needs to be graphed is 12,000 I want the graph to go up to 20,000 ( the next highest number with only zeros behind it.)


for instance I want to round:
11 to 20
253.3454 to 300
4500001 to 5000000


I am sure I neet to use Math.Ceil() in combination with something else but I am unsure how?

any suggestions?

THANKS!

Random Number Variable That's Different From Previous Number
I have this line of code in my game that works great. However it would work even better if when it the code was executed the next random number was not the same as the one before it. For example if "speech" is on frame 6 when the code is executed I would like the random number to be between 2 and 12 but not 6. (I don't want the same frame to come up as it confuses the kindergarteners and preschoolers using the program.) Here's the code that's working for me now.


ActionScript Code:
speech.gotoAndStop(Math.floor(Math.random()*11)+2);

Need Urgent Help How To Check If The Generated Number Is A Whole Number
Hi,
I have a simple issue but I need some assistance. I am calculating a number and the result number sometimes a whole number but in some cases decimals are present. Decimals do not need change but whole numbers need to change. So for example if the end result is "6" I need it to show it as "6.0" in a field beacuse that is the way the calculator should display it according to request.
How can I check that the result number is a whole number and then add ".0" to it?
I just included a simple script below.

if (outputnumber == ?) {
resultNum = Number(String(outputnumber+".0"));
} else {
resultNum = outputnumber;
}

Thanks,
Attila

Method To Check If A Number Is A Decimal Number?
i was wondering if there is any method to check if a number is a decimal number or not? i searched in the help-panel, but didn't found something...please help!

TextField - Number Of Lines, Number Of Characters
Hello,

I'm trying to get some insight on the textField object in flash.

I know how to get the textfield length and number of characters. But I need to know more.

Is there a way to get the number of characters on a line in a multiline textfield?

Thank you in advance.

Decimal Number To Binary Number ?
In ActionScript, I can use parseInt to convert binary num to decimal number. But how can I convert decimal number to binary number? I try find in AS dictionary but there isn't result.
I have an input textfield to enter the decimal number, and an other to display the binary number.
Please tell me how...Thx U,

Variable Number = Frame Number#$%@&*
I have a movie Clip called “percentage bar” and a variable text box called “percentage”.
Now I get a number from VB and this number is = to the value of ”percentage” (my variable txt box).
The Movie Clip has a 100 frames… here it comes I need to have whatever the variable number (“percentage”) is to determine which frame the movie clip (“percentage bar”) is standing on.

This has to be possible, don’t it?

Help Can't Convert String To Number With Number()
I'm pulling variables from an XML file and need to convert the strings from the XML to numbers. So, I have the following actionscript:


Code:
thisPC_Price = aPrice[0].stringValue();
trace(thisPC_Price);
trace(Number(thisPC_Price));
The first trace returns 100, which is the contents of the string (it's also treated like a string by the AS and if I try and do anything to it it will return NaN, as it should). The 2nd trace action returns NaN ..... and I have no idea why.

Anyone have any ideas?

Variable Number = Frame Number ?
Here's an easy one for anyone who knows actionscript...
I have a variable text box called "percentage" and a movieClip called "progressbar" (100 frames).
I want the number in my variable txt box "percentage" to tell "progressbar" to go to the corresponding frame number.
for instance if the number in the txt box is 15 the movieclip has to go to frame 15.

Thanks
- a Designer, forced to be a programmer.

Flash 5 Yes 5 Number 5
i am looking for a demo or trial of flash 5.0
where can i find this elusive program?

Number Of MCs In A Flash Movie
Let me ask you guys a question. Say I have a stage, and I want it filled with white dots to represent stars. Now, I can duplicate 1 MC of a white dot about 200 times, and it'll fill up the screen, not to mention that it'll be random on each visit. But does is this computer intensive? I look at my file, and it's only 1kb, but I know that the computer just generated 200 stars for me. An alternative would be to use a .jpg background, but that's just so static and lame. So can you guys tell me how computer intensive it is? And what are your suggestions?

Riki

FLASH 5 How Do I Set The Variable Number?
how do i set the variable number so it will stop when it hits zero? this will be used in a game i am making, and i need it for ammunitional purposes. thanks.

String To Number Flash MX
how do you to turn a string into a number so numerical calculations can be performed on the original string. i know about toString() i want to go the other way around

numberString = "102";
trace(numberString+20);

retruns -- 10220 !!!

i want it to return 122

Flash MX Version Number?
can anyone tell me the last version number of Flash MX (not 2004) Was it ever updated to 6.0.1? or similar?

I can't seem to find an updater anywhere, it couldn't have been a release that needed no updates could it? unheard of!

thanks

Number Problem With Flash MX
HI,

I was working on a simple animation of a number counting from 0.01 to 1.00, with some code and a textfield.

It seemed all good, until flash produced a profound mathematical error and got the addition wrong.

http://www.gianteraser.orcon.net.nz/numberIncrement.htm

here is the link of the result, notice how after 0.8 it is slightly above and after 2.3 it is slightly below what it should be.

I have used a var and it is incremented by 0.01 each time the clip loops. I assume I need to use a floating point variable or some sort, but I havnt seen this in flash, is there a way of using a float in flash?

perhaps I should just Maths.round the variable up, or truncate it, but that seems like a workaround, and maybe theres a better way.,

Cheerz for any help,
Dwayne

Need Flash Mx Serial Number
can anyone send me a serial number for flash mx (not for mx 2004, only mx)

Flash Number Problem?
This bit of code below is working fine and is ment to simulate someone entering a telephone number via the keypad (into input text box called tel)which then sends you to frame in the main timeline, however if any of the numbers (in red) is changed to an 8 or a 9 it comes up with lots of errors which make no sense. Even my lecturers can't explane it, is it a bug in flash 8?

onClipEvent (enterFrame) {
if (Key.isDown(101) && _root.tel.text.length >= 11 && _root.tel.text == 04532345675){
_root.gotoAndStop("image1");
}
}

[F8] Flash Is Forcing Value To Even Number
Hi,

I have created a horizontal slider Bar..and the fundamentals of it work properly... as you slide it, it displays a value between 1-100 in a text field... my problem is that if I stop dragging on an even number, i.e. 59, when I move my mouse after that it bumps the number up to the next even number.. i.e 59 goes to 60.

I am using 'onMouseMove' to track the position of the slider bar and update the value, so I am wondering if that is causing it... since if I just stop dragging and don't move my mouse afterwards, it will stay on the even #..but as soon as I move it, it rounds it up to an even number.

Any ideas?

My code is below, as well as my .fla attached.

Thanks!
-b.


Code:
stop();

//init slider Position/value
this.knob_mc._x=_root.currentClip._xscale;
_root.scaleControl_mc.scale_txt.text=this.knob_mc._x;

this.knob_mc.onPress = function(){
this.startDrag(false, _root.scaleControl_mc.slider_mc.groove_mc._x, _root.scaleControl_mc.slider_mc.knob_mc._y, _root.scaleControl_mc.slider_mc.groove_mc._x + 100, _root.scaleControl_mc.slider_mc.knob_mc._y);
};

this.knob_mc.onRelease = function(){
stopDrag();
trace(_root.val);
play();
};

this.knob_mc.onReleaseOutside = function(){
this.stopDrag();
play();
}


this.knob_mc.onMouseMove = function(){
var myPoint:Object = new Object();
myPoint.x = this._x;
myPoint.y = this._y;
_root.globalToLocal(myPoint);

//_root.val=Math.floor(myPoint.x);
_root.val=myPoint.x;
trace("value = " + _root.val);

_root.outterMC._xscale=_root.val;
_root.outterMC._yscale=_root.val;
//_root.currentClip._xscale=_root.val;
//_root.currentClip._yscale=_root.val;

_root.scaleControl_mc.scale_txt.text="" + _root.val;
}

Flash Read IP-number
Can Flash read the computers IP-number?

Flash Number Generators
Question,

I am creating an animation for an assignment and need help on how to create random numbers but then also have a generator which adds them.

For example on the click of a button 1 + 2 are generated but then have an output somewhere on the screen where that will be equal to 3.

How T Oround Up Number In Flash?
How would you make actionscript round up a number (ex. 1.4 to 2 or 0.399 to 1). Thanks.

XML And Flash // Object Or Number?
I am pretty good with actionscript. But, this is getting me.

ok, when I trace a certain variable:

trace(numButtons) Display: 12 (which is getting it's value from a node in an xml document)

However, when I do:
trace(typeof numButtons) it gives me an Object.

How come I'm tracing a number but when I "typeof" it, I get an Object. The problem is, I can't use this variable as a subsitute for my number and it's messing up my functions.

Flash Frame Number
I dont know if it sound stupid if i ask this kind of question as i really dont know how to address frame number

below is the code, i have movie clip, i set a condition tat if apple equal true and also if the movie clip inside the movieclipball's frame reach frame 25, the movie will play.

but how do u address the frame? ball.frame?

if(apple == true && ball.frame==25){
this.play();
}

thxs

Flash Is Forcing Value To Even Number
Hi,

I have created a horizontal slider Bar..and the fundamentals of it work properly... as you slide it, it displays a value between 1-100 in a text field... my problem is that if I stop dragging on an even number, i.e. 59, when I move my mouse after that it bumps the number up to the next even number.. i.e 59 goes to 60.

I am using 'onMouseMove' to track the position of the slider bar and update the value, so I am wondering if that is causing it... since if I just stop dragging and don't move my mouse afterwards, it will stay on the even #..but as soon as I move it, it rounds it up to an even number.

Any ideas?

My code is below, as well as my .fla attached.

Thanks!
-b.


Code:
stop();

//init slider Position/value
this.knob_mc._x=_root.currentClip._xscale;
_root.scaleControl_mc.scale_txt.text=this.knob_mc._x;

this.knob_mc.onPress = function(){
this.startDrag(false, _root.scaleControl_mc.slider_mc.groove_mc._x, _root.scaleControl_mc.slider_mc.knob_mc._y, _root.scaleControl_mc.slider_mc.groove_mc._x + 100, _root.scaleControl_mc.slider_mc.knob_mc._y);
};

this.knob_mc.onRelease = function(){
stopDrag();
trace(_root.val);
play();
};

this.knob_mc.onReleaseOutside = function(){
this.stopDrag();
play();
}


this.knob_mc.onMouseMove = function(){
var myPoint:Object = new Object();
myPoint.x = this._x;
myPoint.y = this._y;
_root.globalToLocal(myPoint);

//_root.val=Math.floor(myPoint.x);
_root.val=myPoint.x;
trace("value = " + _root.val);

_root.outterMC._xscale=_root.val;
_root.outterMC._yscale=_root.val;
//_root.currentClip._xscale=_root.val;
//_root.currentClip._yscale=_root.val;

_root.scaleControl_mc.scale_txt.text="" + _root.val;
}

XML And Flash // Object Or Number?
I am pretty good with actionscript. But, this is getting me.

ok, when I trace a certain variable:

trace(numButtons) Display: 12 (which is getting it's value from a node in an xml document)

However, when I do:
trace(typeof numButtons) it gives me an Object.

How come I'm tracing a number but when I "typeof" it, I get an Object. The problem is, I can't use this variable as a subsitute for my number and it's messing up my functions.

Flash Number System Bug
trace(10.2 - 10);

I get 0.199999999999999 and so do a few other people i ask.

Anyone else noticed that

Formatting Number Is Flash CS3
Hi All;

I am trying to figure out how to format number returns in FLash CS3.

I am performing some calculations using the Math Class and when I type cast the numbers back into text fields I would like them to display as Dollars and Cents. Right now I am getting a large string of numbers to the right of the decimal place and I would like to limit that to 2 numbers.

I have looked all over and have not found a way to format the returns of those numbers. Any help would be greatly appreciated.

Thanks

Flash Number() NaN Problem
Does anyone know why this:

myData = new LoadVars();
myData.onLoad = function()
{

var bbbgames = this.numbbbgames;
var loadstatus = this.loadstatus;

if (loadstatus="loaded")
{
var thebbbgames = Number(bbbgames);
trace(thebbbgames);
}

else
{
gotoAndPlay(11); // Current Frame
}

};
myData.load("myData.txt");


gives me a NaN result? The text file is:


&numbbbgames=2
&loadstatus=loaded


How do you convert the loaded variables to a number if this doesn't work?

How To Transform String To Number In Flash?
could anyone tell me,how can i transform my string"123" to number123,which is loaded from a .txt text? i did it with "Number" but get nothing

How To Convert A String To Number In Flash
Do anybody know how to convert a string to number in flash.Any help will be appreciated.

Getting Flash To Wait A Set Number Of Seconds
does anybody know how to make flash wait a set number of seconds, without using the timeline?
i'm pretty sure in javascript you can tell it something like:
wait(3000);

but how do you do this is flash? i haven't been able to find anything like the wait command... do you have to use getTimer()?
i am using flash 5.
any help is greatly appreciated. thanks in advance.

-jlatg

Do You Want A FLASH MX 2004 Serial Number?
FLASH SERIAL NUMBER HERE


HAHA, please answer the poll in relation to what you were thinking when you came to this post

Flash 4 To 5/mx Converstion - Avoid Number()
When opening flash 4 files into 5 or MX, Flash performs the autmated conversion. Is there any way to avoid/strip the adition of Number() to the script. It gives a lot of 'garbage' and is unnessesary in scripts I use.

If i'm correct Flash does not use a seperate system file when reading in when opening a flash 4 file, does it? (if it would, maybe that file could be adjusted)

Alternatively, maybe somebody knows if a resource editor/hacker could strip the addition of Number() to the script.. anybody?

I have about 150 to 200 files to convert with about 10 scriptframes each... it adds up hugely if I would need to manualy convert them, or even batch the script with a search-replace string in a seperate editor like Ultraedit.

anybody any suggestions?
t.i.a.
P.

Flash's Random Number Generator
Hello all. I am a mathematician and i am curious about how sophisticated flash's default random number generator is; does anyone know or can anyone link me to the information?
Also, for some projects I am working on I need to work in flash with numbers that are truly random (or as close as possible); if flash's generator is not up to snuff, do you know any ones that i can easily encorporate and call from action script? Thank you all.

---Scotopia

Flash Banner With Number Selestion [1][2][3]...
Hi,

Hi all new member and siniour member, i just start wanna learn flash is because my website. and i try to find out how to make this flash banner for 1month plus, i got no idea how to do this banner ... my head going to crack!

fonally let me found this flash forum , i was so happy that i can learn how to do already >_<

i just install adobe flash cs3 and i was wonder to make it using that program, but after i start the program i wan using 15min to think where should i start....blur~

so is it adobe flash can done this flash banner or have any other more simple software can done this? please help e ^_^

i attach the screen shoot of the banner ... i need tome one guide me to do that!

Thanks, wish can get reply soon ^_^

How To Set Number Of Second For Each Images In Flash/XML Slideshow?
My problem is my movieClip is an array of images in "x" Coordinate (I need to make it slide from left to right every 240 pxl.

Someone told me to use this code. and here is my actionScript

loadMovie("jpg/bn1.jpg","i01");
loadMovie("jpg/bn2.jpg","i02");
loadMovie("jpg/bn3.jpg","i03");
loadMovie("jpg/bn4.jpg","i04");
loadMovie("jpg/bn5.jpg","i05");
loadMovie("jpg/bn6.jpg","i06");
loadMovie("jpg/bn7.jpg","i07");

_root.items.x = -(240 * random(7));

myNumber = 0;
_root.items.x.onEnterFrame = function() {
if (myNumber<=125) {
myNumber = myNumber + 1;
} else {
delete _root.items.x.onEnterFrame;
}
};
Actually, I'm not really understand about actionScript. If anybody have any suggestion, Please tell me
Thank!!

Max Number Of Flash Elements In A HTML.
I was trying to see how many maximum flash elements can be present in a single HTML page. I was planning on having many such elements in a page which were generally of smaller width and heights. I saw that when I opened 50 such elements everything became slow and on opening another tab in firefox with the same 50 elements my ff crashed. What can be the reason and what is the max number of flash elements which are generally expected to be present in a page.

I dont see any shoot in CPU and memory and hence I cannot really understand what the problem is.

Give Me Seryal Number For Flash 8 Pls
give me seryal number for flash 8 pls

How Can I Add A Turning Number To A Flash Web Form?
How can I add a turning number to a Flash web form?

Flash Maths - Scaling A Number
Hi guys,

I need help with a math problem

I need a math formula to scale a number from between 400 and 10000
to a number between 800 and 8000

In other words 400 would return a value of 800
10000 would return a value of 8000
and any number between 400 and 10000
would return a corresponding answer between
800 and 8000 the same percentage along the span of numbers.

For example the number half way between 400 and 10000
would return the number half way between 800 and 8000

Im Stumped With Loading An Id Number Into Flash.
I have a flash file (actionscript 2) created that calls an external text file, and loads it into a scrolling text area.

example: // send and load variables
lv.load("

Number Format Function In Flash MX?
Is there a function in flash which is similar to the numberFormat(number,[mask]) ColdFusion function? I want to show the result in default format, adding the comma
for the thousands place. Please can somebody help? Many Thanks

Flash - How To Play A Certain Number Of Frames?
Hi,

I am a newbie to Flash, and am looking to make a button that when pressed, plays a certain number of frames from a specific frame. For example, if the movie is currently at frame 5, I want the button to play the next 10 frames and stop at frame 15. Similarly, if the movie is currently at frame 20, the button would play the next 10 frames and stop at 30. I tried gotoAndPlay/Stop, but realized that this command moves the movie to the named frame, but doesn't PLAY the frames in between...

Thanks

Copyright © 2005-08 www.BigResource.com, All rights reserved