dynamically generated border issues...

  • roarmeow
  • Professor
  • Professor
  • User avatar
  • Posts: 861
  • Loc: BKNY

Post 3+ Months Ago

aight... i've got this photogallery... and i want there to be borders around all of the images... including the one that pops up when its thumbnail is selected...

here's the situation:
got an xml document with image and text information in it...

then i've got this code:
Code: [ Select ]
//xml photo load
myPhoto = new XML();
myPhoto.ignoreWhite = true;
myPhoto.onLoad = function(success) {
    //portfolioTag = this.firstChild;
    numimages = this.firstChild.childNodes.length;
    gridx = 50;
    gridy = 50;
    num=0
     for (i=0; i<4; i++)
   for (j=0; j<6; j++) {
        num=num+1;
        picHolder = this.firstChild.childNodes[i+(j*4)];
        thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+num, num);
        thumbHolder._x = i*gridx;
        thumbHolder._y = j*gridy;
        widthphoto = i*gridx;
        thumbLoader = thumbholder.createEmptyMovieClip("thumbnail_image", 0);
        thumbLoader.loadMovie(picHolder.attributes.thmb);
        thumbHolder.title = picHolder.attributes.title;
        thumbHolder.main = picHolder.attributes.main;
        thumbholder.date = picHolder.attributes.date;
//boxes
boxx=thumbholder._x+24;
boxy=thumbholder._y+70;
_root.createEmptyMovieClip("square"+num, num);
_root["square"+num].lineStyle(2, 0x99CCCC, 100);
_root["square"+num].beginFill(0x99CCCC, 0);
_root["square"+num].moveTo(boxx, boxy);
_root["square"+num].lineTo(boxx, boxy+46);
_root["square"+num].lineTo(boxx+46, boxy+46);
_root["square"+num].lineTo(boxx+46, boxy);
_root["square"+num].endFill();
        thumbHolder.onRelease = function() {
            loader.loadMovie(this.main);
            event_txt.text = this.title;
            date_txt.text = this.date;
            _root.createEmptyMovieClip("frame",0);
            _root.frame.lineStyle(2, 0x99CCCC, 100);
            _root.frame.beginFill(0x99CCCC, 0);
            _root.frame.moveTo(loader._x, loader._y);
            _root.frame.lineTo(loader._x, (loader._y+loader._height));
            _root.frame.lineTo((loader._x+loader._width), (loader._y+loader._height));
            _root.frame.lineTo((loader._x+loader._width), loader._y);
            _root.frame.endFill();
        };
    }
};
myPhoto.load("xmlphoto.xml");
stop();
  1. //xml photo load
  2. myPhoto = new XML();
  3. myPhoto.ignoreWhite = true;
  4. myPhoto.onLoad = function(success) {
  5.     //portfolioTag = this.firstChild;
  6.     numimages = this.firstChild.childNodes.length;
  7.     gridx = 50;
  8.     gridy = 50;
  9.     num=0
  10.      for (i=0; i<4; i++)
  11.    for (j=0; j<6; j++) {
  12.         num=num+1;
  13.         picHolder = this.firstChild.childNodes[i+(j*4)];
  14.         thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+num, num);
  15.         thumbHolder._x = i*gridx;
  16.         thumbHolder._y = j*gridy;
  17.         widthphoto = i*gridx;
  18.         thumbLoader = thumbholder.createEmptyMovieClip("thumbnail_image", 0);
  19.         thumbLoader.loadMovie(picHolder.attributes.thmb);
  20.         thumbHolder.title = picHolder.attributes.title;
  21.         thumbHolder.main = picHolder.attributes.main;
  22.         thumbholder.date = picHolder.attributes.date;
  23. //boxes
  24. boxx=thumbholder._x+24;
  25. boxy=thumbholder._y+70;
  26. _root.createEmptyMovieClip("square"+num, num);
  27. _root["square"+num].lineStyle(2, 0x99CCCC, 100);
  28. _root["square"+num].beginFill(0x99CCCC, 0);
  29. _root["square"+num].moveTo(boxx, boxy);
  30. _root["square"+num].lineTo(boxx, boxy+46);
  31. _root["square"+num].lineTo(boxx+46, boxy+46);
  32. _root["square"+num].lineTo(boxx+46, boxy);
  33. _root["square"+num].endFill();
  34.         thumbHolder.onRelease = function() {
  35.             loader.loadMovie(this.main);
  36.             event_txt.text = this.title;
  37.             date_txt.text = this.date;
  38.             _root.createEmptyMovieClip("frame",0);
  39.             _root.frame.lineStyle(2, 0x99CCCC, 100);
  40.             _root.frame.beginFill(0x99CCCC, 0);
  41.             _root.frame.moveTo(loader._x, loader._y);
  42.             _root.frame.lineTo(loader._x, (loader._y+loader._height));
  43.             _root.frame.lineTo((loader._x+loader._width), (loader._y+loader._height));
  44.             _root.frame.lineTo((loader._x+loader._width), loader._y);
  45.             _root.frame.endFill();
  46.         };
  47.     }
  48. };
  49. myPhoto.load("xmlphoto.xml");
  50. stop();


now... there's two issues i want to fix... in order of importance:

#1. the last bit of code is to make a border around this big image that's selected... and it seems to work fine... except for one thing... it draws a border the size of the previous image...
for example... first time you click a thumbnail, there's no border on the big image... second time, there's a border with the dimensions of the first image, third time, the border's got the dimensions of the second image...
any ideas?

#2. i'd like to figure out how to get the first border drawing script to just draw borders around the thumbnails that exist... i tried have an if statement like this:
Code: [ Select ]
if(num<=numimages){
blah blah}
  1. if(num<=numimages){
  2. blah blah}

but it didn't work right... had the right number of boxes, but whereas the thumbnails are loaded in rows, the frames were drawn in columns...

thanks in advance and...

anyone know of any tutorials or got any scripts up their sleeves about how to dynamically generate thumbnails with the same proportions as the original image?

peace.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 10 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-2014. Ozzu® is a registered trademark of Unmelted, LLC.