To Array or not to Array, that is the question.

  • LordofLimbo
  • Born
  • Born
  • LordofLimbo
  • Posts: 4
  • Loc: London

Post 3+ Months Ago

Hello, I have populated an array with 36 movie clips called "folio1" through to "folio36". I want to use this array to do the following: when I release over each different clip I need another clip called "scrollthumb" to jump to a specific _y location associated with that specific clip. At the same time, I need to make all the other clips change their alpha property to 0 or even their visibility to false. AND I need to stop all scrolling action initiated in the first frame of the main Timeline. Then I want to reverse the process on another button click. To make it more complicated, I need to be able to do alll this for each of the 36 movie clips in the array. I've gone grey trying to figure this stuff out.
  • mahjik
  • Novice
  • Novice
  • mahjik
  • Posts: 33
  • Loc: Las Cruces, NM USA

Post 3+ Months Ago

ok, let me see if i have this straight.

1. when the user releases over (clicks on) one of your 36 clips, a separate clip is going to be relocated to a specific y loc. and each of the other 36 clips besides the one clicked on will be set to _visible = false

so in the on(release) or myClip_mc.onrelease function, you will do the following

Code: [ Select ]
myOnReleaseFunction = function(){
 moveThatOtherClip (tothisYPosition);
 makeAllClipsInTheArrayInvisible (exceptTheOneAtThisIndex);
 delete thatFunctionThatDoesTheScrolloingStuff;
  1. myOnReleaseFunction = function(){
  2.  moveThatOtherClip (tothisYPosition);
  3.  makeAllClipsInTheArrayInvisible (exceptTheOneAtThisIndex);
  4.  delete thatFunctionThatDoesTheScrolloingStuff;
  5. }

if that other clip is a self containted object, you use its moveThatOtherClipFunction, otherwise just set the ._y to what you want

if the code that does the scrolling is in event handler functions or any other function, then just delete it/them. and if you want to initiate it on another button click or something, then just redeclare it.

if it isn't in a function, but just attached to the timeline, you could put it in a function and then call that function from the frame you want it to start working. then you can delete it as above.

abnother idea is to declare a global variable called something like _global.ShowMyClips:Boolean;
and have your makeAllClipsInvisible function check this variable and set the visibility as above, or all to visible if showMyClips = true;

Code: [ Select ]
makeAllClipsInTheArrayInvisible = function (exceptionIndex){
 for (var i = 0; i < myArray.length; i++ ){
  if (i == exceptionIndex || showMyClips == true){
   myArray[i]._visible = true;
  } else {
   myArray[i]._visible = false;
  1. makeAllClipsInTheArrayInvisible = function (exceptionIndex){
  2.  for (var i = 0; i < myArray.length; i++ ){
  3.   if (i == exceptionIndex || showMyClips == true){
  4.    myArray[i]._visible = true;
  5.   } else {
  6.    myArray[i]._visible = false;
  7.   }
  8.  }
  9. }

notice that exceptionIndex is the clips location in the array, not necessarily the number at the end of its name.

notice that the for statement starts counting at zero. if your clips aren't just named starting at 1, but are actually in the array starting at 1, instead of 0, then change the for statement to:
Code: [ Select ]
 for (var i = 1;i < myArray.length +1; i++){

and in your scrolling code, just check the showMyClips variable

function (or code)
Code: [ Select ]
if (showMyClips){
} else {
  1. if (showMyClips){
  2.  doScrollingStuff;
  3. } else {
  4.  doNothingOrSomethingElse;
  5. }

hope that helps

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 3 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.