A Flash Developer Resource Site

Page 1 of 12 1234511 ... LastLast
Results 1 to 20 of 225

Thread: [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [

  1. #1
    Senior Member
    Join Date
    Jun 2001
    Location
    in the back room of a dark pub
    Posts
    454

    The MAMMA of all prototypes is finished

    I have finally finished, after 5 days a code that dynamically creates everything to do with a gallery, and while there could
    be one or two extra tweeks put in, if you are going to use it you can do it yourself. It preloads thumbnails, determines if it
    needs a scroller, loads images, scales them to a box of your choosing, preloads the main images etc etc etc.
    (MX only)

    here is the code
    [EDIT] > I have moved the code to my forum so i can update this first post so when people read this thread they get a better idea of what it is about

    Here is the protogallery code
    here is the prototgallery demo file

    NOTE: The protogallery was my first major piece of programming in Flash, and from it I learnt alot. I know there are a lot of errors and bad coding techniques in the protogallery but hey, i was just a beginner

    If you read through the entire thread you will follow my progress and my learning. You will also come to learn about imageWeaver. imageWeaver is a gallery component with full user interface and reference panel documentation that aids in the setup of the gallery.

    CURRENT RELEASE : imageWeaver 2.0.1.b12


    enjoy it if you use it, it took a lot of blood sweat and tears
    Last edited by buggedcom; 11-23-2004 at 02:06 PM.

  2. #2
    Senior Member
    Join Date
    Jun 2000
    Posts
    291
    Wow great stuff, I would love to see the .fla for that it really has a ton of applications. If you submitted it you would probably make featured .fla on the front page

  3. #3
    FK Slacker
    Join Date
    Jun 2000
    Location
    vancouver
    Posts
    3,208
    Nice work indeed! Kudos to you...

    My only comment has to do with this:

    // format is either ".jpg" or ".png" depending on the type of file you are using.

    This should be ".jpg" or ".swf", as you can't dynamically load pngs into flash...

    Again- good work...

    Cheers,

    K.

  4. #4
    Senior Member
    Join Date
    Sep 2001
    Posts
    178
    That's great work, the only suggestion I have is to make all of the prototypes be part of a subclass of movie clip so that you don't overload all of your movie clips with so much code. Then after doing all of the coding just use Object.registerClass to make one of your library movie clips an instance of that custom class. This will keep you from slowing down all of your movie clips with unnecessary methods. Great stuff, Chuckles8421

  5. #5
    Senior Member
    Join Date
    Jun 2001
    Location
    in the back room of a dark pub
    Posts
    454

    thanks for the praise... :)

    Mugen
    I would love to see the .fla for that it really has a ton of applications. If you submitted it you would probably make featured .fla on the front page
    sweet.
    I already tried to upload the file but got cut off in the process because I had to upload a large zip file which included the jpegs etc. Where would i upload it to exactly? The submissions page?

    deadbeat
    This should be ".jpg" or ".swf", as you can't dynamically load pngs into flash...
    my apologies i was under the impression that you could also load png's never tried it though so thanks for pointing that out.

    Chuckles8421,
    I had thought about doing that but i'm still teaching myself mx so it will happen eventually, but i wasn't going to stop there. I was going to turn it into a component , as suggested in another post by flashguru.

    Thanks for the feedback, it was greatly apppriciated. More will also be good though. I had thought about adding additional functions to it, such as image colour control (ie saturation, contrast that kinda stuff), rotation, print button that point to hires versions of the image, multiple galleries, image tag (ie favourites box).

  6. #6
    Senior Member
    Join Date
    Sep 2001
    Posts
    178
    Yeah, turning it into a component was basically what I was describing.

  7. #7
    Junior Member
    Join Date
    Sep 2002
    Posts
    14
    I'd love to get my hands on that .fla as that will help clear up any misunderstandings in the code. How big is the file? Maybe you can upload it to a geocities or the like site and have it up for download? Awesome work! Make it into a component and you know i'll be one of the first to get it!

  8. #8
    Senior Member
    Join Date
    Jun 2001
    Location
    in the back room of a dark pub
    Posts
    454
    To post the fla would be usless as it contains nothing but the code above. Everything is created dynamically and the jpegs are pulled in. All you have to do is copy the code into the first frame of a new flash movie. Set up an image folder and thumbnail folder with appropriatly sized jpg files. then change the variables as described in the code, publish and volia.

    I'm busy turning this into a component . If i'm feeling generous i will then post the component fla, but that is only if i don't think I want to keep it to myself, especially as at least two weeks work will have gone into it.

    Feel free to use this code though.

  9. #9
    Senior Member
    Join Date
    Jun 2001
    Location
    in the back room of a dark pub
    Posts
    454
    here it is the component to download
    for all of you who want it, here is the basic component (a ziped fla file). As yet all but the thumbnail blinking and the control over the thumbnail scrollbar end position are not yet done, but you can now create more than one agallery per page now! I thought i might aswell upload the nearly finished version for you all before the weekend. I will get around to updating it on Monday.

    I'm taking a break, going to da beach for a little r'n'r.

    Enjoy.


    http://buggedcom.50megs.com/photogallery.html

  10. #10
    Junior Member
    Join Date
    Sep 2002
    Posts
    14
    Originally posted by buggedcom
    I have finally finished, after 5 days a code that dynamically creates everything to do with a gallery, and while there could be one or two extra tweeks put in, if you are going to use it you can do it yourself. It preloads thumbnails, determines if it needs a scroller, loads images, scales them to a box of your choosing, preloads the main images etc etc etc.
    (MX only)

    here is my test file
    http://buggedcom.50megs.com/protogallery.html

    Found some uber uber slight bugs in the script so quickly fixed them to save others the trouble.
    // If you would like to see this in action please go to
    // http://buggedcom.50megs.com/protogallery.html
    //
    MovieClip.prototype.photoGallery = function(path, trgt, seed, maxSeed, format, fIn, thumbX, thumbY, thumbOutline, maskHeight, arrowSize, scrollSpeed, w, h, lbH, dist, jpgLoadTxt, txtXPos, txtYPos, txtStyle, fontName, txtSize, txtClr, html, bold, Italic, boxWidth, boxHeight, imageX, imageY, boxCentred, imageCentred, trgtImage) {
    _global.maxSeed = maxSeed;
    _global.seed = seed;
    _global.path = path;
    _global.thumbX = thumbX;
    _global.thumbY = thumbY;
    _global.format = format;
    _global.trgtImage = trgtImage;
    _global.imageCentred = imageCentred;
    _global.dist = dist;
    _global.boxWidth = boxWidth;
    _global.imageX = imageX;
    _global.imageY = imageY;
    _global.fIn = fIn;
    _global.scrollSpeed = scrollSpeed;
    seedOrig = seed;
    path._x = thumbX;
    path._y = thumbY;
    imageBox(boxHeight, imageY, boxCentred);
    thumbBox(thumbOutline, maskHeight);
    howManyNails(txtStyle, jpgLoadTxt, txtXPos, txtYPos, fontName, txtSize, txtClr, bdr, bdrClr, html, bold, italic);
    path.createEmptyMovieClip("thumbs", 1);
    path.thumbs._x = -dist;
    scrollMask(maskHeight, thumbX, thumbY);
    loadThumbnails(trgt, format, dist, prev_x, prev_w);
    drawBar(w, h, lbH, dist);
    onEnterFrame = function () {
    imageProgressBarRun();
    removeImageBar();
    imageSquash();
    imageCentre();
    loadIn(path.imageStuff.image);
    needArrows(arrowSize, dist, h);
    path.thumbs["thumb"+seed].onPress = Press;
    path.thumbs["thumb"+seed].onRelease = Release;
    path.thumbs["thumb"+seed].onEnterFrame = EnterFrame;
    if (allFadedIn != true) {
    loadingBarRun(txtStyle);
    if (seed){
    prev_x = path.thumbs["thumb"+seed]._x;
    prev_w = path.thumbs["thumb"+seed]._width;
    if (path.thumbs["thumb"+seed]._width>0) {
    removeBars();
    if (path.thumbs["thumb"+seed]._alpha>=100) {
    _global.seed = seed += 1;
    drawBar(w, h, lbH, dist, prev_x, prev_w);
    loadThumbnails(trgt, format, dist, prev_x, prev_w);
    } else {
    loadIn(path.thumbs["thumb"+seed]);
    }
    }
    } else if (seed == maxSeed && path.thumbs["thumb"+seed]._width>0) {
    loadOut(path.totalLB);
    loadOut(path.totalLBB);
    path[jpgLoadTxt].removeTextField();
    removeBars();
    loadIn(path.thumbs["thumb"+maxSeed]);
    if (path.thumbs["thumb"+seed]._alpha>100) {
    allFadedIn = true;
    }
    }
    }
    };
    };
    //
    // Fading functions
    //
    function loadIn(mc) {
    if (mc.getBytesLoaded() == mc.getBytesTotal() && mc._alpha<100 && mc._width>0) {
    if (mc._alpha<100) {
    mc._alpha += fIn;
    }
    }
    }
    function loadOut(mc) {
    mc._alpha -= fIn;
    }
    //
    // Thumbnail loading, masking and scrolling functions
    //
    function thumbAlign() {
    if (alignThumbs == true) {
    _global.thumbX = thumbX=boxWidth-2*thumbX;
    }
    }
    function loadThumbnails(trgt, format, dist, prev_x, prev_w) {
    path.thumbs.createEmptyMovieClip("thumb"+seed, seed).loadMovie(trgt+seed+format+"?nocache="+getDa te(), path.thumbs["thumb"+seed]);
    path.thumbs["thumb"+seed]._alpha = 0;
    path.thumbs["thumb"+seed]._x = prev_x+prev_w+dist;
    }
    function scrollMask(maskHeight, thumbX, thumbY) {
    path.createEmptyMovieClip("scrollMask", maxSeed+5);
    path.thumbs.setMask(path.scrollMask);
    path.scrollMask.lineStyle(.25, 0x999999, 100);
    path.scrollMask.beginFill(0xFF0000, 40);
    path.scrollMask.moveTo(0, 0);
    path.scrollMask.lineTo(Stage.width-2*thumbX, 0);
    path.scrollMask.lineTo(Stage.width-2*thumbX, maskHeight);
    path.scrollMask.lineTo(0, maskHeight);
    path.scrollMask.lineTo(0, 0);
    path.scrollMask.endFill();
    }
    function thumbBox(thumbOutline, maskHeight) {
    if (thumbOutline == true) {
    path.createEmptyMovieClip("thumbBox", 2);
    path.thumbBox.lineStyle(.25, 0x999999, 100);
    path.thumbBox.moveTo(-2, -2);
    path.thumbBox.lineTo(Stage.width-2*thumbX+2, -2);
    path.thumbBox.lineTo(Stage.width-2*thumbX+2, maskHeight+2);
    path.thumbBox.lineTo(-2, maskHeight+2);
    path.thumbBox.lineTo(-2, -2);
    }
    }
    function needArrows(arrowSize, dist, h) {
    if (path.scrollMask._width) {
    if (runMeOnce != true) {
    drawArrows(arrowSize);
    placeArrows(arrowSize, dist, h);
    runMeOnce == true;
    path.arrows.arrowLeft._alpha = path.arrows.arrowRight._alpha=100;
    }
    path.arrows.arrowLeft.onPress = pAL;
    path.arrows.arrowRight.onPress = pAR;
    path.arrows.onMouseUp = rA;
    path.thumbs.onEnterFrame = scrollDirection;
    }
    }
    function drawArrows(arrowSize) {
    path.createEmptyMovieClip("arrows", 3);
    path.arrows.createEmptyMovieClip("arrowLeft", 1);
    path.arrows.arrowLeft.lineStyle(.25, 0x999999, 100);
    path.arrows.arrowLeft.beginFill(0x666666, 40);
    path.arrows.arrowLeft.moveTo(0, 0);
    path.arrows.arrowLeft.lineTo(0, 3*arrowSize/5);
    path.arrows.arrowLeft.lineTo(-arrowSize/2, 3*arrowSize/5);
    path.arrows.arrowLeft.lineTo(-arrowSize/2, 4*arrowSize/5);
    path.arrows.arrowLeft.lineTo(-arrowSize, 3*arrowSize/10);
    path.arrows.arrowLeft.lineTo(-arrowSize/2, -arrowSize/5);
    path.arrows.arrowLeft.lineTo(-arrowSize/2, 0);
    path.arrows.arrowLeft.lineTo(0, 0);
    path.arrows.arrowLeft.endFill();
    path.arrows.createEmptyMovieClip("arrowRight", 2);
    path.arrows.arrowRight.lineStyle(.25, 0x999999, 100);
    path.arrows.arrowRight.beginFill(0x666666, 40);
    path.arrows.arrowRight.moveTo(0, 0);
    path.arrows.arrowRight.lineTo(arrowSize/2, 0);
    path.arrows.arrowRight.lineTo(arrowSize/2, -arrowSize/5);
    path.arrows.arrowRight.lineTo(arrowSize, 3*arrowSize/10);
    path.arrows.arrowRight.lineTo(arrowSize/2, 4*arrowSize/5);
    path.arrows.arrowRight.lineTo(arrowSize/2, 3*arrowSize/5);
    path.arrows.arrowRight.lineTo(0, 3*arrowSize/5);
    path.arrows.arrowRight.lineTo(0, 0);
    path.arrows.arrowRight.endFill();
    }
    function placeArrows(arrowSize, dist, h) {
    if (thumbX+5>arrowSize) {
    path.arrows.arrowLeft._x = -1.2*dist-5;
    path.arrows.arrowRight._x = Stage.width-2*thumbX+dist+5;
    path.arrows.arrowRight._y = path.arrows.arrowLeft._y=arrowSize/5;
    } else {
    path.arrows.arrowLeft._x = arrowSize+5;
    path.arrows.arrowRight._x = 2*arrowSize;
    path.arrows.arrowRight._y = path.arrows.arrowLeft._y=-arrowSize-2*h;
    }
    }
    function pAL() {
    path.thumbs.thumbsMove = -1;
    path.thumbs.thumbsSlowDown=0;

    }
    function pAR() {
    path.thumbs.thumbsMove = 1;
    path.thumbs.thumbsSlowDown=0;

    }
    function rA() {
    path.thumbs.thumbsSlowDown=1;
    }
    function scrollDirection() {
    if (path.thumbs.thumbsMove == 1) {
    if(runOncei!=true){
    path.thumbs.scrollSpeed= scrollSpeed;
    runOncei=true;
    }
    if(path.thumbs.thumbsSlowDown==0){
    runOncei=false;
    }
    path.thumbs._x -= path.thumbs.scrollSpeed;
    if (path.thumbs._x<-(path.thumbs._width)+(Stage.width-(2*thumbX))){
    path.thumbs._x = -(path.thumbs._width)+(Stage.width-(2*thumbX));
    }
    } else if (path.thumbs.thumbsMove == -1) {
    if(runOncei!=true){
    path.thumbs.scrollSpeed= scrollSpeed;
    runOncei=true;
    }
    if(path.thumbs.thumbsSlowDown==0){
    runOncei=false;
    }
    path.thumbs._x += path.thumbs.scrollSpeed
    if (path.thumbs._x>-dist) {
    path.thumbs._x = -dist;
    }
    }
    if (path.thumbs.thumbsSlowDown==1 && path.thumbs.thumbsMove == 1){
    path.thumbs.scrollSpeed=0.85*path.thumbs.scrollSpe ed;
    if(path.thumbs.scrollSpeed<=0.05 ){
    path.thumbs.thumbsMove=0;
    path.thumbs.thumbsSlowDown=0;
    runOncei=false;
    }
    } else if (path.thumbs.thumbsSlowDown==1 && path.thumbs.thumbsMove == -1){
    path.thumbs.scrollSpeed=0.85*path.thumbs.scrollSpe ed;
    if(path.thumbs.scrollSpeed<=-0.05 ){
    path.thumbs.thumbsMove=0;
    path.thumbs.thumbsSlowDown=0;
    runOncei=false;
    }
    }
    }
    function drawBar(w, h, lbH, dist, prev_x, prev_w) {
    path.thumbs.createEmptyMovieClip("loadingBarBox"+s eed, 2*maxSeed+seed);
    path.thumbs["loadingBarBox"+seed]._x = prev_x+prev_w+dist;
    path.thumbs["loadingBarBox"+seed].lineStyle(.25, 0x999999, 100);
    path.thumbs["loadingBarBox"+seed].moveTo(0, h);
    path.thumbs["loadingBarBox"+seed].lineTo(w, h);
    path.thumbs["loadingBarBox"+seed].lineTo(w, h-lbH);
    path.thumbs["loadingBarBox"+seed].lineTo(0, h-lbH);
    path.thumbs["loadingBarBox"+seed].lineTo(0, h);
    path.thumbs.createEmptyMovieClip("loadingBar"+seed , maxSeed+seed);
    path.thumbs["loadingBar"+seed]._xscale = 0;
    path.thumbs["loadingBar"+seed]._x = prev_x+prev_w+dist;
    path.thumbs["loadingBar"+seed].lineStyle(.25, 0x999999, 0);
    path.thumbs["loadingBar"+seed].beginFill(0x999999, 100);
    path.thumbs["loadingBar"+seed].moveTo(0, h);
    path.thumbs["loadingBar"+seed].lineTo(w, h);
    path.thumbs["loadingBar"+seed].lineTo(w, h-lbH);
    path.thumbs["loadingBar"+seed].lineTo(0, h-lbH);
    path.thumbs["loadingBar"+seed].lineTo(0, h);
    path.thumbs["loadingBar"+seed].endFill();
    }
    function loadingBarRun(txtStyle) {
    path.thumbs.byteL = path.thumbs["thumb"+seed].getBytesLoaded();
    path.thumbs["loadingBar"+seed]._xscale = (path.thumbs.byteL/path.thumbs["thumb"+seed].getBytesTotal())*100;
    loadingTxt(txtStyle);
    path.totalLB._xscale = (seed/maxSeed)*100;
    }
    function removeBars() {
    path.thumbs["loadingBar"+seed].removeMovieClip();
    path.thumbs["loadingBarBox"+seed].removeMovieClip();
    if (path.totalLB._alpha<0) {
    path.totalLB.removeMovieClip();
    path.totalLBB.removeMovieClip();
    }
    }
    //
    // Thumbnail loading progress functions
    //
    function howManyNails(txtStyle, jpgLoadTxt, txtXPos, txtYPos, fontName, txtSize, txtClr, bdr, bdrClr, html, bold, italic) {
    path.createTextField(jpgLoadTxt, maxSeed, txtXPos, txtYPos, 200, 10);
    path[jpgLoadTxt].autosize = true;
    path[jpgLoadTxt].html = html;
    path[jpgLoadTxt].type = "dynamic";
    path[jpgLoadTxt].wordWrap = true;
    path[jpgLoadTxt].selectable = false;
    textFormat = new TextFormat();
    textFormat.font = fontName;
    textFormat.size = txtSize;
    textFormat.color = "0x"+txtClr;
    textFormat.bold = bold;
    textFormat.italic = italic;
    path[jpgLoadTxt].setNewTextFormat(textFormat);
    loadingTxt(txtStyle);
    xWidth = path[jpgLoadTxt].textWidth+10;
    yHeight = path[jpgLoadTxt].textHeight/2;
    path.createEmptyMovieClip("totalLBB", maxSeed+4);
    path.totalLBB._x = xWidth;
    path.totalLBB._y = txtYPos;
    path.totalLBB.lineStyle(.25, 0x999999, 100);
    path.totalLBB.moveTo(0, yHeight);
    path.totalLBB.lineTo(60, yHeight);
    path.totalLBB.lineTo(60, yHeight+(yHeight/2));
    path.totalLBB.lineTo(0, yHeight+(yHeight/2));
    path.totalLBB.lineTo(0, yHeight);
    path.createEmptyMovieClip("totalLB", maxSeed+3);
    path.totalLB._x = xWidth;
    path.totalLB._y = txtYPos;
    path.totalLB.lineStyle(.25, 0x999999, 0);
    path.totalLB.beginFill(0x999999, 100);
    path.totalLB.moveTo(0, yHeight);
    path.totalLB.lineTo(60, yHeight);
    path.totalLB.lineTo(60, yHeight+(yHeight/2));
    path.totalLB.lineTo(0, yHeight+(yHeight/2));
    path.totalLB.lineTo(0, yHeight);
    path.totalLB.endFill();
    path.totalLB._xscale = 0;
    }
    function loadingTxt(txtStyle) {
    if (txtStyle == 1) {
    path[jpgLoadTxt].text = maxSeed-seed+" thumbnails left to load. ";
    } else if (txtStyle == 2) {
    path[jpgLoadTxt].text = seed+" out of "+maxSeed+" thumbnails have loaded. ";
    } else if (txtStyle == 3) {
    if (maxSeed<10) {
    addSpace = " ";
    } else if (maxSeed<100) {
    addSpace = " ";
    } else if (maxSeed<1000) {
    addSpace = " ";
    }
    path[jpgLoadTxt].text = " "+seed+" / "+maxSeed+addSpace;
    } else if (txtStyle == 4) {
    path[jpgLoadTxt].text = "There are "+(maxSeed-seed)+" more thumbnails to load. ";
    }
    }
    //
    // Main image box, loading, progress, positioning and size control functions
    //
    function imageBox(boxHeight, imageY, boxCentred) {
    path.createEmptyMovieClip("imageStuff", -10);
    if (boxCentred == true) {
    _global.imageX = imageX=((Stage.width/2)-(boxWidth/2));
    }
    path.imageStuff.createEmptyMovieClip("imageBox", -10);
    path.imageStuff.imageBox._x = -thumbX;
    path.imageStuff.imageBox._y = -thumbY;
    path.imageStuff.imageBox.lineStyle(.25, 0x999999, 100);
    path.imageStuff.imageBox.beginFill(0xffffff, 100);
    path.imageStuff.imageBox.moveTo(imageX, imageY);
    path.imageStuff.imageBox.lineTo(imageX+boxWidth, imageY);
    path.imageStuff.imageBox.lineTo(imageX+boxWidth, imageY+boxHeight);
    path.imageStuff.imageBox.lineTo(imageX, imageY+boxHeight);
    path.imageStuff.imageBox.lineTo(imageX, imageY);
    path.imageStuff.imageBox.endFill();
    path.imageStuff.createEmptyMovieClip("image", -9);
    path.imageStuff.image._x = -thumbX+imageX;
    path.imageStuff.image._y = -thumbY+imageY;
    }
    function imageLoad() {
    path.imageStuff.image._alpha = 0;
    path.imageStuff.image.loadMovie(trgtImage+path.iLo adNumber+format+"?nocache="+getDate(), 1);
    }
    function imageProgressBar() {
    barWidth = boxWidth/2;
    barHeight = barWidth/30;
    if (barHeight<5) {
    barHeight = 5;
    }
    path.imageStuff.createEmptyMovieClip("imageLoading BarBox", maxSeed+2);
    path.imageStuff.imageLoadingBarBox.lineStyle(.25, 0x999999, 100);
    path.imageStuff.imageLoadingBarBox.moveTo(0, 0);
    path.imageStuff.imageLoadingBarBox.lineTo(barWidth , 0);
    path.imageStuff.imageLoadingBarBox.lineTo(barWidth , barHeight);
    path.imageStuff.imageLoadingBarBox.lineTo(0, barHeight);
    path.imageStuff.imageLoadingBarBox.lineTo(0, 0);
    path.imageStuff.createEmptyMovieClip("imageLoading Bar", maxSeed+1);
    path.imageStuff.imageLoadingBar.lineStyle(.25, 0x999999, 0);
    path.imageStuff.imageLoadingBar.beginFill(0x666666 , 100);
    path.imageStuff.imageLoadingBar.moveTo(0, 0);
    path.imageStuff.imageLoadingBar.lineTo(barWidth, 0);
    path.imageStuff.imageLoadingBar.lineTo(barWidth, barHeight);
    path.imageStuff.imageLoadingBar.lineTo(0, barHeight);
    path.imageStuff.imageLoadingBar.lineTo(0, 0);
    path.imageStuff.imageLoadingBar.endFill();
    path.imageStuff.imageLoadingBar._xscale = 0;
    path.imageStuff.imageLoadingBarBox._x = path.imageStuff.imageLoadingBar._x=-thumbX+imageX+boxWidth/4;
    path.imageStuff.imageLoadingBarBox._y = path.imageStuff.imageLoadingBar._y=-thumbY+imageY+(2*path.imageStuff.imageBox._height/3);
    }
    function imageProgressBarRun() {
    path.imageStuff.imageLoadingBar._xscale = (path.imageStuff.image.getBytesLoaded()/path.imageStuff.image.getBytesTotal())*100;
    }
    function removeImageBar() {
    if (path.imageStuff.imageLoadingBar._xscale>=100) {
    path.imageStuff.imageLoadingBar.removeMovieClip();
    path.imageStuff.imageLoadingBarBox.removeMovieClip ();
    }
    }
    function imageCentre() {
    if (imageCentred == true && path.imageStuff.image._width>0) {
    if (r1 != true) {
    pIX = path.imageStuff.image._x;
    pIY = path.imageStuff.image._y;
    r1 = true;
    }
    path.imageStuff.image._x = pIX+(path.imageStuff.imageBox._width-path.imageStuff.image._width)/2;
    path.imageStuff.image._y = pIY+(path.imageStuff.imageBox._height-path.imageStuff.image._height)/2;
    }
    }
    function imageSquash() {
    if (path.imageStuff.image._width>path.imageStuff.imag eBox._width && path.imageStuff.image._height0) {
    path.imageStuff.image._xscale = (path.imageStuff.imageBox._width/path.imageStuff.image._width)*100;
    path.imageStuff.image._yscale = path.imageStuff.image._xscale;
    } else if (path.imageStuff.image._height>path.imageStuff.ima geBox._height && path.imageStuff.image._width0) {
    path.imageStuff.image._yscale = (path.imageStuff.imageBox._height/path.imageStuff.image._height)*100;
    path.imageStuff.image._xscale = path.imageStuff.image._yscale;
    } else if (path.imageStuff.image._height>path.imageStuff.ima geBox._height && path.imageStuff.image._width>path.imageStuff.image Box._width && path.imageStuff.image._width>0) {
    xS = (path.imageStuff.imageBox._width/path.imageStuff.image._width)*100;
    yS = (path.imageStuff.imageBox._height/path.imageStuff.image._height)*100;
    if (xS){
    path.imageStuff.image._xscale = path.imageStuff.image._yscale=xS;
    } else if (xS>yS) {
    path.imageStuff.image._xscale = path.imageStuff.image._yscale=yS;
    }
    }
    }
    function squashReset() {
    path.imageStuff.image._xscale = path.imageStuff.image._yscale=100;
    }
    //
    // Image selection functions
    //
    function Release() {
    if (path.iLoadNumber != this.iNumber) {
    this.b = true;
    path.iLoadNumber = this.iNumber;
    squashReset();
    imageLoad();
    imageProgressBar();
    }
    }
    function ReleaseOutside() {
    this.b = false;
    }
    function EnterFrame() {
    if (this.runOnce != true) {
    this.iNumber = seed;
    this.runOnce = true;
    }
    if (this.b == true) {
    this.blink();
    }
    }
    MovieClip.prototype.blink = function() {
    (this.blinkTimer == null) ? this.blinkTimer=getTimer()+40 : null;
    if (getTimer()>=this.blinkTimer) {
    this.times += 0.5;
    if (this.times == .5 || this.times == 1.5) {
    this._alpha = 30;
    } else if (this.times == 1 || this.times == 2) {
    this._alpha = 100;
    }
    this.blinkTimer = null;
    }
    if (this.times>=2) {
    this._alpha = 100;
    this.blinkTimer = null;
    this.b = false;
    this.times = 0;
    }
    };
    //
    //
    //usage
    //
    //
    _root.createEmptyMovieClip("empty", 1);
    photoGallery(_root.empty/*path*/, "thumbnails/DCP_"/*target*/, 1/*seed*/, 15/*maxSeed*/, ".jpg"/*format*/, 10/*fIn*/, 254/*thumbX*/, Stage.height-100/*thumbY*/, false/*thumbOutline*/, 80/*maskHeight*/, 15/*arrowSize*/, 10/*scrollSpeed*/, 50/*w*/, 10/*h*/, 3/*lBh*/, 5/*dist*/, jpgCount/*jpgLoadTxt*/, 0/*txtXPos*/, -20/*txtYPos*/, 2/*txtStyle*/, "Arial"/*fontName*/, 11/*txtSize*/, 999999/*txtClr*/, false/*html*/, false/*bold*/, false/*italic*/, 300/*boxWidth*/, 300/*boxHeight*/, 0/*imageX*/, 50/*imageY*/, true/*boxCentred*/, true/*imageCentred*/, "images/DCP_"/*trgtImage*/);
    //
    //
    //
    // This prototype assumes that the thumbnails and images are labeled in a consecutive order
    // for example, the thumbnails go th_1, th_2, th_3 etc and the corresponding pictures have to
    // go im_1, im_2, im_3 etc etc.
    //
    // Explaination of variables below:
    // path is the target path to the empty mc that the gallery will load into.
    // trgt is the directory to the thumbnails including the name beginner (ie thumbnails/DCP_45, the trgt = thumbnails/DCP_)
    // seed is the begining thumnail that you want to load.
    // maxSeed is the final image in the series, or the final image that you want loaded in.
    // format is either ".jpg" or ".swf" depending on the type of file you are using.
    // fIn is the fading in and out rate of the thumbails and other stuff.
    // thumbX is the starting x position of the thumbnails.
    // thumbY is the starting y position of the thumbnails.
    // thumbOutline is either true or false depending on if you want a border around the thumbnail scroller.
    // maskHeight is the height of the mask that hides the other thumbs in the scroller.
    // arrowSize is the size of the arrows in the scroller.
    // scrollSpeed is the rate in which you can scroll through the thumbs.
    // w is the width of the thumbnail loading bar.
    // h is the y position of the thumbnail loading bar.
    // lbH is the height of the thumbnail loading bar.
    // dist is the distance apart you want the thumnails from each other.
    // jpgLoadTxt is what you want to name the created txt box ( in " " ) to see how many thumbs are left to load.
    // txtXPos is the x position of the how many left to load txt box.
    // txtYPos is the y position of the how many left to load txt box.
    // txtStyle is the syle in which you will count down the loading thumbnails ( 1,2,3,4 ) .
    // // // 1 = 241 thumbnails left to load.
    // // // 2 = 9 out of 250 thumbnails have loaded.
    // // // 3 = 9 / 250
    // // // 4 = There are 241 more thumnails left to load.
    // fontName is the name of the system font you want to use for the how many left to load txt box ( ie "Arial").
    // txtSize is the size of the font for the how many left to load txt box.
    // txtClr is the text colour of the how many left to load txt box ( in hex form, ie for white FFFFFF ).
    // html is true or false depending if you want the html format switched on or of for the how many left to load txt box.
    // bold is true or false for the how many left to load txt box.
    // italic is true or false for the how many left to load txt box.
    // boxWidth is the width of the image box.
    // boxHeight is the height of the image box.
    // imageX is the x position of the image box.
    // imageY is the y position of the image box.
    // boxCentred is true or false depending on if you want the image box centred to the stage along the x-axis. If true, it overides imageX but not imageY.
    // imageCentred is true or false depending if you want to centre the loaded photo to the middle of the image box.
    // trgtImage is the target directory that you images are stored in including the name beginner (ie images/DCP_45, the trgtImage = images/DCP_)
    //
    // That's about all i can be arsed to explain. It is a long code and it is my first major piece of programming so although I think it's top notch
    // I'm sure it could be narrowed down somewhat. If you have any additions or changes to the script please post them, it'll be great feedback
    // for me.
    //
    // ta ta
    // buggedcom
    // (aka OliverLillie)
    // courteously debugged by d-lee
    cheers, again, thanks to bugged com for his blood sweat and tears!

  11. #11
    Junior Member
    Join Date
    Sep 2002
    Posts
    14
    NEED HELP! argh..
    most of this code is VERY clear but for some reason, i keep getting this error, no matter which directory i place the .fla
    [QUOTE]
    Error opening URL "file:///C|/thumbnails/AO_1.jpg?nocache="
    [/QUOTE/

    well... it varies depending on which directory... but yeah... can someone help explain why this is?

  12. #12
    Member
    Join Date
    Jun 2002
    Posts
    42
    Found something interesting with the script:

    After copying and pasting the code into a new frame, it works fine, and has no syntax errors......however try switching from expert to normal mode when editing the text....it keeps saying there ARE errors.....what gives?

    Anyway, I'm trying to work out how to get this to display a group of 450x300 pixel .jpgs, using the same files for both the main display, and the small thumbnails......having a bit of trouble working out where to resize the images. If anyone can point me in the right direction, I'd be most grateful.

  13. #13
    Senior Member
    Join Date
    Jul 2000
    Posts
    107
    your fla file isnt opening
    can u check that

  14. #14
    Member
    Join Date
    Jun 2002
    Posts
    42
    dan_lee312, try publishing it in a .html page, it works fine then.

    I've been getting the same problem when trying to run it through the flash player.

  15. #15
    Member
    Join Date
    Jun 2002
    Posts
    42

    help with resize

    argh!!! I can't get anything to resize.....even the code for imageSquash() isn't happening, the large images are going over the bounds of the display box......help......plz.......

  16. #16
    Senior Member
    Join Date
    Jul 2000
    Posts
    107
    Originally posted by Dominum
    dan_lee312, try publishing it in a .html page, it works fine then.
    I mean the Fla file isnt opening in flash mx

  17. #17
    Junior Member
    Join Date
    Sep 2002
    Posts
    14
    oh, yeah, the component doesn't work for me either. Its not a fully completed version either, according to buggedcom. Uhmm... dominium, it works (error doesn't pop-up) when i publish it to html, but the images don't show... u get the images to show up do you? hmm... wierd... some black image in the background shows up... gots nothing to do with the images i put in the folder... can't really describe the mess of black but yeah...
    -Dan

    anyone else know what this is about?

  18. #18
    Junior Member
    Join Date
    Sep 2002
    Posts
    14
    Originally posted by rahul696
    Originally posted by Dominum
    dan_lee312, try publishing it in a .html page, it works fine then.
    I mean the Fla file isnt opening in flash mx
    ]

    use the code rahul696. Copy and paste it into the first frame's keyframe. Thats how i'm using it. The component .fla file doesn't seem to work for me.

  19. #19
    Senior Member
    Join Date
    Jun 2001
    Location
    in the back room of a dark pub
    Posts
    454

    I here a lot of you are having trouble...

    ... with the downloaded component. That's strange because i can download it from mine and my partners computer fine for it to work in MX. what are you all downloading it from (mac, pc?). I'm on mac and have had troubles with pc fla files, maybe it goes both ways. I find that if i double click a pc fla file it won't open in mx, but if i open it through the menu the file opens fine. Try that either way. If it's still not working If it's still not working try the upload at actionscript.org

    http://www.actionscripts.org/forums/...0049#post70049

    or post your email or send me one via my profile and i will send you the most recent update of the component, zipped. But for now i will try to alter my storage sttings so that you can download zipped files. It's free storage so it's a little ****ty so you'll have to bear with. - just tried to change settings and won't allow it without paying. Does anybody know any free storage sites that allow remote file access? Or even better does anyone have any space that i could upload to? any hotline anyone?

    I have a question also, would it be better if i created a macromedia extension manager file for it? if so, how would i accomplish this?

    the new version of the component does solve all these problems that people have been describing. The important thing to remember is that with the code, only one gallery can be implemented on the stage due to the _global variables (which were a work around due to several problems i was having with assigning the onPress commands to the thumbnails). The component allows you to install more than one gallery at a time.

    // recent updates to the component / code

    1. the length of the thumbnail scrollbar is now independant of the stage width, meaning you can set the length of the bar and the starting point, so you can control the overall placement.

    2. all of the colour and alpha settings of the dynamically drawn items are now accesible via the component parametres panel and can be changed to suit your design.

    3. there is a setting now for implementing '?=noCache' so you can test it in the flash player rather than having to fully publish the fla or so you can keep the images cached if you so wish.

    4. there are now rollover states for the arrow buttons.

    5. the thumbnail blinking has been implemented/corrected to work in the component, whether or not it works efficiently or not is not known becaus it has not yet been tested online, although it does produce the same offline results as the original code

    6. there is now an option where you can choose to squash (not enlarge) the thumbnails to the mask height. this is good for having any portrait thumbs that you want to be the same size as the other landscape thumbs.

    7. there are now four different placement settings for the arrows.... 'either' (one at either end), 'left' (both on the left hand side), 'right' (both on the right hand side), or 'custom' (where you can choose your own placement co-ordinates. The arrows also now are automatically positioned so that they sit in in the middle of the mask height.

    // expressed problems

    the fla doesn't work!
    try, as suggested above opening it through file, open. if not email me or post your email and i will send you a zipped copy that should work. It works for me.

    image squash not working?
    there have been errors in the way the forum has represented the code. it has a problem with the greater than signs. Sorry should have checked. replace these (greater than) or (less than) with the appropriate signs. Basically it doesn't read anything after them. see the code at the end of the post. it should be all present and correct because it not in code brackets. Thanks for that danlee but not all the code was there so it still doesn't work but the code below should.

    Error opening URL "file:///C|/thumbnails/AO_1.jpg?nocache="
    In the code there is a small piece of script which doesn't allow the jpgs to get sucked into the browser cache. '+"?nocache="+getDate()' (note the best way to do this is actually +getTime() because it creates an individual timestamp on each image, but the likely hood of the images changing in one day is not high so this is also good as it will keep the images in the cache for 1 day. To stop the error from happening in the flash player remove the tag from the script from the script (it occurs twice)

    fine in normal, not in expert
    this is because at the end of the script in the usage after each variable i have added the variable name surrounded in /*var name*/ to comment it. This isn't incorrect usage and doesn't affect the code yet flash still refers this as an invisible error. to stop it get rid of the comments

    I think that covers it for now. Once you all test the new component. Let me know about any suggestions or other features or heaven forbid bugs that have occured to you.

    // working code below

    working code, damn you code brackets

    see > for the working prototcode

    http://www.buggedcom.co.uk/forum/viewtopic.php?t=64
    [Edited by buggedcom on 09-16-2002 at 06:35 AM]
    Last edited by buggedcom; 04-23-2003 at 07:26 AM.

  20. #20
    Senior Member
    Join Date
    Jan 2001
    Posts
    126
    really great code!!

    I was wondering though..

    Is it possible to load the thumbs the other way around ?!?!

    lets say i have 20 thumbnails but i want to load number 20 first. I ask it because it would be a lot easier to at new pictures then. That is if you always want to have your latest pictures in front, wich i do. I could number them the otherway around, but then if i wanted to add a new image i have to rename all thumbs and images again.

    is there a easy way to turn the images around, so number 20 is shown first then 19 and etc ?!

    greetz...

    Assenoost

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