[Flashcoders] Random numbers list

2008-07-28 Thread Eduardo Barbosa
Hi all!

What I am trying to figure out is this:

How to generate a sequence of random numbers where the newest is always
different from all the previous?

I need to continuosly rewrite an array of 10 random numbers in such a way
that at any given time they are all different.

Let's say that my range is 0 to 100

it starts with random numbers, all different:

{3, 34, 12, 69, 6, 44, 31, 90, 88, 23}

at a set interval some values are replaced by new ones so there are never
two equal numbers, so, after 2 seconds it may look like this:

{3, 66, 12, 79, 6, 44, 10, 81, 88, 23}


Any ideas?

Thanks :)
Eduardo
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Random numbers list

2008-07-28 Thread Eduardo Barbosa
Hi Matt,

Yes numbers can and should repeat through time. They just cant be repeated
within the sequence at a given discreet time. Makes sense? :)

On Mon, Jul 28, 2008 at 11:15 PM, Matt S. [EMAIL PROTECTED] wrote:

 Can numbers repeat? Is this a constant loop where, for instance, the
 number 12 could show up two times in twenty seconds? Or would you want
 12 to show up once and then go out of circulation permanently?

 .m

 On Mon, Jul 28, 2008 at 5:42 PM, Eduardo Barbosa [EMAIL PROTECTED]
 wrote:
  Hi all!
 
  What I am trying to figure out is this:
 
  How to generate a sequence of random numbers where the newest is always
  different from all the previous?
 
  I need to continuosly rewrite an array of 10 random numbers in such a way
  that at any given time they are all different.
 
  Let's say that my range is 0 to 100
 
  it starts with random numbers, all different:
 
  {3, 34, 12, 69, 6, 44, 31, 90, 88, 23}
 
  at a set interval some values are replaced by new ones so there are never
  two equal numbers, so, after 2 seconds it may look like this:
 
  {3, 66, 12, 79, 6, 44, 10, 81, 88, 23}
 
 
  Any ideas?
 
  Thanks :)
  Eduardo
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Random numbers list

2008-07-28 Thread Eduardo Barbosa
Hi Laurent,

Your first suggestion is a very simple and clever trick i'll definetely keep
in mind for future situations.

However for this second variation you mean that I:

1) pick the numbers out of array 1  and splice it
2) move those numbers into array 2
3) when the length of array 1 would be 10 i would start picking the numbers
out of array 2 and do the inverse.

Is this what you mean?



On Mon, Jul 28, 2008 at 11:01 PM, laurent [EMAIL PROTECTED] wrote:

 still it can be done like that you always keep the number of numbers
 between two arrays...
 and swap numbers from one to another, that your sure to neve have twice the
 same one
 yeah...! :]
 L

 Eduardo Barbosa a écrit :

 Hi all!


 What I am trying to figure out is this:

 How to generate a sequence of random numbers where the newest is always
 different from all the previous?

 I need to continuosly rewrite an array of 10 random numbers in such a way
 that at any given time they are all different.

 Let's say that my range is 0 to 100

 it starts with random numbers, all different:

 {3, 34, 12, 69, 6, 44, 31, 90, 88, 23}

 at a set interval some values are replaced by new ones so there are never
 two equal numbers, so, after 2 seconds it may look like this:

 {3, 66, 12, 79, 6, 44, 10, 81, 88, 23}


 Any ideas?

 Thanks :)
 Eduardo
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


 __ Information from ESET NOD32 Antivirus, version of virus
 signature database 3257 (20080710) __

 The message was checked by ESET NOD32 Antivirus.

 http://www.eset.com






 ___

 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Random numbers list

2008-07-28 Thread Eduardo Barbosa
Hi Steve,

That was actually my first thought. I had a while loop and inside a for ...
in loop to iterate through the array to check if the number was already
there. But then for some reason the script made flash unresponsive.

However  I just came up with this which seems to be working, but i'm still
very curious to learn of better ways of achieving this:

function pickUniqueNumber():Number {

var randomNum:Number;
var loop:Boolean = true;

var numberList:String = |+currentNumbers.join(|)+|;

while (loop) {

randomNum = random(wallpaperList.length);

var numberString:String = |+randomNum+|;

if (numberList.indexOf(numberString) == -1) {
currentNumbers.push(randomNum);
loop = false;
}
}
return randomNum;
}

On Mon, Jul 28, 2008 at 11:04 PM, Steve Abaffy [EMAIL PROTECTED]wrote:

 Every time you generate a new random number go through the array and see if
 any match the new number if so generate a new one and check again, if not
 add it to the array.
 With only 10 numbers in the array it would check very fast so you wouldn't
 be taking a performance hit.


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Eduardo
 Barbosa
 Sent: Monday, July 28, 2008 4:43 PM
 To: Flashcoders mailing list
 Subject: [Flashcoders] Random numbers list

 Hi all!

 What I am trying to figure out is this:

 How to generate a sequence of random numbers where the newest is always
 different from all the previous?

 I need to continuosly rewrite an array of 10 random numbers in such a way
 that at any given time they are all different.

 Let's say that my range is 0 to 100

 it starts with random numbers, all different:

 {3, 34, 12, 69, 6, 44, 31, 90, 88, 23}

 at a set interval some values are replaced by new ones so there are never
 two equal numbers, so, after 2 seconds it may look like this:

 {3, 66, 12, 79, 6, 44, 10, 81, 88, 23}


 Any ideas?

 Thanks :)
 Eduardo
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] How do you delete child movieclips?

2007-09-05 Thread Eduardo Barbosa
Hi Alexander,

What I usually do is, at the same time that the child MCs are created, write
them one after the other in an empty array that then you'll later call, run
through it and delete all its contents.

Makes sense?

Let me know if you want me to copy paste some code I've written for your
reference.

Cheers!
Eduardo
___
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] bitmap import and loading efficiency

2007-08-30 Thread Eduardo Barbosa
Hi list!

(made a quick search in the archive as i guess this must be a
recurrent/basic question but found nothing. hope one of you won't mind
quickly helping me)

About loading external bitmaps: If I want to compose a lettering in flash
where each letter is a bitmap what would be more efficient strategy since
there are repeating letters:

a) load the same bitmap everytime?

b) load only unique bitmaps and then duplicate them using
duplicateMovieClip?

c) something it hasn't occurred to me?

Thank you for your time!

P.S. any more detailed info on how flash manages the memory on this case
will be very welcome.

Eduardo
___
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: Re[2]: [Flashcoders] if logical operator

2006-12-21 Thread Eduardo Barbosa

thanks you all so much!

am amazed with the stormy brilliance of your replies!

i was trying out something with arrays myself but definitely I have my
problem solved now and learned a good bit more of actionscripting with you.

Hope i'll be soon able to make some valuable contributions here too

thanks again!
Eduardo
___
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] if logical operator

2006-12-20 Thread Eduardo Barbosa

Hi all,

given a list of numbers such as: (12, 34, 21, 46, 52 ... )

what would be the best way to achieve this:

a++;

if ( a != 12  a != 34  a != 21  a != 46  a != 52 ... ) {
 // do something
}

Am doing my research and trying out some solutions but i thought that in the
meantime someone may have a quick ready answer for this or some good hints.

thanks a lot!

Eduardo
___
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] JERKY Animations

2005-12-01 Thread Eduardo Barbosa
If the object you are trying to animate is a bitmap does it work if you
uncheck allow smoothing in the bitmap properties?

edo

On 12/1/05, flo_web [EMAIL PROTECTED] wrote:

 Hi,

 we're trying to make smooth and slow animations on aircarft movment.

 But the result is JERKY and we couldn't reach a good result with smooth
 movment.
 All the tests was made in local so there is no bandwith and loading
 considerations.

 We tried lot of technics :
 - high frame rate (25-30)
 - guide
 - even an flv of the animation (aftereffect animation encoded in avi then
 in flv) is JERKY
 - translations in actionscript

 so PLEAAASE is there a good solution for that or can't we make a beautiful
 smooth slow animation !

 Thanks.
 Florent.
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders