dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Burning out on this..

  1. #1
    Junior Member
    Join Date
    Apr 2007
    Location
    New York
    Posts
    4

    Burning out on this..

    hey, I'm a relative newbie to AS and have hit a snag with a project I'm working on. Its killing me. I'm using AS2 in F8. Basically, I built several fairly large image galleries using Arrays and using back/next buttons to rifle through the pics.

    Everything works fine, except that I now need the "slide description" and (1 of _ pics) displayed for each pic.

    Below is one of arrays. Sensory is the theme, thus the name of the array. Ideally, when the [1] slot is selected in the array:
    the picture 02.Luminare.jpg would be shown in the gallery_mc
    it would say 'Luminare' underneath with (2 of 23) next to it. and so on.

    Im guessing that I possibly use dynamic text boxes to call a Multidimensional array?? Im having a lot of trouble finding a way to start this...if Im right? Any ideas or guidance to start..? or even a wellknown tutorial?





    var sensoryArray:Array = new Array();
    sensoryArray[0] = "pics/01.sensory/01.hold_your_dreams_crusht.jpg";
    sensoryArray[1] = "pics/01.sensory/02.luminare.jpg";
    sensoryArray[2] = "pics/01.sensory/03.adam_sandler.jpg";
    sensoryArray[3] = "pics/01.sensory/04.sublimation.jpg";
    sensoryArray[4] = "pics/01.sensory/05.swimming_in_sky.jpg";
    sensoryArray[5] = "pics/01.sensory/06.projectionist.jpg";
    sensoryArray[6] = "pics/01.sensory/07.excrutiating_minutae.jpg";
    sensoryArray[7] = "pics/01.sensory/08.chair.jpg";
    sensoryArray[8] = "pics/01.sensory/09.hangers_in_closet.jpg";
    sensoryArray[9] = "pics/01.sensory/10.acid.jpg";
    sensoryArray[10] = "pics/01.sensory/11.awesome_cloud.jpg";
    sensoryArray[11] = "pics/01.sensory/12.light002.jpg";
    sensoryArray[12] = "pics/01.sensory/13.light04.jpg";
    sensoryArray[13] = "pics/01.sensory/14.bird_w_sun.jpg";
    sensoryArray[14] = "pics/01.sensory/15.conflagrant_happenstance.jpg";
    sensoryArray[15] = "pics/01.sensory/16.metal_oxygen.jpg";
    sensoryArray[16] = "pics/01.sensory/17.sky_tastes_candy.jpg";
    sensoryArray[17] = "pics/01.sensory/18.stadium_full_of_screaming_fans.jpg";
    sensoryArray[18] = "pics/01.sensory/19.the_chaotic_city_streets.jpg";
    sensoryArray[19] = "pics/01.sensory/20.tree.jpg";
    sensoryArray[20] = "pics/01.sensory/21.typical_sunwashd_self_conf.jpg";
    sensoryArray[21] = "pics/01.sensory/22.untitled_03.jpg";
    sensoryArray[22] = "pics/01.sensory/23.untitled_04.jpg";


    var arrayNum:Number = 0;
    gallery_mc.loadMovie(sensoryArray[arrayNum]);
    //trace(memoryArray.length - 1);


    next_btn.onRelease = function(){
    nextImage();
    }

    back_btn.onRelease = function(){
    backImage();
    }

    function nextImage(){
    if(arrayNum != sensoryArray.length - 1){
    arrayNum++;
    //arrayNum = arrayNum + 1;
    //trace("arrayNum = " + arrayNum);
    gallery_mc.loadMovie(sensoryArray[arrayNum]);
    }else {
    arrayNum = 0;
    gallery_mc.loadMovie(sensoryArray[arrayNum]);
    }
    }

    function backImage(){
    if(arrayNum != 0){
    arrayNum--;
    //trace("arrayNum = " + arrayNum);
    gallery_mc.loadMovie(sensoryArray[arrayNum]);
    }else {
    arrayNum = sensoryArray.length - 1;
    gallery_mc.loadMovie(sensoryArray[arrayNum]);
    }


    }

  2. #2
    anyone else hear that? flashpipe1's Avatar
    Join Date
    Jan 2003
    Location
    Upstate NY
    Posts
    1,930
    Create a dynamic text box, name the instance of it page_txt (or something), be sure you select Render as HTML. In your nextImage and backImage functions add something like:

    Code:
    page_txt.htmlText = arrayNum+" of "+sensoryArray.length+" pics";
    You may need a this._parent. before the page_txt, but I don't think so since you're calling a function.

    Hope that helps!!
    Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.

  3. #3
    Junior Member
    Join Date
    Apr 2007
    Location
    New York
    Posts
    4
    I understand that I should give my dynamic text boxes instance names....
    Im using title_txt (for the title of the pic) and number_txt (for the number in the array that is selected ie: 2 of 23).

    does this look right ..Im still scratching my head a little.?

    var sensoryArray:Array = new Array();
    for (var i:Number = 0; i<23; i++) {
    sensoryArray[i] = new Array();
    }
    sensoryArray[0] = ["hold your dreams crushed", "pics/01.sensory/01.hold_your_dreams_crusht.jpg" "1 of 23"];
    sensoryArray[1] = ["luminare", "pics/01.sensory/02.luminare.jpg", "2 of 23"];
    sensoryArray[2] = ["adam sandler", "pics/01.sensory/03.adam_sandler.jpg", "3 of 23"];

    var arrayNum:Number = 0;
    gallery_mc.loadMovie(sensoryArray[arrayNum][1]);
    //trace(memoryArray.length - 1);
    next_btn.onRelease = function() {
    nextImage();
    };
    back_btn.onRelease = function() {
    backImage();
    };

    function nextImage() {
    if (arrayNum != sensoryArray.length-1) {
    arrayNum++;
    //arrayNum = arrayNum + 1;
    //trace("arrayNum = " + arrayNum);
    gallery_mc.loadMovie(sensoryArray[arrayNum][1]);
    } else {
    arrayNum = 0;
    gallery_mc.loadMovie(sensoryArray[arrayNum][1]);
    }

    title_text.text = sensoryArray[arrayNum][0];

    }
    function backImage() {
    if (arrayNum != 0) {
    arrayNum--;
    //trace("arrayNum = " + arrayNum);
    gallery_mc.loadMovie(sensoryArray[arrayNum][1]);
    } else {
    arrayNum = sensoryArray.length-1;
    gallery_mc.loadMovie(sensoryArray[arrayNum][1]);
    }

    title_text.text = sensoryArray[arrayNum][0];

    }

  4. #4
    Junior Member
    Join Date
    Apr 2007
    Location
    New York
    Posts
    4

    Still stumped :(

    I understand that I should give my dynamic text boxes instance names....
    Im using title_txt (for the title of the pic) and number_txt (for the number in the array that is selected ie: 2 of 23).

    does this look right ..Im still scratching my head a little.?


    Quote:
    var sensoryArray:Array = new Array();
    for (var i:Number = 0; i<23; i++) {
    sensoryArray[i] = new Array();
    }
    sensoryArray[0] = ["hold your dreams crushed", "pics/01.sensory/01.hold_your_dreams_crusht.jpg" "1 of 23"];
    sensoryArray[1] = ["luminare", "pics/01.sensory/02.luminare.jpg", "2 of 23"];
    sensoryArray[2] = ["adam sandler", "pics/01.sensory/03.adam_sandler.jpg", "3 of 23"];

    var arrayNum:Number = 0;
    gallery_mc.loadMovie(sensoryArray[arrayNum][1]);
    //trace(memoryArray.length - 1);
    next_btn.onRelease = function() {
    nextImage();
    };
    back_btn.onRelease = function() {
    backImage();
    };

    function nextImage() {
    if (arrayNum != sensoryArray.length-1) {
    arrayNum++;
    //arrayNum = arrayNum + 1;
    //trace("arrayNum = " + arrayNum);
    gallery_mc.loadMovie(sensoryArray[arrayNum][1]);
    } else {
    arrayNum = 0;
    gallery_mc.loadMovie(sensoryArray[arrayNum][1]);
    }

    title_text.htmlText = sensoryArray[arrayNum][0];

    }
    function backImage() {
    if (arrayNum != 0) {
    arrayNum--;
    //trace("arrayNum = " + arrayNum);
    gallery_mc.loadMovie(sensoryArray[arrayNum][1]);
    } else {
    arrayNum = sensoryArray.length-1;
    gallery_mc.loadMovie(sensoryArray[arrayNum][1]);
    }

    title_text.htmlText = sensoryArray[arrayNum][0];

    }

  5. #5
    anyone else hear that? flashpipe1's Avatar
    Join Date
    Jan 2003
    Location
    Upstate NY
    Posts
    1,930
    That looks like it should work, just add:

    number_txt.htmlText = sensoryArray[arrayNum][2];

    after the title_txt line (check your names, you have title_text in your description and title_txt in your code). Also, be sure to add the , in your 'sensoryArray[0] = ' line

    Hope that helps!!
    Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.

  6. #6
    Junior Member
    Join Date
    Apr 2007
    Location
    New York
    Posts
    4
    was a away for bit, but was able to finally figure it out....
    you the man, thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center