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




How Transform Var To Integer Var?



Hi,
I need make this:

var1 = 3;
var2 = 8;

var3 = var1 + var2;


its return var3 = 38 !!! Or, 3 contatened with 8.
How make var1 + var2 obtain 11 ?



FlashKit > Flash Help > Flash General Help
Posted on: 04-10-2003, 08:57 AM


View Complete Forum Thread with Replies

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

Transform Tool That Doesnt Use Transform Matrix?
Is there a tool that lets you strectch and rotate movie clip objects? (not skew, I believe that requires the transform matrix math)


Similar to this guy, but only using width height and rotation modifications

http://senocular.com/flash/actionscr...ansformTool.as

Geom Color Transform And Transform
I was using flash.geom.ColorTransform and flash.geom.Transform to change the color of a movie clip. The movie clip was the outline to many different other movie clips. I managed to change the color of the movie clip, but it doesn't change throughout the movie. Is there any special way to do this? I tried to use linkage, but that didn't work either.

Integer Help
Hi! Need help on this script! How can I put the "media_ar" a integer number, without the decimals?

________________
tot_el = _root.myValue.length;
for(m=0 ; m < tot_el; m++){
valore = _root.myValue[m];
valore1 = new Number(valore);
valore2 = valore1.valueOf();
tot_ar += valore2;
media_ar = tot_ar/tot_el;
_root.media = "Média = <font color="#FFCC00">" + media_ar + "</font>";
}
_________________

Integer To Hex
Hey!
I need to convert an integer value to hex to use with the setRGB thingy. (I want a slide bar that controls the colour of a movie clip)
I know that you can use parseInt to get an integer from a hex value but how do you do the opposite?
Cheers
(feeling sick as a dog)

Integer To Hex
Hey!
I need to convert an integer value to hex to use with the setRGB thingy. (I want a slide bar that controls the colour of a movie clip)
I know that you can use parseInt to get an integer from a hex value but how do you do the opposite?
Cheers
(feeling sick as a dog)

How Do I Get A Random Integer < X?
This isn't really a Flash problem...

I need to get a random integer less than a specific number.
How would I do this...?
It's prob really simple... but I can't get my head round the problem!

Any help would be appreciated.

Thanks.


Jam

Integer Divide
Hi, If I do a division I can make the answer into an integer afterwards. But that seems kind of CPU intensive, I know they don't like floating point calculations much. So is there any way i can go easy on it and just come out with the integer in the first place? I figure Mod must do it at some point but of course it doesn't give me the answer because thats not what its for.

Failing that, is parseInt() the simplest way to go? The answer doesn't have to be too accurate.

Thanks you guys!

Integer Problem
Hi guys,
I need your help on this litle issue:
I have a script that is made to calculate the average and I get it from an example in flashkit. it's like this:
----------------------------
tot_el = _root.myValue.length;
for(m=0 ; m < tot_el; m++){
valore = _root.myValue[m];
valore1 = new Number(valore);
valore2 = valore1.valueOf();
tot_ar += valore2;
media_ar = tot_ar/tot_el;
_root.media = "Média = <font color="#FFCC00">" + media_ar + "</font>";
}
----------------------------
This works fine, but I need the integer value. I know that is made with Math.Round but I try diferent ways to implement it and I cannot do it.

Can you help me?

String Into An Integer
Hi,

Simple thing I think

I have movieclips with instance names 1,2,3 etc and need to grab their names ( this.name = this._name ) but this becomes a string.

How do you convert a string into an integer.

Thanks in advance

Random Integer?
how do i create a random integer? and how do i set a range for it? for example a random integer between 1 and 10?

Variable And Integer
Hi, could someone please tell me what I'm doing wrong? It is not recognizing xmlArrayDate[i]

Here's my script:

i=1
xmlDate = xmlDay + xmlMonth + xmlYear;
xmlArray["xmlDate"] = xmlDate;
xmlArrayDate[i] = xmlArray["xmlDate"];
trace(xmlDate);
trace(xmlArray["xmlDate"]);
trace("Date: " + xmlArrayDate[i]);

Here's what I get for output:

1312004
1312004
Date:

String To Integer
I have the following readout from php
&id=1&name=jshpro2&score=2&max=11&level=1&connecte d=2


2

which works perfectly from flash, loads the variables and all but as strings, score+=5 for example when score=1 returns 15 when it should be 6 etc... how do i take a string and treat it as an integer?

Integer To Seconds
maybe i am going about this the wrong way, but im trying to do this quickly

theres this game that i am supposed to track how long someone was playing and display it on the screen

my current technique is using the setInterval for 1 second to add one to a counter
but how can i quickly format this to appear on the screen as 1:12?

i was looking into the date function a little, but it seems a little heavy to convert an integer into a time format

any suggestions?

thanks

Rounding Integer
Hi, i have some code in Flash MX (not 2004)
but I cant get it to work.


Quote:




temp = main.textClip._height;
Math.round(temp);
Trace (temp);




The field in question has a height of 532.15.

I want to remove the .15 and round down to 532, or if it was 532.55, then round up to 533.

But after the Math.round, temp is STILL 532.15, ARGH!

Any1 know why this isnt working?

Cheerz,
Dwayne

Checking If It's Integer Or Not
how can I check if a variable is integer or not?

Casting To Integer - What's Going On?
Look at this piece of code:

---------------------
alint = "0060";
trace (int(alint));
---------------------

this gives the value 48.

-48!?!? Where does that come from?

Help appreciated!

[F8] See If A Number Is An Integer
I, guys.

Was wondering if ther´s any code to check if a result is an integer number....

Thanks for your help

C.

Casting To Integer?
Hi,

I am new to actionscript .
How do I cut off the decimal part of a Number to get only an integer.

I want to display % complete of an upload, and I want for example
75.43% to read 75%

So there is no integer type in ActionScript 2? only Number?
Is there some way to cast the darn thing ?
Or how do i do it?

-thanks

String To Integer
Hey guys,

basically I need a code to convert an Integer to a string.

I have a string, (str) which is "5" for example, I want to add one to that number, but still keep it a string. I had the idea to change it into an integer, add one, then change it back to a string.
I used the code:

parseInt(str);
str++
parseString(str);

Unfortunatly I don't thing parseString is a real function!

any tips on how I could do this?

Thanks.

Integer Positions Only
I did a quick couple searches but didn't find anything so sorry if this question has been beat to death and I just didn't see the solution.

How do you disable or stop things from having a decimal position on the stage? (Integers only.)

Thanks.

Integer Validation
Hi folks, quick question:

How do i go about evaluating an integer to see if its a whole number or not.
Ideally this would be a function returning a boolean response.
For example, earlier in the program a calculation was performed, 1000 divided by 3, the answer of 333.3 recurring would be passed to this function and false would be returned, since it's not whole.

I did some searching on the forums and in the flash help and couldn't find anything on this, thanks in advance.

XML Compile As Integer
Does AS 3 have support to importing an XML value as an integer? For example I have in my xml document <position>"1"</position is there a way for AS 3 to turn that into an integer to use in an array?

Parse Integer
I am looking to retrieve a numerical value from user input. The problem is the user needs to be able to Type in a value for instance "E6". My problem is I only need the numerical info. Is there anyway to strip out the E so that my function only uses the numerical value of 6. You can see the project here

http://www.johnpendleton.com/seating/launch.html

Checking If It's Integer Or Not
how can I check if a variable is integer or not?

String To Integer
does any1 knows how to convert a string into a integer please thanks

Getting Rid Of A Few Digits On An Integer
Hey guys, my flash skills are pretty limited, but i finally was succesful in displaying the elapsed time of a mp3 file that is playing in my flash mvie;;;

Unfortunately, flash is returnong not only the seconds(ie, when 3 seconds of a file is played, it will display 3000; when 60 seconds have been played, i will see 60000);

I am trying to get rid of the 3 last digits of this number .

i Don't know how to achieve this; in other programming language that i've used, i was able to transform the number in a string & then get rid of a few characters???

Can someone help please?? Thank's alot!!

Integer To String?
am trying to pass variables either from an external TXT file or from the HTML into flash. The passing seems to be working. The problem is that the variable that I'm trying to pass is an integer (ie. 9999) and I am trying to eventually concatenate a URL string with this variable to make one URL (ie. 'getURL(generalURL+passedinURL,"_blank");'). I tried using this code prior to the getURL:
var passedinURL:String = String(passedinINTEGER);
But it gave me the same error when the button was clicked on the website.
Can anyone help me out??

Thanks in advance!
Chaz

(I've posted this exact same message to the Actionscript forum already.)

Integer To String?
I am trying to pass variables either from an external TXT file or from the HTML into flash. The passing seems to be working. The problem is that the variable that I'm trying to pass is an integer (ie. 9999) and I am trying to eventually concatenate a URL string with this variable to make one URL (ie. 'getURL(generalURL+passedinURL,"_blank");'). I tried using this code prior to the getURL:
var passedinURL:String = String(passedinINTEGER);
But it gave me the same error when the button was clicked on the website.
Can anyone help me out??

Thanks in advance!
Chaz

How To Split An Integer Value
Hi all,

I'm new to Actionscript, and am trying to figure out how to split up an integer value.

For instance, I have an integer which is dynamically generated such as 285.43. I need to split this number up so I can use each number individually (i.e. 2,8,5,4,3)

Is the best way of doing this to convert the Integer to a String, spliting it up, and then converting back to an Integer?

Any help would be greatly appriciated!

Many thanks, Rich

Integer Or Decimal
How can you tell rfom a variable if the number it is holding is a whole number or its holding a decimal number

ActionScript Code:
var num=55.234;


How can I check to see if variable num is 55.234 or if it is 55

Value Is A String Or An Integer
I've just seen a statement like this.


Code:
if (_root.map._width>"3000") {
_root.map.larger = 0;
}
Why 3000 put in quotes. Does it consider as a string on this expression?

Integer Problems, Please Help
Hi all,
I am loading up a variable into flash from a .txt file. everything is fine but but I can't find a way to have the variable showing up as an integer (I need to use that number with a switch statement afterwards). I've been tweeking it in every single way I can think of int(variable), eval(variable), parseInt, etc. Nothing does it.
Please help.
Thanks
Fabrice

Testing For An Integer
how would you say:

if (variable is an integer) {
 do this
}

it is the "variable is an integer" part I am asking about

thanks

Whole Integer Scroller
anyone know how to code a whole integer scroller or even where a tut to one might be? i use scrollers with pixel fonts so much and would really use a whole integer scroller a lot.

thanks in advanced,
-neverraininator...

My Integer Is A String
I use the php with flash.

In my php i put
***************************
$mynumber=10;
echo "SomeInteger=".$mynumber;
***************************

The problem is when i use loadvariables, it doesn't take the number as an integer, but a string. Therefore i cannot make any calculations. Can anyone help me..

Integer Function Int()
weirdness: when publishing the following code it works offline, yet just returns a 0 everytime online.



Code:
//INTERVAL FUNCTION
function editBar(){
_root.bar.barPlayed(int(((my_sound.position/1000)/_root.totalDurationSecs)*100)/100);

}
//DEFINE INTERVAL
setInterval(editBar, 1000);
Was using the int function to cut some of the decimal vaules out in hopes of better proccessing..


It references a function in the MC "Bar" and passes a parameter that calculates the percentage played of the streaming my_sound object.

Converting A String To Integer
I have a text file with a load of values (numbers) which control the position of a movieclip. When the value is imported into Flash it sees it as a string, but I want it as a number. I've tried converting using the parseInt(); function and also the Number(); but with no success. Doesn't anyone know if there is another way.

loadVariablesNum ("test.txt", 0);
// Value from the test.txt file

amount = Number(mcNumber);
while (amount>0) {
duplicateMovieClip (_root.mcBubble, "mcBubble"+i, i);
setProperty ("mcBubble"+i, _x, 200 + random(40));
setProperty ("mcBubble"+i, _y, 100 + random(46));
i = i+1;
amount = amount-1;
}

Array To Integer Help, IMPORTANT
Hey,

I'm loading a text file as variable=23.2|123.2|312.4|etc

I thenk break this as an array at the ""'s

Now the problem is I can't do anything with these numbers because they are being loaded as strings.

PLEASE HELP ME

How Do I Test A Variable Is An Integer?
Hi,

I want to validate that a value in a form field is less than 50 and a integer. Ive got the less than 50 bit working but dont know how to test that the variable is an integer - anyone? Here's the code:

on (press) {
if (no_of_slides > 50) {
gotoAndPlay ("50 error");
}


Cheers..John

How Do I Test That A Variable Is An Integer?
Sorry if this is a bit lame, Im still getting my nose wet in programming!

Anyway, I need to test that a variable is an integer and display an error message, I suppose its something like:

if (var != (integer) )
gotoAndPlay ("error");

How To Convert Integer To Hexadecimal ?
Hello

I need to convert decimal into hexadecimal, because i have created in inoutpanel with thre input fields. The user enters three numbers. If the user now clicks on set. The input fields represent thr RGB-Values of a color field. So, after clicking the set-button the Colorfield should change its color.
All that works pretty good. But at the moment you need to enter hexadecimal values, and thats very unconfortable. Now i want to convert decimal to hexadecimal, because it is easier for the user to enter decimal values.

Thanks and greetings from Germany
Juergen

Loadvariables String To Integer
I tried changing a variable passed through loadvariables to a number.

credit = "1000" is what is being passed.

when I do Number(credit); it gives me 0
when I do int(credit); it gives me 0
when I do ParseInt(credit); it gives me NAN


Anyone have any ideas please????
thanks

Integer Transformates To Realnumber
I've the following problem: I'm writing a function in wich there is a counter (INT X) that represents ._alpha of an instance. 1 is added to X everytime the function is run, the result should be an INT. But the outcome of this function is a REAL, so something like 1+1=2.232?! Only once every about 25 frames, its an INT. Even round.math won't help.

Define An Integer Through A Cfm File?
I am trying to create a dynamic bar chart with the variable height of a bar defined by data pulled in from a cfm file. It didn't work just being pulled straight so I tried this to convert the data to an integer:

loadVariablesNum ("data.cfm", 0);
barheight1=Math.Number(_root.data1)
_root.bar._height = _root.barheight1;
stop ();

with bar being a movie clip...just a bar to be scaled and data1 with a value of 200 in the cfm file.

Should this not work? It's not! What am I doing wrong? Please help!!

Thank you.

_alpha Is Float Or Integer?
hi all,
can somebody answer me the above question?
I've got 2 frames with these lines of code:
(pic_mc is a moviel clip with only one pic. inside)

frame 1:
if (pic_mc._alpha>0) {
pic_mc._alpha -= 5;
trace(pic_mc._alpha);
}

frame 2:

if (pic_mc._alpha > 0)
{
gotoAndPlay(1);
}

it worked but i got these result in the output window:
94.921875
94.921875
89.84375
89.84375
84.765625
84.765625
79.6875
... so on

???

Convert Integer To String
edit ----

sorry all, didn't notice the 30 trillion other posts explaining this issue.

oops!

Convert String To Integer
Is there a way (function) to convert a string to an integer?

Thanks!

Randomizing Absolute Value Of An Integer
Is it possible to randomize the absolute value of an integer?
code:
_root.number1 = (random(4) + 1);


This will change number1's value into either 1, 2, 3, or 4. Now.. What if number1 is negetave? Is it possible to randomize it, but have it keep its negative value WITHOUT using this:

code:
if (_root.number1 > 0) {
_root.number1 = (random(4) +1) ;
}
if (_root.number1 < 0) {
_root.number1 = (random(4) + 1);
_root.number1 *= -1;
}


I already tried this, but it doesn't work due to "left side of equation must be a property".

code:
Math.abs(_root.number1) = (random(4) +1);


So.. Is there any way to do this? Thanks a bunch!

Numbers In Integer Format?
Is it possible for the value of my variables to be presented in a text box not in a XXX.XXXXXXX format (with unlimited digits after dot), but in an integer format XXX (without digits after dot) or XXX.XX with 2 digits after dot. Thanks for any help!

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