3 Replies Latest reply on Jul 15, 2009 8:15 AM by Ned Murphy

    Interesting Array + dynamic image / button / tab quandry

    Bit Crusher

      Last week I had posted about getting a bit of clarification on dynamic tabs, as seen in this thread:

      http://forums.adobe.com/thread/458836?tstart=60

       

      The next step has my head spinning a bit.  Here's the setup:

       

      This is a slideshow viewer, ala PowerPoint.  Images are pulled in from an external directory via an array.  Dynamic tabs are also generated in an array.

       

      Right now the demo has 10 images in the first array and 6 tabs in the second array:

       

      var imageList:Array = new Array("slides/1.jpg", "slides/page2.swf", "slides/page3_chart1.swf", "slides/page4.swf", "slides/page5.swf", "slides/6.jpg", "slides/page7.swf", "slides/8.jpg", "slides/page9.swf", "slides/10.jpg", "slides/11.jpg");
      var tabList:Array = new Array("SAFETY", "EFFICACY", "SYMPTOMS", "DOSING", "SUMMARY", "RESOURCES");

       

      now, some of the images will be part of a range - as in maybe the first three would fall under the "Safety" tab, next two under "Efficacy", etc....so when a viewer clicks on a tab the player loads up the first photo in that sequence.  So:

       

      User clicks tab "X", this compares "X" with the range of images associated to "X" and loads the first in the sequence.

       

      Now, to add in more fun, there's a next and back button.  So now if someone hits the next button then they should view sequentially the next image in the "X" image array (or sub-array).

       

      and the reverse for the back button.

       

      so my first thought is that I'd need to have the AS compare Safety with the imageList Array - something like

       

      if(tabList[0]<=3){

      do something();

      }

       

      which sounds a bit too easy, but there's also the problem of passing on the result (as a var I'm guessing) so that the next and back buttons can use that to compare where the program is via the imageList array.

       

      Phew.   Any tips or a more simple way around this would be appreciated!  I think I've been over-thinking this one...

       

      Thanks!

        • 1. Re: Interesting Array + dynamic image / button / tab quandry
          Ned Murphy Adobe Community Professional & MVP

          You should put your thought process into action and see what it produces.  As you go you may realize different approaches to simplify things, and once it's working you'll have something more solid to look at and see about refining.

          • 2. Re: Interesting Array + dynamic image / button / tab quandry
            Bit Crusher Level 1

            A bit zen - and not much help, especially for someone, such as I, with a Masters in Drawing (Fine arts) and no formal programming skills whatsoever.  Producing a complex rendering of the human form = easy.

             

            I think what the problem that I'm having is how to get the image array (which could have an infinate amout of images) and the tab array (which could have anywhere from 1-6 tabs depending on the job) to associate, then pass on said variables to dynamically loaded image (holder) MC.

             

            To say that Tab 1 would cover images 1-4 all the time could possibly be easy to figure out.  On the other hand, the need is more like:

             

            Tab 1 is [i] through [n], then passing on the variable result so that first page value is set so the next button could also then compare the that page vs the next image in the linear sequence (ditto for the back button) then passing that on to the page count (dynamic text box) and loading in that page / image.

             

            back to the drawing board.

            • 3. Re: Interesting Array + dynamic image / button / tab quandry
              Ned Murphy Adobe Community Professional & MVP

              Like I said, you have ideas and you should try them... nothing too zen about that.  A degree does not define your limits or abilities...  As an artist, you may have a more creative thought process than the average programmer.  I have a few degrees, including one in Studio Art, but I still have to try things when I want to see if an untested idea will work.

               

              The solution you seem to be describing sounds viable, so pursue it.  It may be as simple as you thought it couldn't be.  You just have to keep track of where you are in the linear sequence within a set.  Variables are useful for for keeping track of things like that.