RE: [Flashcoders] Working on Flash 6 player but not on Flash 8

2006-09-21 Thread Mike Keesey
Well, random() has two meanings then, and the Math.random() function is
more generally useful than random() (for example, if you need a random
floating-point number). That said, I'd love a Math.randomInt() function.

―
Mike Keesey

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of Steven Sacks | BLITZ
> Sent: Thursday, September 21, 2006 12:22 PM
> To: Flashcoders mailing list
> Subject: RE: [Flashcoders] Working on Flash 6 player but not on Flash
8
> 
> > instead of random(x), you should use
> > Math.floor(Math.random() * x).
> 
> Which makes me wonder why random() is deprecated.  They really think
> that Math.floor(Math.random() * x) is better than random()?
Ridiculous!
> The sign of a great API is its simplicity.
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Working on Flash 6 player but not on Flash 8

2006-09-21 Thread Steven Sacks | BLITZ
> instead of random(x), you should use
> Math.floor(Math.random() * x).

Which makes me wonder why random() is deprecated.  They really think
that Math.floor(Math.random() * x) is better than random()?  Ridiculous!
The sign of a great API is its simplicity.
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Working on Flash 6 player but not on Flash 8

2006-09-21 Thread Mike Keesey
The earlier post (by Jake Prime) is probably the explanation. But also,
random() is deprecated; instead of random(x), you should use
Math.floor(Math.random() * x).

―
Mike Keesey

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of Berkay Unal
> Sent: Thursday, September 21, 2006 8:04 AM
> To: [FlashCoders]
> Subject: [Flashcoders] Working on Flash 6 player but not on Flash 8
> 
> Hi Coders,
> 
> Can someone please tell me whats the problem with this code . it's
working
> on fl6 but not fl8 . Thanks
> 
> Code:
> 
> --
> 
> counter++;
> // hiding the first dot
> dot._visible = false;
> // particle generator
> 
> // setting of the shape and velocity for each new dot
> this["dot"+counter].gotoAndStop("shape");
> this["dot"+counter].speedx =
(random(speed*10)/10)-(random(speed*10)/10);
> this["dot"+counter].speedy =
(random(speed*10)/10)-(random(speed*10)/10);
> // FX scaling and fading for every dots
> for (i=counter; i>counter-maxdot; i--) {
>  this["dot"+i]._x =
>
this["dot"+i]._x+this["dot"+i].speedx+Math.cos((counter+i)/frequency)*am
pl
> itude+forcex/friction;
>  this["dot"+i]._y =
>
this["dot"+i]._y+this["dot"+i].speedy+Math.sin((counter+i)/frequency)*am
pl
> itude+forcey/friction;
>  //friction
>  this["dot"+i].speedx = this["dot"+i].speedx/friction;
>  this["dot"+i].speedy = this["dot"+(i)].speedy/friction;
>  if (fxscale == true) {
>   this["dot"+i]._xscale = (maxdot-(counter-i))*(100/maxdot)*scale;
>   this["dot"+i]._yscale = (maxdot-(counter-i))*(100/maxdot)*scale;
>  } else {
>   this["dot"+i]._xscale = 100*scale;
>   this["dot"+i]._yscale = 100*scale;
>  }
>  if (fxfade == true) {
>   this["dot"+i]._alpha = (maxdot-(counter-i))*(100/maxdot);
>  } else {
>   this["dot"+i]._alpha = 100;
>  }
> }
> // removing old dots
> if (counter>=maxdot) {
>  eleman = counter-maxdot;
>  removeMovieClip(this["dot"+eleman]);
> }
> // managing maxdots changes : destroying unused dots
> maxdotdif = maxdot-maxdot0;
> if (maxdotdif<0) {
>  for (i=counter-maxdot; i>=counter-maxdot0-1; i--) {
>   removeMovieClip(this["dot"+i]);
>  }
> }
> trace("a");
> maxdot0 = maxdot;
> 
> 
> 
> --
> Berkay UNAL
> [EMAIL PROTECTED]
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Working on Flash 6 player but not on Flash 8

2006-09-21 Thread Jake Prime

Hi Berkay

Have you set counter to a value before incrementing it? If you fail to
initialise a variable in F6, it will assume it is 0 and increment to
1. If you do this in F8 it treats it as undefined, and will stay
undefined no matter how many times you increment it.

Jake

On 21/09/06, Berkay Unal <[EMAIL PROTECTED]> wrote:

Hi Coders,

Can someone please tell me whats the problem with this code . it's working
on fl6 but not fl8 . Thanks

Code:

--

counter++;
// hiding the first dot
dot._visible = false;
// particle generator

// setting of the shape and velocity for each new dot
this["dot"+counter].gotoAndStop("shape");
this["dot"+counter].speedx = (random(speed*10)/10)-(random(speed*10)/10);
this["dot"+counter].speedy = (random(speed*10)/10)-(random(speed*10)/10);
// FX scaling and fading for every dots
for (i=counter; i>counter-maxdot; i--) {
 this["dot"+i]._x =
this["dot"+i]._x+this["dot"+i].speedx+Math.cos((counter+i)/frequency)*amplitude+forcex/friction;
 this["dot"+i]._y =
this["dot"+i]._y+this["dot"+i].speedy+Math.sin((counter+i)/frequency)*amplitude+forcey/friction;
 //friction
 this["dot"+i].speedx = this["dot"+i].speedx/friction;
 this["dot"+i].speedy = this["dot"+(i)].speedy/friction;
 if (fxscale == true) {
  this["dot"+i]._xscale = (maxdot-(counter-i))*(100/maxdot)*scale;
  this["dot"+i]._yscale = (maxdot-(counter-i))*(100/maxdot)*scale;
 } else {
  this["dot"+i]._xscale = 100*scale;
  this["dot"+i]._yscale = 100*scale;
 }
 if (fxfade == true) {
  this["dot"+i]._alpha = (maxdot-(counter-i))*(100/maxdot);
 } else {
  this["dot"+i]._alpha = 100;
 }
}
// removing old dots
if (counter>=maxdot) {
 eleman = counter-maxdot;
 removeMovieClip(this["dot"+eleman]);
}
// managing maxdots changes : destroying unused dots
maxdotdif = maxdot-maxdot0;
if (maxdotdif<0) {
 for (i=counter-maxdot; i>=counter-maxdot0-1; i--) {
  removeMovieClip(this["dot"+i]);
 }
}
trace("a");
maxdot0 = maxdot;



--
Berkay UNAL
[EMAIL PROTECTED]
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] Working on Flash 6 player but not on Flash 8

2006-09-21 Thread Berkay Unal

Hi Coders,

Can someone please tell me whats the problem with this code . it's working
on fl6 but not fl8 . Thanks

Code:

--

counter++;
// hiding the first dot
dot._visible = false;
// particle generator

// setting of the shape and velocity for each new dot
this["dot"+counter].gotoAndStop("shape");
this["dot"+counter].speedx = (random(speed*10)/10)-(random(speed*10)/10);
this["dot"+counter].speedy = (random(speed*10)/10)-(random(speed*10)/10);
// FX scaling and fading for every dots
for (i=counter; i>counter-maxdot; i--) {
this["dot"+i]._x =
this["dot"+i]._x+this["dot"+i].speedx+Math.cos((counter+i)/frequency)*amplitude+forcex/friction;
this["dot"+i]._y =
this["dot"+i]._y+this["dot"+i].speedy+Math.sin((counter+i)/frequency)*amplitude+forcey/friction;
//friction
this["dot"+i].speedx = this["dot"+i].speedx/friction;
this["dot"+i].speedy = this["dot"+(i)].speedy/friction;
if (fxscale == true) {
 this["dot"+i]._xscale = (maxdot-(counter-i))*(100/maxdot)*scale;
 this["dot"+i]._yscale = (maxdot-(counter-i))*(100/maxdot)*scale;
} else {
 this["dot"+i]._xscale = 100*scale;
 this["dot"+i]._yscale = 100*scale;
}
if (fxfade == true) {
 this["dot"+i]._alpha = (maxdot-(counter-i))*(100/maxdot);
} else {
 this["dot"+i]._alpha = 100;
}
}
// removing old dots
if (counter>=maxdot) {
eleman = counter-maxdot;
removeMovieClip(this["dot"+eleman]);
}
// managing maxdots changes : destroying unused dots
maxdotdif = maxdot-maxdot0;
if (maxdotdif<0) {
for (i=counter-maxdot; i>=counter-maxdot0-1; i--) {
 removeMovieClip(this["dot"+i]);
}
}
trace("a");
maxdot0 = maxdot;



--
Berkay UNAL
[EMAIL PROTECTED]
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com