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




Math.ceil Ll Math.floor



Hi there,

I have code to dynamictween my mc's.Works great.I only need the if statement to work so when my square reaches it's new size and position I can load in my content using a holder.Can someone help me out on this if statement.
and instead off scaling the holder,etc I want to control it's xy position when hitting but0,...

but0.onRelease = function()
{
_root.square.dynTween({duration:6, _y:[350, "In", 60], _yscale:[200, "out", 5], callback:"_root.action1"});

if (Math.ceil(this._dynTween) == Math.ceil(_root.square) || Math.floor(this._dynTween) == Math.floor(_root.square)) {
if (_root.squareTrigger == 1) {
if (_root.squareLoaded == undefined)
_root.square.squareHolder.loadMovie("content0.swf" );
_root.square.squareHolder._xscale = 33;
_root.square.squareHolder._yscale = 33;
_root.square.squareHolder._x += 35;
_root.square.squareHolder._y += 35;
_root.squareLoaded = 1;
}
_root.square.squareHolder._visible = true;
_root.squareTrigger = 1;
}
}
}

Grtz,



FlashKit > Flash Help > Flash ActionScript
Posted on: 11-30-2003, 07:15 AM


View Complete Forum Thread with Replies

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

Math.floor/ceil Not Working?
OK... I cannot get "this.dx" to either round down OR up? It keeps tracing out as decimal.


Code:
if (this._x>(rightwall-(this._width/2))) {
this._x = rightwall-this._width/2;
this.dx *= -.9;
Math.ceil(this.dx);
trace(this.dx);
rotateDir = "left";
}
// hit the left wall
if (this._x<(leftwall+(this._width/2))) {
this._x = leftwall+this._width/2;
this.dx *= -.9;
Math.floor(this.dx);
trace(this.dx);
rotateDir = "right";
}
anyone know what gives????

Cheers!

Controlling The Odds Of Math.floor(Math.random()
Hey,
Is there a way to set a random number in a array to showup maybe once a day. Or every 5000 views or loops, or something like that. I would love to be able to control the odds of a array. Cheers!

ActionScript Code:
var pic_array = new Array();
    pic_array[0] = "images/1";
    pic_array[1] = "images/2";
    pic_array[2] = "images/3";
    pic_array[3] = "images/4";
    pic_array[4] = "images/5";
    pic_array[5] = "images/6";
    pic_array[6] = "images/7";
    pic_array[7] = "images/8";
    pic_array[8] = "images/9";
    pic_array[9] = "images/10";
    pic_array[10] = "images/11";
    pic_array[11] = "images/12";
    pic_array[12] = "images/13";
    pic_array[13] = "images/14";
   
    ranNum = Math.floor(Math.random()*pic_array.length);
    holder_mc.loadMovie(pic_array[ranNum]+".jpg");

What Is The Diffrence Between Math.floor And Math.round
Hi Guys,

Wat is the diffrence between these two?

I looked at the help, but i still dnt quite understand it!

Math.ceil,Math.... Rounding "?"
Is there a rounding method that will round 4.6 to 5 and 4.3 to 4. if so what is it.

Math.ceil Problem
I have make a small flash for a htm page using the Math.ceil, like this:

onClipEvent (enterFrame) {
this.gotoAndStop(Math.ceil(_root._ymouse));
}

Check it from here.


In most of browsers or OS it will play only when the mouse is on top of the MC.
Except for some Mac OS, which will play it all the time, disregarding the placement of the mouse
which becomes kind of annoying.

How can I avoid that?

Thanks for the advise :-)

Math.ceil Quick Question.
I was just looking at it, there seems to be no integer types in flash, but instead int() function.

So to my understanding Math.ceil( a / b); is just same as int( a / b);

Am I correct guys?

Correct Usage For Math.ceil...
in a set command?

I've tried the following:

set("offmin",math.floor(off*.5))

set(math.ceil("offmin"),(off*.5))

and neither works, one gives me a NaN, and the other produces a result a "undefined"

Problem With Math.ceil Function
I have recently realized that I cannot place a variable inside the math.ciel function. I can do it on one project but i cant in flash 8? whats going on here? Take a look at the following code. It works in flash 5 and mx. but it doesnt work in flash 8.



sofarframes = 0;
totalframes = _root.getBytesTotal();
sofarframes = _root.getBytesLoaded();
_root.loader.bar._x = math.ceil(sofarframes / totalframes * 200);
trace(math.ceil(sofarframes));
if (sofarframes == totalframes) {
gotoAndStop(3);
}

As you can see - im trying to do a trace on my ceiling function. However - when the movie plays - the trace displays "Undefined". Doing this should at least display a 0 since i defined sofarframes at the top. Please HELP!!!

Help Math.ceil Returning 'undefined'
Hi

I am quite new to this so im hoping the solution is very easy for someone with experience.

Here is my code:

THUMB_ROWS=3;
THUMB_COLS=4;

THUMB_PAGE = THUMB_ROWS * THUMB_COLS;

//numimages taken from nodes in xml doc

page_total = math.ceil( numimages / THUMB_PAGE );
page_txt.text = ( ( thumb_base / THUMB_PAGE ) + 1) + "/" + page_total;

So i have a gallery, and the text box should show 1/1 or 1/2 or whatever. Only problem is when I introduce the math.ceil method i get 'undefined'

if i trace like this:

trace ("page_total " + page_total);
trace ("numimages " + numimages);
trace ("thumb_page " + THUMB_PAGE);

The output displays:

page_total undefined
numimages 17
thumb_page 12

...so the numbers im using to calculate seem to be valid
Help!

Math.floor?
Hi!

what is math.floor?
what do it do?
and, how shuld I use it?`

thanks
Albert

Math Floor
Hey al since the other game iv'e been trying to make was hard and no one knew Multiple hitTest,and iv'e been working on it or like a week or less//

I feel like i should make a cool City drager...

So if someOne can rust me up on this kinda code..

Mathfloor/

To drag a obkject then stop on the grid say size 30 and
maybe you guys can whip up a FLA..

Plz someone will help son i hope...

Ill be on my computer..l.........;,,,,l

Math.floor Loses 0
I have a captivate player that checks the time I run into the problem when I use the Math.floor to round the numbers it drops the 0 if for instance the time is 9:01, 9:1 is displayed. Another Example is 2:00 is displayed 2:0 It only does this if there is a 0 before the last number.


Here is part of my code

Code:
this.onLoad = function ()
{
capPath = _parent.target_mc;

m = Math.floor(capPath.rdinfoCurrentFrame/30/60);
s = MathDigits(Math.floor(capPath.rdinfoCurrentFrame/30%60));
tempo = m+":"+s+"/"+Math.floor(capPath.rdinfoFrameCount/30/60)+":"+Math.floor(capPath.rdinfoFrameCount/30%60);
}

[MX04] Math.floor Help
Hi! I have the below code to trace the current time in seconds. But I don't know why I can't use Math.floor to round up the "currenttime" digit...
But I could use Math.floor(12.123);



function updateTimer():Void {

currenttime = getTimer();
currenttime = currenttime /1000;
Math.floor(currenttime);

trace(currenttime+ "NEWTIME");

}
var intervalID:Number = setInterval(updateTimer, 1000);



Can anyone please help??

Thanks!!

[CS3] Help With The Math.floor Command
I have a project that has a calculation that come back with a number like 10.5. I need to round down a variable and get rid of the .5 using math.floor but i can't seem to figure out how to do it.

Thanks for the help

Global Math.floor()
Hi there is there a way to globally assign Math.floor() or Math.round() to a flash presentation, so that all values in the presentation are rounded off?

Weirdness In Math.floor
project width is 500


tile_width=25;
map_collumns=Stage.width/tile_width
trace(map_collumns)

Sometimes I get a decimal return. Then, when I close it,and run it again, it shows the correct answer.
Why is this?

Math Random And Floor
Hi all


Code:
rects[i].graphics.beginFill(Math.floor(Math.random( )*0xFFFFFF), 1);
I can't find , what floor and Math.random( ) do to this code.I have a reference .

Thanks advance .

Math.floor To Display Two Zeros
Anyone know of a way (or better way than I am doing it) to get Math.floor to display two numbers if the Math.floor integer is 0? Math.round seems to return only one zero also.

Currently I have a condidtional to check


Code:
myNum = Math.floor(myVar/1000);
if(myNum == 0){
myNum = "00";
}
Thanks,
Ivan

Math.floor, Variables.........fun Stuff
hey guys, if i'm trying to determine a destination frame for a button to refernce (gotoAndPlay) based on a percentage, would it be necessary for me to use Math.floor to make sure the result of the percentage is a whole number before trying to send the movie to the frame?

as some of you know, i've been working on upgrading a video player peice by piece for about a week now and i think i'm getting close to the end (finally). anyway, i'm currently working on a progress bar that is draggable to control the position of the movie. anyway, i've got all kinds of functions and variables that, to be honest, i dont really know anything about beyond what they're supposed to do based on what you guys have told me on here........anyway, one such example is an equation that calculates the appropriate frame for the movie based on where the user releases the progress bar handle (i.e. _x of the handle/160; 160 being the max _x for the handle, then multiply that result by the total frames of the movie). i ran a trace, and that part seems to output correctly, but in MOST cases it outputs something like 506.134882..........(random example).

anyway, what i was thinking is that maybe i need to round that number to the nearest whole number because there's no such frame as xxx.134. does that make sense?

if that IS the case, is it legal for me to simply add that into the AS phrase that tells the movie to go to that frame, or does it have to be included into the equation itself?

here's the two lines in question:

ActionScript Code:
var vidPercentTwo:Number = (_root.sliderMC.handleMC._x/160)*_root.tutVideo._totalframes;
_root.tutVideo.gotoAndStop(Math.floor(vidPercentTwo));

these are both included into the function for the release of the button.......basically i guess i need to know if i'm on the right track w/ the Math.floor business and can i actually include the variable name in the Math.floor() as i did in the example above, or will that give me problems??

i'm off work now, so i'll be offline till tomorrow morning, i'll check up on what you guys think then...thanks so much!!

-james

Easy(?) Question About Math.floor(x);
I get undefined when I try this code:

x=12.5
trace(math.floor(x));


Are expressions allowed in the operator? or what am I doing wrong?

Thank you very very much!

Math.floor Simple Question
Hi Again-
For some reason my math.floor function is not working (trace yields "undefined")... Im sure its something simple, but Im not seeing it. Suggestions??? Thanks!!!


ActionScript Code:
thumbNum = 26;total = thumbNum * 200;wholeSteps = math.floor(total/600);trace (wholeSteps);

Math.floor? Round Down To Nearest 10th
Hi Folks, Math is not my friend so I need some help.

I want to round a whole number down to the nearest whole 10th.

Like 52, becomes 50. Or 49, becomes 40. Or 2005, becomes 2000.

Does that make sense? I imagine it has a math.floor approach, but I can not figure it out.

Thanks in advance for any help!!!

What Keeps My Movie From Stopping Properly? Math.floor/interval
Hey all,

this is driving me nuts.
I have a movie, in it lies a button with which I jump to another position in the _root timeline.
At that position is a stop(); command.

The movie just wont stop while this is running in another mc1 deeper in the file
:

Code:
stop();
onEnterFrame = function() {

c=Math.floor(Math.random() * (1500 - 0)) + 150;

var Interval1 = setInterval(function () {
b=Math.floor(Math.random() * (7 - 0)) + 1;
gotoAndPlay(b);
clearInterval(Interval1);
}, c);
}
What this does in the mc1 is basically creating a random number between 150 and 1500 and a random number between 0 and 7, then jumping to a random frame (numbered from 1-7) after waiting for a random time (150-1500ms).

My _root stops properly when I remove the code posted above.
Why is this happening and how can I have a mc1 in my movie which waits for a random time and then jumps to a random frame, while I want to move around in my _root timeline?
I should add, the mcs1 which wait and move to a random frame are non existent on the position I want to move to in _root.

Could that be part of the problem?
Do I have to somehow remove the wait and choose random frame to jump to function in mc1, when moving around in _root?

How would i do this?

Any help is greatly appreciated,
dual

AS2 - How To Center Flash On Page Load In Browser (using Math.floor() For Pixel Alignment)?
Last edited by gadz : 2008-10-20 at 04:41.
























I need help. I have a swf that has a tiled bmp background, a movieclip (main) with all the content (except the loader movieclip) that is automatically centered on the stage at browser resize (using Math.floor() for pixel alignment). The SWF is 100% high and wide so it fills the browser, I'm using FlashScaler to show scrollbars in the browser when needed.

My problem is that when the swf loads in the browser, the loader movieclip and the main movieclip do not center on the stage of the swf until the browser window is resized manually.

On the timeline I have an actions layer with the following code:


PHP Code:



stop();

import flash.display.BitmapData;
import flash.external.ExternalInterface;

var sw:Number = System.capabilities.screenResolutionX;
var sh:Number = System.capabilities.screenResolutionY;

var tile:BitmapData = BitmapData.loadBitmap("tile");

function fillBG():Void {
    this.beginBitmapFill(tile);
    this.moveTo(0,0);
    this.lineTo(sw,0);
    this.lineTo(sw,sh);
    this.lineTo(0,sh);
    this.lineTo(0,0);
    this.endFill();
};

fillBG();

Stage.align = "TL";
Stage.scaleMode = "noscale";

Stage.addListener({onResize:reposition});

function reposition() {
    fillBG();
    var mc = _root.main;
    var newX = Math.floor(Stage.width / 2);
    mc._x = newX;
};
 
reposition(); 




Below it I have another layer with a preloader that uses the following code:


PHP Code:



onClipEvent (load) {
    total = _root.getBytesTotal();
}
onClipEvent (enterFrame) {
    loaded = _root.getBytesLoaded();
    percent = int(loaded/total*100);
    text = percent+"%";
    gotoAndStop(percent);
    if (loaded == total) {
        _root.gotoAndPlay(2);
    }





And below the preloader layer, I have the content movie clip (main) layer that starts on frame(2) after the preloader is finished loading the swf.

The HTML code is the following:


PHP Code:



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <title>Crosswind Group</title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <link rel="StyleSheet" href="style/main.css" type="text/css" media="screen,print" />
        <script type="text/javascript" src="js/swfobject.js"></script>
        <script type="text/javascript" src="js/flashscaler.js"></script>
        <script type="text/javascript">
            var flashvars = {};
            var params = { scale: "noScale" };
            var attributes = {};
            
            swfobject.embedSWF("main.swf", "flashmovie", "100%", "100%", "8", false, 
flashvars, params, attributes);
        </script>
    </head>
    <body>
        <div id="flashcontent">
            <div id="flashmovie">
                <h2>SORRY!</h2>
                <p>We have detected that you do not have the Flash Player plugin 
required to view this website.</p>
                <p>Download the latest <a href="http://www.adobe.com/shockwave/download/
index.cgi?P1_Prod_Version=ShockwaveFlash">Flash Player</a> for free! 
It takes just a few minutes to download and install.</p>
            </div>
    </div>
    <script type="text/javascript">
        scale = new FlashScaler("flashcontent",500,620);
    </script>

    </body>
</html> 



And the css is:


PHP Code:



html {
    height: 100%;
    font-size: 100%;
    overflow:auto;
}
body {
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: #000;
    color: #fff;
    font-size: 76%;
    font-family: "Courier New",Arial, Verdana, sans-serif;
}
a {
    color: #666;
    text-decoration: underline;
}
h2 {
    margin-top: 2em;
}
#flashcontent {
    overflow: hidden;
}
#noflash {
    margin: 20px;






Here are the complete project files. (see attached zip file).















Attached Files

MATH: General Math Ratio Formula?
So I have these sets of values that correspond with other values. But the manufacturer only gave me sets by 5. I need to break it out for every integer. Here's what I got ...
Code:
20=35
25=54
30=78
35=106
40=138
45=175
50=216
55=261
60=310
My question is how do I develop a formula in Flash that can give me values for numbers not divisible by 5? Accuracy to the nth power, figuratively speaking, isn't crucial.

Big thanks,
Layne

Math.round(Math.random()*4)+1
Will this return values of 1 to 5 (inclusive).

If not, anyone know how to get random whole numbers 1 to 5?!

Cheers.

Dongle

Math.atan && Math.atan2
Can someone please expplain to me what does Math.atan2 and Math.atan returns? I made a file to try to understand, but I cant figure out what they do!!!
I saw a lot o fo files wich use those actions, but still couldnt understand.

Var I = Math.round(Math.random()*1)
this should return either 1 or 0?

but it seems to be returning something else as well and i dont know what it is???

function startXPos() {
var i = Math.round(Math.random()*1);
_root.test1 = i;
_root.test2 = t;
return i;
}

i have this just after

if (startXPos() == 0) {
startX = -500;
endX = 750;
} else if (startXPos() == 1) {
startX = 750;
endX = -500;
} else {
startX = 0;
endX = 0;
}

_root.test3 = startX;
_root.test4 = endX;

As far as i am aware this should never return 0 for these two values but it does?!?

can someone please tell what im doing wrong here?

One Line Of Math Including Math.abs()
Ok, Ive tried and tried again

I want

if (//the absolute value of Xspeed plus the absolute value of Yspeed is greater than 10) {
boundaries();
}

Math.round And Just Plain Math
Hi, I'm back with another question.

I want my exam to show a percentage at the end. I guess I'll concatenate a 'percent sign' at the end, but right now I'm having trouble with the math.

There are 13 questions. This is what I have:

score = Math.round(right/13*100);

The scores are coming out all wrong. Any ideas would be greatly appreciated.

Dan

Math.round() Or Math.random()
Is it better to use Math.round() or Math.random() reason I am asking I think I read somehwere that one was better. My problem is that I have a number of movie clips that are attach dynamically. They move randomly on the stage but for some reason they just stop moving randomly.. I think there was a post somehwere about that but cannot seem to find it.

Math Questions For The Math Experts :)
Hello there,

I am looking for a way to find a vector if i know one point and 1 angle...
Like i have A(x,y) and a vector starting from A(x,y) with an angle. I would like to know the position on a point X(x,y) that can be anywhere on that vector. I only know the coordinates of A and the angle. Possible?? I guess it has to be a function... ANy help would be appreciated

Math.min And Math.max Synopsis...
Hey,

I am looking for a good definition of the two mentioned in the title... Macromedia's documentation is crappy for the two... I know both follow this pattern:

math.min (x,y)... my Q is what is X and what is Y? are both constraints?
I'm lost.

Math.sin And Math.cos Speeds
I've just been reading through some old Flash 5 tutorials and came across a tutorial that used Math.sin and Math.cos quite a lot for trigonometry functions. The tutorial recommends creating an array of sin and cos values and using them instead of calling Math.sin and Math.cos all of the time in order to speed up the calculations (the functions are used a few times a second by multiple movie clips).

Is this still an issue with Flash?

I know that Flash 7 can process code faster than Flash 5, and that the CPU speed also comes into it, but after running a few tests using Math.sin and Math.cos (instead of the array idea) I don't really see any speed problems (that's on a 3Ghz PC though).

Does anyone have any thoughts on this?

Math.sin (45) ?
Math.sin (45) shouldnīt be 0.7071067...?

I donīt know if there is any mistake, but it gave me 0,8509035...

I did it with a calculator at home and it gave me 0.7071... I guess I didnīt understand somthings

Math.....
i know Math.sqrt is the maths for square rooting something, but what is the annotation to squared something (ie a*a, or x*x)

Math ?
Hello,
I have a mouseover "zoom" MC on a background(city). How can I determine the distance between this MC and the _root._x position of the main movie? I would like to zoom in (scale) and have the x position of the main movie smoothly scroll to the x position of the "zoom" MC. My latest attempt is another MC, seperate from "zoom" and "city" on the main timeline with this action...

onClipEvent (enterFrame) {
if (_root.city._xscale==true) {
a = _root._x-_root.city.zoom._x;
_root._x = _root._x+a;
}
}

My math skills need some improvement. I can get the distance between the two _x positons with the variable "a".( I think, still questioning postive and negative values) How can I smoothly scroll the _x postion of the main movie to the _x postion of the "zoom" MC?

Thx in advance!
~GD~

Math.abs
Is the absolute value created by Math.abs by definition a positive number?
Or can it be negative.. if so, which Math object makes the total only positive...?

Thanks

- Dan

//NEED MATH WIZ
I'm alittle confused about the trig functions in actionscript. Its telling me that it returns the values in radians and to convert these to degrees I must use

degrees = (radians / Math.PI) * 180

Now, does that mean I would do the math first to get the radians stored in a var and then preform the above formula?

Heres what I'm after:
//text fields for user input
H = "";
V = "";
y = "";

//button to calc everything

on (release) {
if (H.length>=1 && V.length>=1 && y.length>=1) {
x = H/V;
z = Math.tan(y)*x;
radian = Math.atan(z); //inverse tan to get actual angle
display = radian/Math.PI*180;
} else {
display == "";
}
}

Basic example:
H=30
V=5
y=11.25
tan(11.25)= .1989124
.1989124*6= 1.1934742
inverse tan(1.1934742= 50.040698
So my actual angle at a Horizontal scale of 30 and a vertical of 5 would be 50.04 degrees if I'm using a 11.25 degree bend.
If the scale were 1:1 it would just be 11.25 degrees due to lack of distortion.
HOWEVER, I cant seem to get this to come out in flash. With the script I have above I get -87.518, so I know I'm way off.
Can anyone enlighten me????

Need Someone Who Knows Their Math
OK, my script requires that I rotate a movie clip to face the mouse. Now, I know trig. fairly well, and the basics of the formula are (N being the value I need):

90 + N = TAN-1 (X Difference / Y Difference)

But I can't find an inverted tangent function in the Math object. Does anyone how to perform a reverse tangent?

Need Math Help
i need to compute some formulas and am not real sure about how i set them up-- are there some math/action script wizards that could show me how to calculate these two formulas in action scripting??

i've made a stab at it, but not sure i'm correct, and have no way to check the results against known values...

TIA

i can't do scripts and subscripts here so "sq" is squared and "pi" is of course pi as in 3.14

1.
-----------------
G = 4piA/Lsq where A=piRsq,R is input (variable) Lsq= Csq/Fsq where C=3x10-to-the-8th and F is input (variable)

-----------------
2.
-----------------
L=20LOG(4piD/L) where D is input (variable) and L=C/F where C=3x10-to-the-8th and F is input (variable)
-----------------

any and all assistance will be greatly appreciated.

Math
Hello everyone. How do you write a simple addition statement?

Say I have three variables
quantity
price
total

how do I say: Total = (quantity * price) in Actionscript?

Thanks is advance to anyone who replies!

Math, Help Me.
Ok I have a circle.

Origin 0,0.

The Radius is dynamic, we'll call it X length.

We need to find a dynamic number of points on this circle. All equidistant from each other. We'll call this number Y.

Is there a formula to find the choordinates of each of the dynamic points?

A Little Math Help Pls
I am trying to simulate something filling with water in Flash 5 and I am having trouble with the bubble speeds.

I am using AS to animate everything... Basically, there is a solid color MC that decreases it's _y position over time, and random bubble MC's that do the same.... BUT I want them to adjust their speed accordingly so they don't pass the _y of the color MC, which is the top of the clip... I basically have this accomplished but there is too much deceleration as they get closer to the top.

Here is what I am using on the bubble clips now:


Code:

onClipEvent(enterFrame){

wtop = _parent.water._y; // water's surface

if (wtop <= 300){ // if water is up, start moving bubble.

// speed is random, assigned when clip is duplicated.

dist = Math.ceil((this._y - wtop)/speed);

if (this._y > wtop){
this._y -= dist;

}else{
doOtherThings...
}
}

}
Please let me know if anyone has any better ideas...

Thanks

Math
Hi
I am having version 5 of Flash.How can I perform mathematical operations on values entered on textbox1 and textbox2 and obtain the result on textbox3?

Math.cos And Math.sin
Why am I an eejit! when it comes to math? I'm trying to create a circular motion that at random intervals (randomizer &randomizer2 in the Suctionscript below) turns and twists. It's kinda hard to describe, but picture something like an infinite s-curve - or a phone doodle.
Now, creating the circular motion is no problem (thanks
again, MKit - and, yeah, I said I thought I'd be able to sort the rest out...). And reversing it around the same axis is not a problem either. (remove the four lines of code including and after mexoffset). But what I thought would be four lines of beautiful and precise code is just a worthless two-timing pile of piss-ant ass-crack word jumble! Suggestions anyone?

onClipEvent(load) {

flag=1
radius=40
xcenter=200
ycenter=200
this._x=240
this._y=200

}


onClipEvent(enterFrame) {

if (flag==1) {
xspeed+=.05
c=Math.cos (xspeed)
this._x=(c*radius)+xcenter

yspeed+=.05
d=Math.sin (yspeed)
this._y=(d*radius)+ycenter

randomizer=random(150)
if (randomizer == 1) {
flag=0
mexoffset=this._x-xcenter
xcenter+=2*mexoffset
meyoffset=this._y-ycenter
ycenter+=2*meyoffset
}
}


if (flag==0) {
xspeed-=.05
c=Math.cos (xspeed)
this._x=(c*radius)+xcenter

yspeed-=.05
d=Math.sin (yspeed)
this._y=(d*radius)+ycenter

randomizer2=random(150)
if (randomizer2 == 2) {
flag=1
mexoffset=this._x-xcenter
xcenter+=2*mexoffset
meyoffset=this._y-center
ycenter+=2*meyoffset
}
}

}

Math.exp() - I Need A Help
Hi... I'm having problems when I try to use the Math function: math.exp()... I don't know what is the right use of this function... I need to make a simple operation: example 2^4 = 16

is there other way to make this without Math.exp, or if there is not how can I use this on Flash MX?

May someone help me?

Thanks

Math.rem?
hi all

how can I find out if a number is odd or even ? rem used to do it for me in C

5 rem 2 = 1
6 rem 2 = 0

how can i do this in actionscript?

Thanx

MikeP

Math.pow(25, 1/2)
Has anyone else noticed this bug in flash mx??

Create two dynamic text boxes call "test1" and "test2".

Then put the following actions on the frame:

// Set test1 to the square root of 25
_root.test1 = Math.pow(25, 1/2);

// Set test2 to be the integer of test1.
_root.test2 = int(_root.test1);


You would expect that both variables would have the same value since 25 is a square number, but no - test1 = 5 and test2 = 4!!!!!

Experimenting with this I have found that it only happens for factors of 5 and to any power less than 1 !!!

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