Re: [Flashcoders] understanding the for loop - EXTENDED HELP NEEDED.

2006-02-02 Thread Mark Winterhalder
hi Corban,

> //ALL ISSUES ARE OCCURING IN THIS LINE OF CODE FROM WHAT I 
> UNDERSTAND
> //COULD ANYONE HELP ME OUT WITH THIS?
> rfcClip.container.attachMovie(imgID);

the other two arguments for attachMovie are name:String and depth:Number. :)

to clarify Andreas' advice to use var, if you only need it locally,
declare it locally. for example, randomPos is only used inside
loadImages, but you declare it in the beginning of your script. that's
not necessary, you can declare it in the beginning of your function.

also, i disagree with him on using "function foo ()  {" over "var
foo:Function = function () {", but i guess that's really a matter of
preference. just do it like whatever feels more comfortable with you.

hth,
mark



On 2/2/06, Corban Baxter <[EMAIL PROTECTED]> wrote:
> So I am trying to convert the scripts to AS2 and get strict datatyping to 
> work but nothing seems to work the way I imagined it to work. I tried to do 
> what I could best and nothing still is working. All the data is in place but 
> nothing will get my MC's to load in the images from the library...
>
>
> [code]
> ///varibles setup
> var layoutNum:Number;
> var oldNum:Number;
> var setsArray:Array = new Array();
> var totalSetsNLayout:Number;
> var totalImagesNLayout:Array = new Array();
> var imagesToGrab:Number;
> var imgArray:Array = new Array();
> var rfcsArray:Array = new Array();
> var randomSet:Number;
> var oldSet:Number;
> var img:String;
> var myMC:String;
> var randomPos:Number;
> var rfcClip:MovieClip;
> var imgID:String;
>
> function selectLayoutNum(){
> //check if it was the last layout
> //set layoutNum
> layoutNum = random(5) +1;
> while(layoutNum == oldNum){
> layoutNum = random(5) +1;
> }
> oldNum = layoutNum;
> trace("layoutNum: " + layoutNum);
> getSetsNLayout(layoutNum);
> }
>
> function getSetsNLayout(layoutNum){
> setsArray = [null, 3, 3, 3, 3, 4];
> totalSetsNLayout = setsArray[layoutNum];
> trace("totalSetsNLayout: " + totalSetsNLayout);
>
> gatherImages4Layout(totalSetsNLayout, layoutNum);
> }
>
> function gatherImages4Layout(totalSetsNLayout, layoutNum){
> totalImagesNLayout = [null, 9, 8, 6, 6, 11];
> imagesToGrab = totalImagesNLayout[layoutNum];
> trace("imagesToGrab: " + imagesToGrab);
>
>
> //dynamicly create array of images to be used in layout
> for(i=0; i<=imagesToGrab; i++){
> randomSet = random(totalSetsNLayout) + 1;
> while(randomSet == oldSet){
> randomSet = random(totalSetsNLayout) + 1;
> }
> oldSet = randomSet;
>
> img = "layout" + layoutNum + "_set" + randomSet + "_img" + i;
> imgArray.push(img);
> myMC = "lay" + layoutNum + "_img" + i;
> rfcsArray.push(myMC);
> }
> //trace("imgArray= [" + imgArray + "]");
> //trace(" ");
> //trace("rfcsArray = [" + rfcsArray + "]");
> gotoAndPlay("lay_" + layoutNum);
> }
>
> //loadImages is called in an interval when the playhead hits the marker 
> specified
> //like "lay_2" etc
> //loadImgInterval = setInterval(loadImages, 2000, imagesToGrab);
>
> function loadImages(imagesToGrab){
> if(imagesToGrab == 0){
> //stop loading images
> clearInterval(loadImgInterval);
> trace("hitting the clear");
> }else{
> randomPos = random(imagesToGrab)+1;
>
> rfcClip = rfcsArray[randomPos];
> imgID = imgArray[randomPos];
>
> rfcsArray.splice(randomPos, 1);
> imgArray.splice(randomPos, 1);
>
> //select and image id
> trace("imgID: " + imgID);
>
> //select corisponding rfcClip
> trace("rfcClip: " + rfcClip);
>
> //ALL ISSUES ARE OCCURING IN THIS LINE OF CODE FROM WHAT I 
> UNDERSTAND
> //COULD ANYONE HELP ME OUT WITH THIS?
> rfcClip.container.attachMovie(imgID);
>
> imagesToGrab--;
>     clearInterval(loadImgInterval);
> loadImgInterval = setInterval(loadImages, 2000, imagesToGrab);
&

RE: [Flashcoders] understanding the for loop - EXTENDED HELP NEEDED.

2006-02-02 Thread Corban Baxter
So I am trying to convert the scripts to AS2 and get strict datatyping to work 
but nothing seems to work the way I imagined it to work. I tried to do what I 
could best and nothing still is working. All the data is in place but nothing 
will get my MC's to load in the images from the library... 


[code]
///varibles setup
var layoutNum:Number;
var oldNum:Number;
var setsArray:Array = new Array();
var totalSetsNLayout:Number;
var totalImagesNLayout:Array = new Array();
var imagesToGrab:Number;
var imgArray:Array = new Array();
var rfcsArray:Array = new Array();
var randomSet:Number;
var oldSet:Number;
var img:String;
var myMC:String;
var randomPos:Number;
var rfcClip:MovieClip;
var imgID:String;

function selectLayoutNum(){
//check if it was the last layout
//set layoutNum
layoutNum = random(5) +1;
while(layoutNum == oldNum){
layoutNum = random(5) +1;
}
oldNum = layoutNum;
trace("layoutNum: " + layoutNum);
getSetsNLayout(layoutNum);
}

function getSetsNLayout(layoutNum){
setsArray = [null, 3, 3, 3, 3, 4];
totalSetsNLayout = setsArray[layoutNum];
trace("totalSetsNLayout: " + totalSetsNLayout);

gatherImages4Layout(totalSetsNLayout, layoutNum);
}

function gatherImages4Layout(totalSetsNLayout, layoutNum){
totalImagesNLayout = [null, 9, 8, 6, 6, 11];
imagesToGrab = totalImagesNLayout[layoutNum];
trace("imagesToGrab: " + imagesToGrab);


//dynamicly create array of images to be used in layout
for(i=0; i<=imagesToGrab; i++){
randomSet = random(totalSetsNLayout) + 1;
while(randomSet == oldSet){
randomSet = random(totalSetsNLayout) + 1;
}
oldSet = randomSet;

img = "layout" + layoutNum + "_set" + randomSet + "_img" + i;
imgArray.push(img);
myMC = "lay" + layoutNum + "_img" + i;
rfcsArray.push(myMC);
}
//trace("imgArray= [" + imgArray + "]");
//trace(" ");
//trace("rfcsArray = [" + rfcsArray + "]");
gotoAndPlay("lay_" + layoutNum);
}

//loadImages is called in an interval when the playhead hits the marker 
specified
//like "lay_2" etc
//loadImgInterval = setInterval(loadImages, 2000, imagesToGrab);

function loadImages(imagesToGrab){
if(imagesToGrab == 0){
//stop loading images
clearInterval(loadImgInterval);
trace("hitting the clear");
}else{
randomPos = random(imagesToGrab)+1;

rfcClip = rfcsArray[randomPos];
imgID = imgArray[randomPos];

rfcsArray.splice(randomPos, 1);
imgArray.splice(randomPos, 1);

//select and image id
trace("imgID: " + imgID);

//select corisponding rfcClip
trace("rfcClip: " + rfcClip);

//ALL ISSUES ARE OCCURING IN THIS LINE OF CODE FROM WHAT I 
UNDERSTAND
//COULD ANYONE HELP ME OUT WITH THIS?
rfcClip.container.attachMovie(imgID);

imagesToGrab--;
clearInterval(loadImgInterval);
loadImgInterval = setInterval(loadImages, 2000, imagesToGrab);
}
trace("imagesLeftToLoad: " + imagesToGrab);
trace(" ");
}

selectLayoutNum();
stop();
[/code]


Corban Baxter  |  rich media designer  |  www.funimation.com


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Corban Baxter
Sent: Thursday, February 02, 2006 10:45 AM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] understanding the for loop - EXTENDED HELP NEEDED.

Well, I am going to take a stab at strict formatting. Not sure how well this is 
going to go but wish me luck as I venture off. Hopefully I can get some help as 
I take this new road. I appreciate the insight Andreas,

//cb


-Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andreas Rønning
Sent: Wednesday, February 01, 2006 6:25 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] understanding the for loop - EXTENDED HELP NEEDED.
___
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] understanding the for loop - EXTENDED HELP NEEDED.

2006-02-02 Thread Corban Baxter
Well, I am going to take a stab at strict formatting. Not sure how well this is 
going to go but wish me luck as I venture off. Hopefully I can get some help as 
I take this new road. I appreciate the insight Andreas,

//cb


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andreas Rønning
Sent: Wednesday, February 01, 2006 6:25 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] understanding the for loop - EXTENDED HELP NEEDED.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] understanding the for loop - EXTENDED HELP NEEDED.

2006-02-02 Thread Corban Baxter
Well, I am going to take a stab at strict formatting. Not sure how well this is 
going to go but wish me luck as I venture off. Hopefully I can get some help as 
I take this new road. I appreciate the insight Andreas,

//cb


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andreas Rønning
Sent: Wednesday, February 01, 2006 6:25 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] understanding the for loop - EXTENDED HELP NEEDED.

I'm way, way too sleepy to pretend that i can give you any advice on 
your actual problem, but i CAN give you advice on your AS form.
Please dude, for the sake of your brain cells, start using strict typing 
and local variables, and when you can, lose the myMethod = 
function(param) syntax.
Semantically it makes sense in the myObject.myMethod = function setting, 
but putting it everywhere makes your code unreadable at a glance.

function myMethod(param){
}

Spotting the "function" at the beginning of the line hints your neurons 
at the code structure. This is how our brains work, one percept triggers 
a perception. You need to work with it to make it work less.
In the same way, spotting "myObject" ahead of "myFunction" tells us what 
scope we're dealing with. With no scope, where are we? Until we read the 
"= function" we might as well expect
myMethod = 2 or myMethod = new Donkey();

Methods/Functions should be as generic as can be, Not necessarily in 
function, but in form.. Again, for the sake of your mental health.
In this situation, you want a function that takes a horse and places it 
in its little horse-car so it can drive off to the races and win.
However, if the car is already operated by another horse, create a new 
car and put the horse in that instead. True to life.

functun putHorseInCar(horse){
if(!myCar.occupied){
   myCar.driver = horse;
}else{
   newCar = new Car();
   newCar.driver = horse;
}
}

Immediatly you're in a heap of dung, since this function is written to 
only incorporate one specific car, and you'll need multiple functions 
like it to match all TWO HUNDRED THOUSAND cars in the world! BAD!
Of course, you'd write a more generic function that takes more arguments 
and perhaps, with the luxury of forethought, you make it return a 
reference to the car that has been treated, because perhaps sometime you'd
like some feedback instead of just blindly trusting that the function 
does as you hope.

function putHorseInCar(horse:Horse,car:Car):Car{
var someCar:Car = car;
if(!someCar.occupied){
   someCar.driver = horse;
}else{
   someCar= new Car();
   someCar.driver = horse;
}
return someCar;
}

I'm not saying you don't do this. I'm just reminding you and anyone else 
not feeling like kicking me in the balls yet that this kind of generic 
approach where a function may suddenly become useful in a setting for 
which it wasn't originally designed, simply because you wrote it with 
forethought and the wisdom of the ages, this kind of approach will SAVE 
YOUR ASS time and time again. Why? Because when you're 80, you'll rue 
the day you wilfully hurt your now-stagnating braincells.

A function is a guy you ask a favor. "Hey you, guy, i don't know what 
your job is, i don't know what you prefer to do, but would you mind 
photocopying this paperwork for me?". In "guy"'s world, the exact nature 
of the paperwork doesnt matter. It doesnt matter what you plan to do 
with it, and he shouldnt need to know; he needs to know how to use a 
photocopier of course but the nature of the paperwork shouldn't matter 
to him. In his world, the time where the papers enter his life until the 
time when they leave it, the papers lose all meaning. If he is unable to 
do as you ask because he didnt know that your paperwork required that he 
fold it into happy little origami birds and stomp on them repeatedly 
before xeroxing them, his life is miserable, and you probably won't get 
what you wanted from him.

Functions are innocent bystanders, not coworkers.

Speaking of innocent bystanders, don't send stray bullets flying all 
over the map.

selectLayoutNum = function(){
//check if it was the last layout
//set layoutNum
layoutNum = random(5) +1;
while(layoutNum == oldNum){
layoutNum = random(5) +1;
}
oldNum = layoutNum;
trace("layoutNum: " + layoutNum);
getSetsNLayout(layoutNum);
}

layoutNum! PIEAOWW *Ducks behind the counter*
oldNum! P'CHINNGGGggg *throws himself into the gutter*

These are near death experiences i could have AVOIDED had you only aimed 
them correctly and put "var" in front of them!
Variables, especially in functions, aren't fire and forget.

Re: [Flashcoders] understanding the for loop - EXTENDED HELP NEEDED.

2006-02-01 Thread Andreas Rønning
I'm way, way too sleepy to pretend that i can give you any advice on 
your actual problem, but i CAN give you advice on your AS form.
Please dude, for the sake of your brain cells, start using strict typing 
and local variables, and when you can, lose the myMethod = 
function(param) syntax.
Semantically it makes sense in the myObject.myMethod = function setting, 
but putting it everywhere makes your code unreadable at a glance.


function myMethod(param){
}

Spotting the "function" at the beginning of the line hints your neurons 
at the code structure. This is how our brains work, one percept triggers 
a perception. You need to work with it to make it work less.
In the same way, spotting "myObject" ahead of "myFunction" tells us what 
scope we're dealing with. With no scope, where are we? Until we read the 
"= function" we might as well expect

myMethod = 2 or myMethod = new Donkey();

Methods/Functions should be as generic as can be, Not necessarily in 
function, but in form.. Again, for the sake of your mental health.
In this situation, you want a function that takes a horse and places it 
in its little horse-car so it can drive off to the races and win.
However, if the car is already operated by another horse, create a new 
car and put the horse in that instead. True to life.


functun putHorseInCar(horse){
   if(!myCar.occupied){
  myCar.driver = horse;
   }else{
  newCar = new Car();
  newCar.driver = horse;
   }
}

Immediatly you're in a heap of dung, since this function is written to 
only incorporate one specific car, and you'll need multiple functions 
like it to match all TWO HUNDRED THOUSAND cars in the world! BAD!
Of course, you'd write a more generic function that takes more arguments 
and perhaps, with the luxury of forethought, you make it return a 
reference to the car that has been treated, because perhaps sometime you'd
like some feedback instead of just blindly trusting that the function 
does as you hope.


function putHorseInCar(horse:Horse,car:Car):Car{
   var someCar:Car = car;
   if(!someCar.occupied){
  someCar.driver = horse;
   }else{
  someCar= new Car();
  someCar.driver = horse;
   }
   return someCar;
}

I'm not saying you don't do this. I'm just reminding you and anyone else 
not feeling like kicking me in the balls yet that this kind of generic 
approach where a function may suddenly become useful in a setting for 
which it wasn't originally designed, simply because you wrote it with 
forethought and the wisdom of the ages, this kind of approach will SAVE 
YOUR ASS time and time again. Why? Because when you're 80, you'll rue 
the day you wilfully hurt your now-stagnating braincells.


A function is a guy you ask a favor. "Hey you, guy, i don't know what 
your job is, i don't know what you prefer to do, but would you mind 
photocopying this paperwork for me?". In "guy"'s world, the exact nature 
of the paperwork doesnt matter. It doesnt matter what you plan to do 
with it, and he shouldnt need to know; he needs to know how to use a 
photocopier of course but the nature of the paperwork shouldn't matter 
to him. In his world, the time where the papers enter his life until the 
time when they leave it, the papers lose all meaning. If he is unable to 
do as you ask because he didnt know that your paperwork required that he 
fold it into happy little origami birds and stomp on them repeatedly 
before xeroxing them, his life is miserable, and you probably won't get 
what you wanted from him.


Functions are innocent bystanders, not coworkers.

Speaking of innocent bystanders, don't send stray bullets flying all 
over the map.


selectLayoutNum = function(){
//check if it was the last layout
//set layoutNum
layoutNum = random(5) +1;
while(layoutNum == oldNum){
layoutNum = random(5) +1;
}
oldNum = layoutNum;
trace("layoutNum: " + layoutNum);
getSetsNLayout(layoutNum);
}

layoutNum! PIEAOWW *Ducks behind the counter*
oldNum! P'CHINNGGGggg *throws himself into the gutter*

These are near death experiences i could have AVOIDED had you only aimed 
them correctly and put "var" in front of them!
Variables, especially in functions, aren't fire and forget. They lie in 
wait like wolves, the smell of blood in their nostrils. And then!
Whammy. I'm willing to bet you've had bugs because of this in the past, 
and the sooner you get down with the var-ness, the better.


Anyway i'm just sleepy so don't think i'm trying to tell you off. I'm 
just pointing out shit that really killed my head back around flash 5 up 
til late MX, and

i feel your pain.

Cheers,

- Andreas

Corban Baxter wrote:

Well it's kind of working. I'd love to have some help on this to get me
going correctly. So with that said I'll try and explain what this is.

Ok so we are creating a screensaver that has 5 img layouts/templates
with different numbers o

RE: [Flashcoders] understanding the for loop - EXTENDED HELP NEEDED.

2006-02-01 Thread Corban Baxter
Thanks a million Jason!

Corban Baxter  |  rich media designer  |  www.funimation.com


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Corban Baxter
Sent: Wednesday, February 01, 2006 5:53 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] understanding the for loop - EXTENDED HELP NEEDED.

That would be great I'd love to see other approaches to this. But things are 
looking up I simplified that function into the one before it and it works fine. 
I am hoping to get this working fairly shortly. If so I will send you the file. 
Its going to be fun to look at I'm sure...

Corban Baxter  |  rich media designer  |  www.funimation.com


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason
Sent: Wednesday, February 01, 2006 5:48 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] understanding the for loop - EXTENDED HELP NEEDED.

I gotta run home, maybe someone else can help - I'll try and write up
some examples if I can later  - but relax, don't go nuts on us.  And you
didn't have to change your sig just because I teased you a little!  :)  

Seriously, I'll try and work up an example that might be a little
cleaner if I can find some time tonight or tomorrow. 

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com










>>-Original Message-
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Corban Baxter
>>Sent: Wednesday, February 01, 2006 6:42 PM
>>To: Flashcoders mailing list
>>Subject: RE: [Flashcoders] understanding the for loop - EXTENDED HELP
NEEDED.
>>
>>Well it's kind of working. I'd love to have some help on this to get
me
>>going correctly. So with that said I'll try and explain what this is.
>>
>>Ok so we are creating a screensaver that has 5 img layouts/templates
>>with different numbers of images per layout but they have empty MC's
in
>>place to place the images later.
>>
>>For each template we have created sets of images to choose from that
>>will be placed in each template. These images have linkage id's in the
>>lib.
>>
>>What we want to do is select a random "LAYOUT" (template). Then select
>>images for each position in the layout/template at random from a set
of
>>images designed for each template. So with that said it's a mouth
full.
>>
>>What I thought I could do is generate all this random stuff and create
>>an array from it that stores my images to be used. Then I need to
>>generate a list of MC's to place these images into. Which is more or
>>less determined in each template but each template has a different #
of
>>images in it.
>>
>>NEXT issue is this. Once I have both array's one of "linkage id's" for
>>the template and another array that holds my "MC references". I want
to
>>load these images into the corresponding MC but in another random
order.
>>(I know I know but we don't ever want ANYTHING to look the same
twice).
>>
>>So what I will have to do is then figure out a decent way to get the
>>loading to work without killing myself.
>>
>>Now my new problem is flash is telling me my function "createMCrfcs "
is
>>some sorta infinite loop and can't finish the task. Which makes no
sense
>>cause I am more or less doing the same thing above. But what ever. I
>>hope this makes sense and someone can throw some insight to me after
>>typing all this! Thanks for listening boys!
>>
>>I'm going crazy and this might sound crazy but any help would be
GREATLY
>>appericated
>>
>>
>>//setup vars
>>clipNum = 1;
>>
>>selectLayoutNum = function(){
>>  //check if it was the last layout
>>  //set layoutNum
>>  layoutNum = random(5) +1;
>>  while(layoutNum == oldNum){
>>  layoutNum = random(5) +1;
>>  }
>>  oldNum = layoutNum;
>>  trace("layoutNum: " + layoutNum);
>>  getSetsNLayout(layoutNum);
>>}
>>
>>getSetsNLayout = function(layoutNum){
>>  setsArray = [null, 3, 3, 3, 3, 4];
>>  totalSetsNLayout = setsArray[layoutNum];
>>  trace("totalSetsNLayout: " + totalSetsNLayout);
>>  gatherImages4Layout(totalSetsNLayout, layoutNum);
>>}
>>
>>gatherImages4Layout = function(totalSetsNLayout, layoutNum){
>>  totalImagesNLayout = [null, 9, 8, 6, 6, 11];
>>  imagesToGrab = totalImagesNLayout[layoutNum];
>

RE: [Flashcoders] understanding the for loop - EXTENDED HELP NEEDED.

2006-02-01 Thread Corban Baxter
That would be great I'd love to see other approaches to this. But things are 
looking up I simplified that function into the one before it and it works fine. 
I am hoping to get this working fairly shortly. If so I will send you the file. 
Its going to be fun to look at I'm sure...

Corban Baxter  |  rich media designer  |  www.funimation.com


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason
Sent: Wednesday, February 01, 2006 5:48 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] understanding the for loop - EXTENDED HELP NEEDED.

I gotta run home, maybe someone else can help - I'll try and write up
some examples if I can later  - but relax, don't go nuts on us.  And you
didn't have to change your sig just because I teased you a little!  :)  

Seriously, I'll try and work up an example that might be a little
cleaner if I can find some time tonight or tomorrow. 

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com










>>-Original Message-
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Corban Baxter
>>Sent: Wednesday, February 01, 2006 6:42 PM
>>To: Flashcoders mailing list
>>Subject: RE: [Flashcoders] understanding the for loop - EXTENDED HELP
NEEDED.
>>
>>Well it's kind of working. I'd love to have some help on this to get
me
>>going correctly. So with that said I'll try and explain what this is.
>>
>>Ok so we are creating a screensaver that has 5 img layouts/templates
>>with different numbers of images per layout but they have empty MC's
in
>>place to place the images later.
>>
>>For each template we have created sets of images to choose from that
>>will be placed in each template. These images have linkage id's in the
>>lib.
>>
>>What we want to do is select a random "LAYOUT" (template). Then select
>>images for each position in the layout/template at random from a set
of
>>images designed for each template. So with that said it's a mouth
full.
>>
>>What I thought I could do is generate all this random stuff and create
>>an array from it that stores my images to be used. Then I need to
>>generate a list of MC's to place these images into. Which is more or
>>less determined in each template but each template has a different #
of
>>images in it.
>>
>>NEXT issue is this. Once I have both array's one of "linkage id's" for
>>the template and another array that holds my "MC references". I want
to
>>load these images into the corresponding MC but in another random
order.
>>(I know I know but we don't ever want ANYTHING to look the same
twice).
>>
>>So what I will have to do is then figure out a decent way to get the
>>loading to work without killing myself.
>>
>>Now my new problem is flash is telling me my function "createMCrfcs "
is
>>some sorta infinite loop and can't finish the task. Which makes no
sense
>>cause I am more or less doing the same thing above. But what ever. I
>>hope this makes sense and someone can throw some insight to me after
>>typing all this! Thanks for listening boys!
>>
>>I'm going crazy and this might sound crazy but any help would be
GREATLY
>>appericated
>>
>>
>>//setup vars
>>clipNum = 1;
>>
>>selectLayoutNum = function(){
>>  //check if it was the last layout
>>  //set layoutNum
>>  layoutNum = random(5) +1;
>>  while(layoutNum == oldNum){
>>  layoutNum = random(5) +1;
>>  }
>>  oldNum = layoutNum;
>>  trace("layoutNum: " + layoutNum);
>>  getSetsNLayout(layoutNum);
>>}
>>
>>getSetsNLayout = function(layoutNum){
>>  setsArray = [null, 3, 3, 3, 3, 4];
>>  totalSetsNLayout = setsArray[layoutNum];
>>  trace("totalSetsNLayout: " + totalSetsNLayout);
>>  gatherImages4Layout(totalSetsNLayout, layoutNum);
>>}
>>
>>gatherImages4Layout = function(totalSetsNLayout, layoutNum){
>>  totalImagesNLayout = [null, 9, 8, 6, 6, 11];
>>  imagesToGrab = totalImagesNLayout[layoutNum];
>>  trace("imagesToGrab: " + imagesToGrab);
>>
>>
>>  //dynamicly create array of images to be used in layout
>>  imgArray = new Array();
>>  for(i=0; i<=imagesToGrab; i++){
>>  randomSet = random(totalSetsNLayout) + 1;
>>  while(randomSet == oldSet){
>>

RE: [Flashcoders] understanding the for loop - EXTENDED HELP NEEDED.

2006-02-01 Thread Merrill, Jason
I gotta run home, maybe someone else can help - I'll try and write up
some examples if I can later  - but relax, don't go nuts on us.  And you
didn't have to change your sig just because I teased you a little!  :)  

Seriously, I'll try and work up an example that might be a little
cleaner if I can find some time tonight or tomorrow. 

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com










>>-Original Message-
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Corban Baxter
>>Sent: Wednesday, February 01, 2006 6:42 PM
>>To: Flashcoders mailing list
>>Subject: RE: [Flashcoders] understanding the for loop - EXTENDED HELP
NEEDED.
>>
>>Well it's kind of working. I'd love to have some help on this to get
me
>>going correctly. So with that said I'll try and explain what this is.
>>
>>Ok so we are creating a screensaver that has 5 img layouts/templates
>>with different numbers of images per layout but they have empty MC's
in
>>place to place the images later.
>>
>>For each template we have created sets of images to choose from that
>>will be placed in each template. These images have linkage id's in the
>>lib.
>>
>>What we want to do is select a random "LAYOUT" (template). Then select
>>images for each position in the layout/template at random from a set
of
>>images designed for each template. So with that said it's a mouth
full.
>>
>>What I thought I could do is generate all this random stuff and create
>>an array from it that stores my images to be used. Then I need to
>>generate a list of MC's to place these images into. Which is more or
>>less determined in each template but each template has a different #
of
>>images in it.
>>
>>NEXT issue is this. Once I have both array's one of "linkage id's" for
>>the template and another array that holds my "MC references". I want
to
>>load these images into the corresponding MC but in another random
order.
>>(I know I know but we don't ever want ANYTHING to look the same
twice).
>>
>>So what I will have to do is then figure out a decent way to get the
>>loading to work without killing myself.
>>
>>Now my new problem is flash is telling me my function "createMCrfcs "
is
>>some sorta infinite loop and can't finish the task. Which makes no
sense
>>cause I am more or less doing the same thing above. But what ever. I
>>hope this makes sense and someone can throw some insight to me after
>>typing all this! Thanks for listening boys!
>>
>>I'm going crazy and this might sound crazy but any help would be
GREATLY
>>appericated
>>
>>
>>//setup vars
>>clipNum = 1;
>>
>>selectLayoutNum = function(){
>>  //check if it was the last layout
>>  //set layoutNum
>>  layoutNum = random(5) +1;
>>  while(layoutNum == oldNum){
>>  layoutNum = random(5) +1;
>>  }
>>  oldNum = layoutNum;
>>  trace("layoutNum: " + layoutNum);
>>  getSetsNLayout(layoutNum);
>>}
>>
>>getSetsNLayout = function(layoutNum){
>>  setsArray = [null, 3, 3, 3, 3, 4];
>>  totalSetsNLayout = setsArray[layoutNum];
>>  trace("totalSetsNLayout: " + totalSetsNLayout);
>>  gatherImages4Layout(totalSetsNLayout, layoutNum);
>>}
>>
>>gatherImages4Layout = function(totalSetsNLayout, layoutNum){
>>  totalImagesNLayout = [null, 9, 8, 6, 6, 11];
>>  imagesToGrab = totalImagesNLayout[layoutNum];
>>  trace("imagesToGrab: " + imagesToGrab);
>>
>>
>>  //dynamicly create array of images to be used in layout
>>  imgArray = new Array();
>>  for(i=0; i<=imagesToGrab; i++){
>>  randomSet = random(totalSetsNLayout) + 1;
>>  while(randomSet == oldSet){
>>  randomSet = random(totalSetsNLayout) + 1;
>>  }
>>  oldSet = randomSet;
>>
>>  img = "layout" + layoutNum + "_set" + randomSet + "_img"
>>+ i;
>>  imgArray.push(img);
>>  }
>>  trace("imgArray= [" + imgArray + "]");
>>  gotoAndPlay("lay_" + layoutNum);
>>  createMCrfcs(layoutNum, totalImagesNLayout);
>>}
>>
>>createMCrfcs = function(layoutNum, totalImagesNLayout){
>>  trace("totalSetsNLayo

RE: [Flashcoders] understanding the for loop - EXTENDED HELP NEEDED.

2006-02-01 Thread Corban Baxter
Well it's kind of working. I'd love to have some help on this to get me
going correctly. So with that said I'll try and explain what this is.

Ok so we are creating a screensaver that has 5 img layouts/templates
with different numbers of images per layout but they have empty MC's in
place to place the images later.

For each template we have created sets of images to choose from that
will be placed in each template. These images have linkage id's in the
lib.

What we want to do is select a random "LAYOUT" (template). Then select
images for each position in the layout/template at random from a set of
images designed for each template. So with that said it's a mouth full.

What I thought I could do is generate all this random stuff and create
an array from it that stores my images to be used. Then I need to
generate a list of MC's to place these images into. Which is more or
less determined in each template but each template has a different # of
images in it.

NEXT issue is this. Once I have both array's one of "linkage id's" for
the template and another array that holds my "MC references". I want to
load these images into the corresponding MC but in another random order.
(I know I know but we don't ever want ANYTHING to look the same twice). 

So what I will have to do is then figure out a decent way to get the
loading to work without killing myself.

Now my new problem is flash is telling me my function "createMCrfcs " is
some sorta infinite loop and can't finish the task. Which makes no sense
cause I am more or less doing the same thing above. But what ever. I
hope this makes sense and someone can throw some insight to me after
typing all this! Thanks for listening boys!

I'm going crazy and this might sound crazy but any help would be GREATLY
appericated


//setup vars
clipNum = 1;

selectLayoutNum = function(){
//check if it was the last layout
//set layoutNum
layoutNum = random(5) +1;
while(layoutNum == oldNum){
layoutNum = random(5) +1;
}
oldNum = layoutNum;
trace("layoutNum: " + layoutNum);
getSetsNLayout(layoutNum);
}

getSetsNLayout = function(layoutNum){
setsArray = [null, 3, 3, 3, 3, 4];
totalSetsNLayout = setsArray[layoutNum];
trace("totalSetsNLayout: " + totalSetsNLayout);
gatherImages4Layout(totalSetsNLayout, layoutNum);
}

gatherImages4Layout = function(totalSetsNLayout, layoutNum){
totalImagesNLayout = [null, 9, 8, 6, 6, 11];
imagesToGrab = totalImagesNLayout[layoutNum];
trace("imagesToGrab: " + imagesToGrab);


//dynamicly create array of images to be used in layout
imgArray = new Array();
for(i=0; i<=imagesToGrab; i++){
randomSet = random(totalSetsNLayout) + 1;
while(randomSet == oldSet){
randomSet = random(totalSetsNLayout) + 1;
}
oldSet = randomSet;

img = "layout" + layoutNum + "_set" + randomSet + "_img"
+ i;
imgArray.push(img);
}
trace("imgArray= [" + imgArray + "]");
gotoAndPlay("lay_" + layoutNum);
createMCrfcs(layoutNum, totalImagesNLayout);
}

createMCrfcs = function(layoutNum, totalImagesNLayout){
trace("totalSetsNLayout: " + totalSetsNLayout);
//create clip array...
rfcsArray = new Array();
for(p=0; p<=totalImagesNLayout; p++){
myMC = "lay" + layoutNum + "_img" + p;
rfcsArray.push(myMC);   
}
trace("rfcsArray = [" + rfcsArray + "]");
}

selectLayoutNum();
stop();




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


RE: [Flashcoders] understanding the for loop

2006-02-01 Thread Merrill, Jason
I just think it gets pretty hairy after they get nested more than one level - 
functions that rely on other functions which rely on other functions are OK, 
but when they have to be executed in a certain order in order for them to work, 
gets real messy.  Nothing wrong with a function that uses other functions 
though, certainly not - this is what a lot good class design consists of.   
With that said, I'm no expert either, so you can take what I said for what you 
think it's worth.  There are tons of other people on this list more experienced 
than me. 

>> Do I have a better way to do something like this?

Wel part'ner, I don't have time to look at your whole script and 
re-write it for you :) - I would have to know more about what you're trying to 
accomplish, because that "entire code" you published is trying to do a lot more 
than just show a random image.  

Anyway, did you get it working?

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com










>>-Original Message-
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Corban Baxter
>>Sent: Wednesday, February 01, 2006 6:03 PM
>>To: Flashcoders mailing list
>>Subject: RE: [Flashcoders] understanding the for loop
>>
>>Yeah I know. I just meant what is wrong with me having fnctions that call
>>functions etc? Do I have a better way to do something like this?
>>
>>Corban Baxter  |  rich media designer  |  www.funimation.com
>>
>>
>>-Original Message-
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Merrill, Jason
>>Sent: Wednesday, February 01, 2006 4:41 PM
>>To: Flashcoders mailing list
>>Subject: RE: [Flashcoders] understanding the for loop
>>
>>>>Jason could you possibly help me off list on a better way to throw
>>this stuff
>>>>around? I am really in the dark here and it would be a huge help if
>>you could
>>>>explain a better way to format this. Or anyone for that matter.
>>Thanks!
>>
>>Nah, don't be silly. ;) I spent a little more digging and found it:
>>
>>In the getSetsNLayout function, you have:
>>
>>   gatherImages4Layout(totalSets, layoutNum);
>>
>>But there is no "totalSets".  It should be this instead:
>>
>>   gatherImages4Layout(totalSetsNLayout, layoutNum);
>>
>>You just need a little more practice tracing values, and you can find
>>stuff like this.  I don't mean that as condescending, don't take it that
>>way.  But this is just a matter of tracing exact variables and finding
>>back where things are breaking.
>>
>>
>>Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com
>>
>>
>>
>>
>>
>>
>>NOTICE:
>>This message is for the designated recipient only and may contain privileged 
>>or
>>confidential information. If you have received it in error, please notify the 
>>sender
>>immediately and delete the original. Any other use of this e-mail by you is
>>prohibited.
>>___
>>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] understanding the for loop

2006-02-01 Thread Corban Baxter
Yeah I know. I just meant what is wrong with me having fnctions that call 
functions etc? Do I have a better way to do something like this?

Corban Baxter  |  rich media designer  |  www.funimation.com


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason
Sent: Wednesday, February 01, 2006 4:41 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] understanding the for loop

>>Jason could you possibly help me off list on a better way to throw
this stuff
>>around? I am really in the dark here and it would be a huge help if
you could
>>explain a better way to format this. Or anyone for that matter.
Thanks!

Nah, don't be silly. ;) I spent a little more digging and found it:

In the getSetsNLayout function, you have:

   gatherImages4Layout(totalSets, layoutNum);

But there is no "totalSets".  It should be this instead:

   gatherImages4Layout(totalSetsNLayout, layoutNum);

You just need a little more practice tracing values, and you can find
stuff like this.  I don't mean that as condescending, don't take it that
way.  But this is just a matter of tracing exact variables and finding
back where things are breaking. 


Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com






NOTICE:
This message is for the designated recipient only and may contain privileged or 
confidential information. If you have received it in error, please notify the 
sender immediately and delete the original. Any other use of this e-mail by you 
is prohibited.
___
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] understanding the for loop

2006-02-01 Thread Merrill, Jason
>>Jason could you possibly help me off list on a better way to throw
this stuff
>>around? I am really in the dark here and it would be a huge help if
you could
>>explain a better way to format this. Or anyone for that matter.
Thanks!

Nah, don't be silly. ;) I spent a little more digging and found it:

In the getSetsNLayout function, you have:

   gatherImages4Layout(totalSets, layoutNum);

But there is no "totalSets".  It should be this instead:

   gatherImages4Layout(totalSetsNLayout, layoutNum);

You just need a little more practice tracing values, and you can find
stuff like this.  I don't mean that as condescending, don't take it that
way.  But this is just a matter of tracing exact variables and finding
back where things are breaking. 


Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com






NOTICE:
This message is for the designated recipient only and may contain privileged or 
confidential information. If you have received it in error, please notify the 
sender immediately and delete the original. Any other use of this e-mail by you 
is prohibited.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] understanding the for loop

2006-02-01 Thread Corban Baxter
Oh and I found where it was not being passed right. But I would appericate 
beyond belief if you had some ideas for me. Thanks!

Corban Baxter  |  rich media designer  |  www.funimation.com


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Corban Baxter
Sent: Wednesday, February 01, 2006 4:36 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] understanding the for loop

Jason could you possibly help me off list on a better way to throw this stuff 
around? I am really in the dark here and it would be a huge help if you could 
explain a better way to format this. Or anyone for that matter. Thanks!

Corban Baxter  |  rich media designer  |  www.funimation.com


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason
Sent: Wednesday, February 01, 2006 4:32 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] understanding the for loop

>>// and I really need to learn OOP and AS2 I'm sure life would be a lot
>>//easier.

Maybe, though the problems you're having aren't really related to any
issue that OOP would fix - this is more plain old calling functions,
passing parameters, etc.

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com






NOTICE:
This message is for the designated recipient only and may contain privileged or 
confidential information. If you have received it in error, please notify the 
sender immediately and delete the original. Any other use of this e-mail by you 
is prohibited.
___
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] understanding the for loop

2006-02-01 Thread Corban Baxter
Jason could you possibly help me off list on a better way to throw this stuff 
around? I am really in the dark here and it would be a huge help if you could 
explain a better way to format this. Or anyone for that matter. Thanks!

Corban Baxter  |  rich media designer  |  www.funimation.com


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason
Sent: Wednesday, February 01, 2006 4:32 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] understanding the for loop

>>// and I really need to learn OOP and AS2 I'm sure life would be a lot
>>//easier.

Maybe, though the problems you're having aren't really related to any
issue that OOP would fix - this is more plain old calling functions,
passing parameters, etc.

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com






NOTICE:
This message is for the designated recipient only and may contain privileged or 
confidential information. If you have received it in error, please notify the 
sender immediately and delete the original. Any other use of this e-mail by you 
is prohibited.
___
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] understanding the for loop

2006-02-01 Thread Merrill, Jason
>>// and I really need to learn OOP and AS2 I'm sure life would be a lot
>>//easier.

Maybe, though the problems you're having aren't really related to any
issue that OOP would fix - this is more plain old calling functions,
passing parameters, etc.

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com






NOTICE:
This message is for the designated recipient only and may contain privileged or 
confidential information. If you have received it in error, please notify the 
sender immediately and delete the original. Any other use of this e-mail by you 
is prohibited.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] understanding the for loop

2006-02-01 Thread Merrill, Jason
>>What ARE you on about? :OD
>>
>>Adrian Lynch   |   Stuff   |   adrianlynch.co.uk

DUDE!  Had this sig for years, it's catching on!  Sweet! lol

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com










>>-Original Message-
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Adrian Lynch
>>Sent: Wednesday, February 01, 2006 5:23 PM
>>To: Flashcoders mailing list
>>Subject: RE: [Flashcoders] understanding the for loop
>>
>>What ARE you on about? :OD
>>
>>Adrian Lynch   |   Stuff   |   adrianlynch.co.uk
>>
>>-Original Message-
>>From: [EMAIL PROTECTED]
>>[mailto:[EMAIL PROTECTED] Behalf Of
Merrill,
>>Jason
>>Sent: 01 February 2006 22:12
>>To: Flashcoders mailing list
>>Subject: RE: [Flashcoders] understanding the for loop
>>
>>
>>By the way, with that e-mail signature line of yours, I feel like I am
>>talking to my alter-self from a parallel universe.
>>
>>Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com
>>
>>
>>
>>>>>>Jason so its bad to use this old way of random huh?
>>>>>>
>>>>>>Corban Baxter  |  rich media designer  |
>>www.funimation.com
>>
>>
>>
>>
>>NOTICE:
>>This message is for the designated recipient only and may contain
privileged
>>or confidential information. If you have received it in error, please
notify
>>the sender immediately and delete the original. Any other use of this
e-mail
>>by you is prohibited.
>>___
>>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] understanding the for loop

2006-02-01 Thread Merrill, Jason
You have functions calling functions calling functions... probably why
it's gettting hard to debug.  

Found it though, 

Right above this line:
randomSet = random(totalSetsNLayout) + 1;

put this:

trace(">>>>"+totalSetsNLayout)

You will see it's undefined.  Follow it back through your function calls
and find out where it's breaking.

Hope that helps.  If you really are in that alter-universe, say hi to my
grandpa for me. ;)

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com










>>-Original Message-
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Corban Baxter
>>Sent: Wednesday, February 01, 2006 5:20 PM
>>To: Flashcoders mailing list
>>Subject: RE: [Flashcoders] understanding the for loop
>>
>>In a world. In a time. Wait that is weird.
>>Better?
>>
>>//cb
>>
>>Ok those are determinded in an array in a previous function.
>>Here is EVERYTHING THAT I AM GOING TO THIS POINT.
>>I will change the code for random later I just need to figure this
out.
>>Oon step at a time. The random works fine above so I feel ok about it
>>for now.
>>
>>[code]
>>//this can be copy and pasted into script window to see results.
>>// and I really need to learn OOP and AS2 I'm sure life would be a lot
>>//easier.
>>
>>//setup vars
>>clipNum = 1;
>>
>>selectLayoutNum = function(){
>>  //check if it was the last layout
>>  //set layoutNum
>>  layoutNum = random(5) +1;
>>  while(layoutNum == oldNum){
>>  layoutNum = random(5) +1;
>>  }
>>  oldNum = layoutNum;
>>  trace("layoutNum: " + layoutNum);
>>  getSetsNLayout(layoutNum);
>>}
>>
>>getSetsNLayout = function(layoutNum){
>>  setsArray = [null, 3, 3, 3, 3, 4];
>>  totalSetsNLayout = setsArray[layoutNum];
>>  trace("totalSetsNLayout: " + totalSetsNLayout);
>>  gatherImages4Layout(totalSets, layoutNum);
>>}
>>
>>gatherImages4Layout = function(totalSetsNLayout, layoutNum){
>>  totalImagesNLayout = [null, 9, 8, 6, 6, 11];
>>  imagesToGrab = totalImagesNLayout[layoutNum];
>>  trace("imagesToGrab: " + imagesToGrab);
>>
>>
>>  //dynamicly create array of images to be used in layout
>>  imgArray = new Array();
>>  for(i=0; i<=imagesToGrab; i++){
>>
>>  randomSet = random(totalSetsNLayout) + 1;
>>//totalSetsNLayout = 4
>>  //shouldn't i get a random number between 1-4?
>>  trace("randomSet: " + randomSet);
>>  img = "layout" + layoutNum + "_set" + randomSet + "_img"
>>+ i;
>>  imgArray.push(img);
>>  }
>>      trace("imgArray= [" + imgArray + "]");
>>  gotoAndPlay("lay_" + layoutNum);
>>}
>>
>>loadImages = function(layoutNum){
>>  myMC = "lay" + layoutNum + "_img" + clipNum;
>>
>>  clipNum++;
>>}
>>
>>selectLayoutNum();
>>stop();
>>
>>[/code]
>>
>>
>>
>>
>>-Original Message-
>>From: [EMAIL PROTECTED]
>>[mailto:[EMAIL PROTECTED] On Behalf Of
Merrill,
>>Jason
>>Sent: Wednesday, February 01, 2006 4:12 PM
>>To: Flashcoders mailing list
>>Subject: RE: [Flashcoders] understanding the for loop
>>
>>By the way, with that e-mail signature line of yours, I feel like I am
>>talking to my alter-self from a parallel universe.
>>
>>Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com
>>
>>
>>
>>>>>>Jason so its bad to use this old way of random huh?
>>>>>>
>>>>>>Corban Baxter  |  rich media designer  |
>>www.funimation.com
>>
>>
>>
>>
>>NOTICE:
>>This message is for the designated recipient only and may contain
>>privileged or confidential information. If you have received it in
>>error, please notify the sender immediately and delete the original.
Any
>>other use of this e-mail by you is prohibited.
>>___
>>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] understanding the for loop

2006-02-01 Thread Adrian Lynch
What ARE you on about? :OD

Adrian Lynch   |   Stuff   |   adrianlynch.co.uk

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Merrill,
Jason
Sent: 01 February 2006 22:12
To: Flashcoders mailing list
Subject: RE: [Flashcoders] understanding the for loop


By the way, with that e-mail signature line of yours, I feel like I am
talking to my alter-self from a parallel universe.

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com



>>>>Jason so its bad to use this old way of random huh?
>>>>
>>>>Corban Baxter  |  rich media designer  |
www.funimation.com




NOTICE:
This message is for the designated recipient only and may contain privileged
or confidential information. If you have received it in error, please notify
the sender immediately and delete the original. Any other use of this e-mail
by you is prohibited.
___
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] understanding the for loop

2006-02-01 Thread Corban Baxter
In a world. In a time. Wait that is weird.
Better?

//cb

Ok those are determinded in an array in a previous function.
Here is EVERYTHING THAT I AM GOING TO THIS POINT. 
I will change the code for random later I just need to figure this out.
Oon step at a time. The random works fine above so I feel ok about it
for now.

[code] 
//this can be copy and pasted into script window to see results.
// and I really need to learn OOP and AS2 I'm sure life would be a lot
//easier.

//setup vars
clipNum = 1;

selectLayoutNum = function(){
//check if it was the last layout
//set layoutNum
layoutNum = random(5) +1;
while(layoutNum == oldNum){
layoutNum = random(5) +1;
}
oldNum = layoutNum;
trace("layoutNum: " + layoutNum);
getSetsNLayout(layoutNum);
}

getSetsNLayout = function(layoutNum){
setsArray = [null, 3, 3, 3, 3, 4];
totalSetsNLayout = setsArray[layoutNum];
trace("totalSetsNLayout: " + totalSetsNLayout);
gatherImages4Layout(totalSets, layoutNum);
}

gatherImages4Layout = function(totalSetsNLayout, layoutNum){
totalImagesNLayout = [null, 9, 8, 6, 6, 11];
imagesToGrab = totalImagesNLayout[layoutNum];
trace("imagesToGrab: " + imagesToGrab);


//dynamicly create array of images to be used in layout
imgArray = new Array();
for(i=0; i<=imagesToGrab; i++){

randomSet = random(totalSetsNLayout) + 1;
//totalSetsNLayout = 4
//shouldn't i get a random number between 1-4?
trace("randomSet: " + randomSet);
img = "layout" + layoutNum + "_set" + randomSet + "_img"
+ i;
imgArray.push(img);
}
trace("imgArray= [" + imgArray + "]");
gotoAndPlay("lay_" + layoutNum);
}

loadImages = function(layoutNum){
myMC = "lay" + layoutNum + "_img" + clipNum;

clipNum++;
}

selectLayoutNum();
stop();

[/code]




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Merrill,
Jason
Sent: Wednesday, February 01, 2006 4:12 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] understanding the for loop

By the way, with that e-mail signature line of yours, I feel like I am
talking to my alter-self from a parallel universe.  

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com



>>>>Jason so its bad to use this old way of random huh?
>>>>
>>>>Corban Baxter  |  rich media designer  |
www.funimation.com




NOTICE:
This message is for the designated recipient only and may contain
privileged or confidential information. If you have received it in
error, please notify the sender immediately and delete the original. Any
other use of this e-mail by you is prohibited.
___
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] understanding the for loop

2006-02-01 Thread Merrill, Jason
By the way, with that e-mail signature line of yours, I feel like I am
talking to my alter-self from a parallel universe.  

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com



Jason so its bad to use this old way of random huh?

Corban Baxter  |  rich media designer  |
www.funimation.com




NOTICE:
This message is for the designated recipient only and may contain privileged or 
confidential information. If you have received it in error, please notify the 
sender immediately and delete the original. Any other use of this e-mail by you 
is prohibited.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] understanding the for loop

2006-02-01 Thread Merrill, Jason
Well, its depreciated.  You tell me.  ;)

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com










>>-Original Message-
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Corban Baxter
>>Sent: Wednesday, February 01, 2006 5:03 PM
>>To: Flashcoders mailing list
>>Subject: RE: [Flashcoders] understanding the for loop
>>
>>Jason so its bad to use this old way of random huh?
>>
>>Corban Baxter  |  rich media designer  |  www.funimation.com
>>
>>
>>-Original Message-
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Merrill, Jason
>>Sent: Wednesday, February 01, 2006 3:51 PM
>>To: Flashcoders mailing list
>>Subject: RE: [Flashcoders] understanding the for loop
>>
>>>> img = random(imagesToGrab)+1;
>>
>>Yeah - first part of is probably that your use of random is... well...
>>incorrect.
>>
>>Math.random() retruns a random number of 0.0 or between 0.0 and 1.0.
>>You should convert it to a whole number first.
>>
>>function getRandom(min:Number, max:number){
>>  return min+Math.floor(Math.random()*(max+1-min));
>>}
>>
>>The other part is that you're overwriting the img variable:
>>
>>img = random(imagesToGrab)+1;
>>img = "layout" + layoutNum + "_set" + randomSet + "_img" + i;
>>
>>So in effect, the first value of img is replaced in the second line.
>>
>>Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com
>>
>>
>>
>>
>>NOTICE:
>>This message is for the designated recipient only and may contain privileged 
>>or
>>confidential information. If you have received it in error, please notify the 
>>sender
>>immediately and delete the original. Any other use of this e-mail by you is
>>prohibited.
>>___
>>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] understanding the for loop

2006-02-01 Thread Merrill, Jason
I answered that already, although I didn't notice until now that you are using 
the random() global function which was depreciated with Flash 4.  While it may 
server your purpose, use Math.random() as I demonstrated previously.

but you're also not providing any information on how the value for 
totalSetsNLayout is determined, which random relies on.

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com










>>-Original Message-
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Corban Baxter
>>Sent: Wednesday, February 01, 2006 4:56 PM
>>To: Flashcoders mailing list
>>Subject: RE: [Flashcoders] understanding the for loop
>>
>>Here is a better idea of what I need I think I posted the code off a little...
>>
>>[code]
>>imgArray = new Array();
>>  for(i=0; i<=imagesToGrab; i++){
>>
>>  randomSet = random(totalSetsNLayout) + 1; //totalSetsNLayout =
>>4
>>  //shouldn't i get a random number between 1-4?
>>  trace("randomSet: " + randomSet);
>>  img = "layout" + layoutNum + "_set" + randomSet + "_img" + i;
>>  imgArray.push(img);
>>  }
>>  trace("imgArray: " + imgArray);
>>[/code]
>>
>>[output]
>>layoutNum: 4
>>totalSetsNLayout: 3
>>imagesToGrab: 6
>>randomSet: 1 //needs to be random
>>randomSet: 1 //needs to be random
>>randomSet: 1 //needs to be random
>>randomSet: 1 //needs to be random
>>randomSet: 1 //needs to be random
>>randomSet: 1 //needs to be random
>>randomSet: 1 //needs to be random
>>imgArray =
>>[layout4_set1_img0,layout4_set1_img1,layout4_set1_img2,layout4_set1_img3,lay
>>out4_set1_img4,layout4_set1_img5,layout4_set1_img6]
>>[/output]
>>
>>so why is the randomSet never random?
>>
>>
>>Corban Baxter  |  rich media designer  |  www.funimation.com
>>
>>
>>-Original Message-
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Adrian Lynch
>>Sent: Wednesday, February 01, 2006 3:44 PM
>>To: Flashcoders mailing list
>>Subject: RE: [Flashcoders] understanding the for loop
>>
>>You're not incrementing imagesToGrab anywhere.
>>
>>for (...) {
>>  .
>>  imagesToGrab++;
>>}
>>
>>Ade
>>
>>-Original Message-
>>From: [EMAIL PROTECTED]
>>[mailto:[EMAIL PROTECTED] Behalf Of Corban
>>Baxter
>>Sent: 01 February 2006 21:29
>>To: flashcoders@chattyfig.figleaf.com
>>Subject: [Flashcoders] understanding the for loop
>>
>>
>>Ok guys I am working with this for loop to help me grab random images. My
>>problem is it seems like the for loop won't reset and random var each time
>>it runs. Below is my code...
>>
>>[code]
>>for(i=0; i<=imagesToGrab; i++){
>>  randomSet = random(totalSetsNLayout) + 1;
>>  img = random(imagesToGrab)+1;
>>  img = "layout" + layoutNum + "_set" + randomSet + "_img" + i;
>>  imgArray.push(img);
>>}
>>[/code]
>>
>>imgArray = [
>>layout5_set1_img0,
>>layout5_set1_img1,
>>layout5_set1_img2,
>>layout5_set1_img3,
>>layout5_set1_img4,
>>layout5_set1_img5,
>>layout5_set1_img6,
>>layout5_set1_img7,
>>layout5_set1_img8,
>>layout5_set1_img9,
>>layout5_set1_img10,
>>layout5_set1_img11]
>>
>>as you can see my problem is that it doesn't change my set randomly at all?
>>Any ideas why this happens?
>>
>>Corban Baxter  |  rich media designer  |  www.funimation.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
>>___
>>Flashcoders mailing list
>>Flashcoders@chattyfig.figleaf.com
>>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
NOTICE:
This message is for the designated recipient only and may contain privileged or 
confidential information. If you have received it in error, please notify the 
sender immediately and delete the original. Any other use of this e-mail by you 
is prohibited.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] understanding the for loop

2006-02-01 Thread Corban Baxter
Jason so its bad to use this old way of random huh?

Corban Baxter  |  rich media designer  |  www.funimation.com


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason
Sent: Wednesday, February 01, 2006 3:51 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] understanding the for loop

>> img = random(imagesToGrab)+1;

Yeah - first part of is probably that your use of random is... well...
incorrect.  

Math.random() retruns a random number of 0.0 or between 0.0 and 1.0.
You should convert it to a whole number first.  

function getRandom(min:Number, max:number){
return min+Math.floor(Math.random()*(max+1-min));
}

The other part is that you're overwriting the img variable:

img = random(imagesToGrab)+1;
img = "layout" + layoutNum + "_set" + randomSet + "_img" + i;

So in effect, the first value of img is replaced in the second line.  

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com




NOTICE:
This message is for the designated recipient only and may contain privileged or 
confidential information. If you have received it in error, please notify the 
sender immediately and delete the original. Any other use of this e-mail by you 
is prohibited.
___
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] understanding the for loop

2006-02-01 Thread Corban Baxter
Here is a better idea of what I need I think I posted the code off a little...

[code]
imgArray = new Array();
for(i=0; i<=imagesToGrab; i++){

randomSet = random(totalSetsNLayout) + 1; //totalSetsNLayout = 4
//shouldn't i get a random number between 1-4?
trace("randomSet: " + randomSet);
img = "layout" + layoutNum + "_set" + randomSet + "_img" + i;
imgArray.push(img);
}
trace("imgArray: " + imgArray);
[/code]

[output]
layoutNum: 4
totalSetsNLayout: 3
imagesToGrab: 6
randomSet: 1 //needs to be random
randomSet: 1 //needs to be random
randomSet: 1 //needs to be random
randomSet: 1 //needs to be random
randomSet: 1 //needs to be random
randomSet: 1 //needs to be random
randomSet: 1 //needs to be random
imgArray = 
[layout4_set1_img0,layout4_set1_img1,layout4_set1_img2,layout4_set1_img3,layout4_set1_img4,layout4_set1_img5,layout4_set1_img6]
[/output]

so why is the randomSet never random?


Corban Baxter  |  rich media designer  |  www.funimation.com


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Adrian Lynch
Sent: Wednesday, February 01, 2006 3:44 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] understanding the for loop

You're not incrementing imagesToGrab anywhere.

for (...) {
.
imagesToGrab++;
}

Ade

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Corban
Baxter
Sent: 01 February 2006 21:29
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] understanding the for loop


Ok guys I am working with this for loop to help me grab random images. My
problem is it seems like the for loop won't reset and random var each time
it runs. Below is my code...

[code]
for(i=0; i<=imagesToGrab; i++){
randomSet = random(totalSetsNLayout) + 1;
img = random(imagesToGrab)+1;
img = "layout" + layoutNum + "_set" + randomSet + "_img" + i;
imgArray.push(img);
}
[/code]

imgArray = [
layout5_set1_img0,
layout5_set1_img1,
layout5_set1_img2,
layout5_set1_img3,
layout5_set1_img4,
layout5_set1_img5,
layout5_set1_img6,
layout5_set1_img7,
layout5_set1_img8,
layout5_set1_img9,
layout5_set1_img10,
layout5_set1_img11]

as you can see my problem is that it doesn't change my set randomly at all?
Any ideas why this happens?

Corban Baxter  |  rich media designer  |  www.funimation.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
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] understanding the for loop

2006-02-01 Thread Merrill, Jason
>> img = random(imagesToGrab)+1;

Yeah - first part of is probably that your use of random is... well...
incorrect.  

Math.random() retruns a random number of 0.0 or between 0.0 and 1.0.
You should convert it to a whole number first.  

function getRandom(min:Number, max:number){
return min+Math.floor(Math.random()*(max+1-min));
}

The other part is that you're overwriting the img variable:

img = random(imagesToGrab)+1;
img = "layout" + layoutNum + "_set" + randomSet + "_img" + i;

So in effect, the first value of img is replaced in the second line.  

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com




NOTICE:
This message is for the designated recipient only and may contain privileged or 
confidential information. If you have received it in error, please notify the 
sender immediately and delete the original. Any other use of this e-mail by you 
is prohibited.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] understanding the for loop

2006-02-01 Thread Adrian Lynch
You're not incrementing imagesToGrab anywhere.

for (...) {
.
imagesToGrab++;
}

Ade

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Corban
Baxter
Sent: 01 February 2006 21:29
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] understanding the for loop


Ok guys I am working with this for loop to help me grab random images. My
problem is it seems like the for loop won't reset and random var each time
it runs. Below is my code...

[code]
for(i=0; i<=imagesToGrab; i++){
randomSet = random(totalSetsNLayout) + 1;
img = random(imagesToGrab)+1;
img = "layout" + layoutNum + "_set" + randomSet + "_img" + i;
imgArray.push(img);
}
[/code]

imgArray = [
layout5_set1_img0,
layout5_set1_img1,
layout5_set1_img2,
layout5_set1_img3,
layout5_set1_img4,
layout5_set1_img5,
layout5_set1_img6,
layout5_set1_img7,
layout5_set1_img8,
layout5_set1_img9,
layout5_set1_img10,
layout5_set1_img11]

as you can see my problem is that it doesn't change my set randomly at all?
Any ideas why this happens?

Corban Baxter  |  rich media designer  |  www.funimation.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