Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Positioning In Dynamic Image Gallery


Hi

I have built a dynamic image gallery that works brilliantly except that the loaded image falls in the top left corner of the container.......which i have a feeling there is not much i can do about.
So is there a way of determining the image size and work off that so that I can adjust the area for the image so that it can be centralized irrespetive of image shape.

i hope you know what i mean. ( i also hope i know what I mean?)




FlashKit > Flash Help > Flash ActionScript
Posted on: 02-09-2006, 12:59 PM


View Complete Forum Thread with Replies

Sponsored Links:

Flash And XML Image Gallery Positioning.
Hi

I am using Flash 8 for this and XML to create an external/dynamic image gallery. The problem i have is that when you drag to make the screen bigger or smaller the image moves position and does not stay central. Attached is the fla for you to look at as it doesnt make much sense when describing it!

Also is there anyway to add a movable/ change size with the picture black box around the images?


thanks for any help.

View Replies !    View Related
Flash Gallery - Image Positioning & Overlapping?
Hey All,
Well i have a friend that has been following a tutorial on how to make a flash gallery, hes completed it and it all works although he does ahve a problem with some of the images overlapping and the positioning of the main frame where the images are displayed. i'm not sure what to do with this as i'm pretty new to flash. could someone have a look and correct this for him or even give us an idea of where hes went wrong.

Many Thanx :)

Link:
http://www.mediafire.com/file/jwihjazditg/gallery.fla

View Replies !    View Related
XML Photo Gallery Image Positioning Problem
I modified the AS in Lee's Introduction to XML where there was a photo gallery.

I needed to have my images centered in the event that they were different sizes.

My problem is this. Ever so often, when going through the images in the gallery a image will randomly load to the lower right hand corner.

Can somebody look at the AS and see what might be causing this rare event?

Thanks, in advance!

I have published the SWF as Flash 7/AS2 and Flash 8/AS2 using it on different websites and have the same rare issue with both.

Here's the portion where image positioning is addressed, which might be the culprit:

Code:

if (picture._alpha<100) {
picture._alpha += 10;
showWidth = picture._width;
showHeight = picture._height;
picture._x = (Stage.width/2) - (picture._width/2) +10; //based on width of left border
picture._y = (Stage.height/2) - (picture._height/2) +15;
}

Here's the complete AS
Code:

stop();

function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
//xmlData.load("photos/gallery.xml");
xmlData.load("photos/gallery.xml?cachebuster=" + new Date().getTime());
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
/////////////////////////////////////
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
showWidth = picture._width;
showHeight = picture._height;
picture._x = (Stage.width/2) - (picture._width/2) +10; //based on width of left border
picture._y = (Stage.height/2) - (picture._height/2) +15;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}

View Replies !    View Related
Photo Gallery Tutorial Problem - Image Positioning
First off, excellent tutorial, the only one of its type that actually worked for me.

I have a main movie, whose image gallery is an external SWF file, the mainframe of which is Kirupa's tute.

I've called in the external SWF using:

this.createEmptyMovieClip("workSWF", 14);
workSWF.loadMovie("work/catagories/Catagories_Advertising.swf", 14);
workSWF._x = 15
workSWF._y = 15

Unfortunately, the linked images are off center from what I position them. Even the _x, _y trick isn't working. Registration point has been moved as well, still nothing.

Also, the buttons to flip through the images don't work. But all this works well if I use loadMovieNum () function.

I would post the website up, but its pretty large considering this company I'm interning at has a huge portfolio. The total file is about 30 megs (including movie clips, images, and false starts.)

Thanks in advance!

View Replies !    View Related
Dynamic Image Caption Positioning
I have a Flash slideshow that pulls the image information from an XML file. You've probably seen these all over the place. Anyway, what I'd like to do is make the text accompanying the image to appear below or to the side of an image depending on the image dimensions. For example, if the image is vertical the flash file should be smart enough to put the caption to the right. On the otherhand, if I have a wide horizontal shot the caption would appear below it. Sounds pretty simple, but I'm not sure how to do this. Anyone seen a good tutorial or know of an easy way to automate this?

View Replies !    View Related
Problem With Mac IE And Dynamic Image Positioning
Hello all. I'm new here so I hope this goes in the right place.

I'm using MX 2004 for a photographic portfolio project. The site seems to work fine on 99% percent of systems. Unfortunatley a strange error occus when viewing the site with IE on Mac OSX.

I a dynamically loading images using LoadMovie and repostioning them so that they are centred. Sometimes with Mac IE the image doesn't get centred and is loaded with the top left corner in the centre of the screen as it would had the repositioning not happened.

This only happens sometimes and only with some images and with different images each time. I can reproduce the effect on my Mac but am stumped as to why it happens. I have ruled out the flash player version (it happens with them all) and have tried numerous export settings.

Here's the code for the loading and repositioning and the link, any ideas?

http://www.stevenewbold.co.uk

if (_root.image1loaded == false) {
//load image to empty movie clip
_root.images.createEmptyMovieClip("holder1", 1001);
_root.images.holder1.loadMovie("flashimagesmac/mike.jpg");
//loader
_root.images.attachMovie("loader", "loader1", 10);
_root.images.loader1._alpha = 50;
_root.images.loader1._xscale = 50;
_root.images.loader1._yscale = 50;
_root.images.loader1._x = _root.images.holder1._x;
_root.images.loader1._y = _root.images.holder1._y;
//check loading
_root.images.onEnterFrame = function() {
var bl = _root.images.holder1.getBytesLoaded();
var bt = _root.images.holder1.getBytesTotal();
if (bt>4) {
// if the movie has started loading
var percentage = Math.round(bl/bt*100);
var percentile = Math.round(percentage/10);
this.loader1.gotoAndPlay(percentile+1);
if (bl>=bt) {
// the movie has finished loading

//remove loader
_root.images.loader1.removeMovieClip();
//center image
_root.images.holder1._x = -(_root.images.holder1._width/2);
_root.images.holder1._y = -(_root.images.holder1._height/2);
//make sure image is visable
_root.images.holder1._visible = true;
// delete the method
delete this.onEnterFrame;
// tell the button the image is now loaded
_root.image1loaded = true;
}
}
};
}

View Replies !    View Related
Problem With Mac IE And Dynamic Image Positioning
Hello all. I'm new here so I hope this goes in the right place.

I'm using MX 2004 for a photographic portfolio project. The site seems to work fine on 99% percent of systems. Unfortunatley a strange error occus when viewing the site with IE on Mac OSX.

I a dynamically loading images using LoadMovie and repostioning them so that they are centred. Sometimes with Mac IE the image doesn't get centred and is loaded with the top left corner in the centre of the screen as it would had the repositioning not happened.

This only happens sometimes and only with some images and with different images each time. I can reproduce the effect on my Mac but am stumped as to why it happens. I have ruled out the flash player version (it happens with them all) and have tried numerous export settings.

Here's the code for the loading and repositioning and the link, any ideas?

http://www.stevenewbold.co.uk

if (_root.image1loaded == false) {
//load image to empty movie clip
_root.images.createEmptyMovieClip("holder1", 1001);
_root.images.holder1.loadMovie("flashimagesmac/mike.jpg");
//loader
_root.images.attachMovie("loader", "loader1", 10);
_root.images.loader1._alpha = 50;
_root.images.loader1._xscale = 50;
_root.images.loader1._yscale = 50;
_root.images.loader1._x = _root.images.holder1._x;
_root.images.loader1._y = _root.images.holder1._y;
//check loading
_root.images.onEnterFrame = function() {
var bl = _root.images.holder1.getBytesLoaded();
var bt = _root.images.holder1.getBytesTotal();
if (bt>4) {
// if the movie has started loading
var percentage = Math.round(bl/bt*100);
var percentile = Math.round(percentage/10);
this.loader1.gotoAndPlay(percentile+1);
if (bl>=bt) {
// the movie has finished loading

//remove loader
_root.images.loader1.removeMovieClip();
//center image
_root.images.holder1._x = -(_root.images.holder1._width/2);
_root.images.holder1._y = -(_root.images.holder1._height/2);
//make sure image is visable
_root.images.holder1._visible = true;
// delete the method
delete this.onEnterFrame;
// tell the button the image is now loaded
_root.image1loaded = true;
}
}
};
}

View Replies !    View Related
This Is A Fix To The Image Gallery Tutorial - Makes It A Fully Dynamic Gallery
After searching and reading a couple of hundred post on the truly GREAT Kirupa image gallery tutorial - and wondering why nobody has written a new tutorial or at least updated the "old" one to avoid overloading the net with flash image gallery questions.

Im trying to create a new thread that will serve as a basic startingpoint for all Kirupa gallery questions. Im no überscripter nor do I know a lot about flash, but with a little common sense and perhaps some help from all of you... oh well - here goes:

Quick Checklist:

If your JPG's wont load - Make sure you don't save them as progressive JPG's, as they wont load in Flash.
If your images dont align to the photo container movieclip it is probably because your registration point of the photo MC is set to center instead of topleft.
Below is the code I have pieced together from different posts on the subject (I would like to credit all the authors, but that would require me reading all the posts again, as I have forgotten where I got them.

It produces a gallery that loads files dynamicaly thru a phpscript and checks for maximum image height/width and scales the images to fit within the photo MC. It also sets the center of the displayed images to a given coordinate (x,y).

All in all this is a install and forget image gallery, where the only maintaining required is uploading new pictures to the image folder.

On the server the file/directory structure is:
gallery swf
filearray.php
images/file_x.jpg
file_y.jpg
etc...

This is the filearray.php - modify this to check for files in the path set in the actionscript line: this.pathToPics = "images/";


PHP Code:



  <?php  if ($dir = opendir("images")) {    while (($file = readdir($dir)) !== false) {          $cont++;      if ($file == "." || $file == "..") { } else {              $string.= ($file);          $string.= "&";          }        }      closedir($dir);  }  print($string);  ?>





This is the modified actionscript from the original Kirupa gallery script:


ActionScript Code:
// This loads the array created by filearray.php and puts it into pArray   lv = new LoadVars();  lv.load("filearray.php");  lv.onData = function(text){  pArray = text.split("&");  for (i=0; i<pArray.length-1; i++) {  trace(pArray[i]);  }  }    // variables ------------------------------------------  // put the path to your pics here, include the slashes (ie. "pics/")  // leave it blank if they're in the same directory  this.pathToPics = "images/";  // fill this array with your pics (set from filearray.php)  this.pArray = pArray;            this.fadeSpeed = 20;  this.pIndex = 0;    // MovieClip methods ----------------------------------  // d=direction; should 1 or -1 but can be any number  //loads an image automatically when you run animation  loadMovie(this.pathToPics+this.pArray[0], _root.photo);    // Center the photo at (x,y) the coordinates are set in line 69  MovieClip.prototype.centered = function(x, y) {  this._x = x-this._width/2;  this._y = y-this._height/2;  };  // Makes sure that the image fits within (wMax, hMax)  MovieClip.prototype.resize = function(wMax, hMax) {  while (this._width>wMax || this._height>hMax) {  this._xscale = this._yscale -= 1;  }  };  // This line sets max width and max height (wMax, hMax)  photo.resize(397, 297);    MovieClip.prototype.changePhoto = function(d) {      // make sure pIndex falls within pArray.length      this.pIndex = (this.pIndex+d)%this.pArray.length;      if (this.pIndex<0) {          this.pIndex += this.pArray.length;      }      this.onEnterFrame = fadeOut;  };  MovieClip.prototype.fadeOut = function() {      if (this.photo._alpha>this.fadeSpeed) {          this.photo._alpha -= this.fadeSpeed;      } else {          this.loadPhoto();      }  };  MovieClip.prototype.loadPhoto = function() {      // specify the movieclip to load images into      var p = _root.photo;      //------------------------------------------      p._alpha = 0;      p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);      this.onEnterFrame = loadMeter;  };  MovieClip.prototype.loadMeter = function() {      var i, l, t;      l = this.photo.getBytesLoaded();      t = this.photo.getBytesTotal();      if (t>0 && t == l) {          this.onEnterFrame = fadeIn;          // This line sets the (x,y) center of the image on the stage          this.photo.centered(249, 213);      } else {          trace(l/t);      }  };  MovieClip.prototype.fadeIn = function() {      if (this.photo._alpha<100-this.fadeSpeed) {          this.photo._alpha += this.fadeSpeed;      } else {          this.photo._alpha = 100;          this.onEnterFrame = null;      }  };


This should do it - the only thing I (think) I need some help with is changing the script to actually load the FIRST image, when the gallery loads. For some reason beyond my knowledge you have to click the next button for a image to load... What part of the script needs to be changed to make sure that a image is loaded on startup???

I hope someone will take the time to help develope this gallery tutorial / help file... It would be great if you added som more steps to the quick checklist... and of course fixed the load image on start problem....

View Replies !    View Related
This Is A Fix To The Image Gallery Tutorial - Makes It A Fully Dynamic Gallery
After searching and reading a couple of hundred post on the truly GREAT Kirupa image gallery tutorial - and wondering why nobody has written a new tutorial or at least updated the "old" one to avoid overloading the net with flash image gallery questions.

Im trying to create a new thread that will serve as a basic startingpoint for all Kirupa gallery questions. Im no überscripter nor do I know a lot about flash, but with a little common sense and perhaps some help from all of you... oh well - here goes:

Quick Checklist:

If your JPG's wont load - Make sure you don't save them as progressive JPG's, as they wont load in Flash.
If your images dont align to the photo container movieclip it is probably because your registration point of the photo MC is set to center instead of topleft.
Below is the code I have pieced together from different posts on the subject (I would like to credit all the authors, but that would require me reading all the posts again, as I have forgotten where I got them.

It produces a gallery that loads files dynamicaly thru a phpscript and checks for maximum image height/width and scales the images to fit within the photo MC. It also sets the center of the displayed images to a given coordinate (x,y).

All in all this is a install and forget image gallery, where the only maintaining required is uploading new pictures to the image folder.

On the server the file/directory structure is:
gallery swf
filearray.php
images/file_x.jpg
file_y.jpg
etc...

This is the filearray.php - modify this to check for files in the path set in the actionscript line: this.pathToPics = "images/";


PHP Code:



  <?php  if ($dir = opendir("images")) {    while (($file = readdir($dir)) !== false) {          $cont++;      if ($file == "." || $file == "..") { } else {              $string.= ($file);          $string.= "&";          }        }      closedir($dir);  }  print($string);  ?>





This is the modified actionscript from the original Kirupa gallery script:


ActionScript Code:
// This loads the array created by filearray.php and puts it into pArray   lv = new LoadVars();  lv.load("filearray.php");  lv.onData = function(text){  pArray = text.split("&");  for (i=0; i<pArray.length-1; i++) {  trace(pArray[i]);  }  }    // variables ------------------------------------------  // put the path to your pics here, include the slashes (ie. "pics/")  // leave it blank if they're in the same directory  this.pathToPics = "images/";  // fill this array with your pics (set from filearray.php)  this.pArray = pArray;            this.fadeSpeed = 20;  this.pIndex = 0;    // MovieClip methods ----------------------------------  // d=direction; should 1 or -1 but can be any number  //loads an image automatically when you run animation  loadMovie(this.pathToPics+this.pArray[0], _root.photo);    // Center the photo at (x,y) the coordinates are set in line 69  MovieClip.prototype.centered = function(x, y) {  this._x = x-this._width/2;  this._y = y-this._height/2;  };  // Makes sure that the image fits within (wMax, hMax)  MovieClip.prototype.resize = function(wMax, hMax) {  while (this._width>wMax || this._height>hMax) {  this._xscale = this._yscale -= 1;  }  };  // This line sets max width and max height (wMax, hMax)  photo.resize(397, 297);    MovieClip.prototype.changePhoto = function(d) {      // make sure pIndex falls within pArray.length      this.pIndex = (this.pIndex+d)%this.pArray.length;      if (this.pIndex<0) {          this.pIndex += this.pArray.length;      }      this.onEnterFrame = fadeOut;  };  MovieClip.prototype.fadeOut = function() {      if (this.photo._alpha>this.fadeSpeed) {          this.photo._alpha -= this.fadeSpeed;      } else {          this.loadPhoto();      }  };  MovieClip.prototype.loadPhoto = function() {      // specify the movieclip to load images into      var p = _root.photo;      //------------------------------------------      p._alpha = 0;      p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);      this.onEnterFrame = loadMeter;  };  MovieClip.prototype.loadMeter = function() {      var i, l, t;      l = this.photo.getBytesLoaded();      t = this.photo.getBytesTotal();      if (t>0 && t == l) {          this.onEnterFrame = fadeIn;          // This line sets the (x,y) center of the image on the stage          this.photo.centered(249, 213);      } else {          trace(l/t);      }  };  MovieClip.prototype.fadeIn = function() {      if (this.photo._alpha<100-this.fadeSpeed) {          this.photo._alpha += this.fadeSpeed;      } else {          this.photo._alpha = 100;          this.onEnterFrame = null;      }  };


This should do it - the only thing I (think) I need some help with is changing the script to actually load the FIRST image, when the gallery loads. For some reason beyond my knowledge you have to click the next button for a image to load... What part of the script needs to be changed to make sure that a image is loaded on startup???

I hope someone will take the time to help develope this gallery tutorial / help file... It would be great if you added som more steps to the quick checklist... and of course fixed the load image on start problem....

View Replies !    View Related
Image Streching For Unknown Reason In Dynamic Image Gallery
Hi everyone, this is my first time using flash.

I followed a tutorial at http://www.lukamaras.com/tutorials/a...e-gallery.html and everything is working okay, except when I view the big images they are 4x wider than they should be, stretching to the right. I think its a problem with action script maybe because I'm using cs3, and saving the file as flash 8? I'm not sure. I've included the file and the xml/photos it references in case anyone is nice enough to check out my problem.

http://www.mediafire.com/?euw1wywgnvg

Thanks! -mike

View Replies !    View Related
Dynamic Image Gallery
Hello. I'm trying to make an image gallery or scroller that is dynamic and easy to update. This is what I mean: I need to find a way to allow flash to access a group of pictures on an online folder and convert them to a flash slideshow or image scroller. Otherwise, I will have to put the images in myself whcih takes way to long. I just got dreamweaver and I'm inspired by how well it automates web site updates. I'm trying to do the same thing with flash. You can reply, e-mail, or instant message me. Your help would be greatly appreciated.

View Replies !    View Related
Dynamic Image Gallery
Anyone know where I could find more information on building a flash image gallery that automatically pulls thumbnails/full size images from a folder?

View Replies !    View Related
Dynamic Image Gallery
Hi!

Hope somebody out there can help me. I'm from Germany, so my english is not the best.

Heres my problem:

I'm trying to create an gallery with six oder seven images.
It shoul look like an black and white collage. If u point the mouse over one of the images it should turn incolor and resize it self a lot bigger ( five times or so... ). the other ones should get transparent ( alpha = 0 ).

So here is my point: My action script knownledege is quit basic. I know how to script this and that but thats all.

How the hell do I start??? Tweening alone does not work ;(

thankx Daniel

View Replies !    View Related
Dynamic XML Image Gallery
Hi,
I'm having a problem with my image gallery that you can see at www.xl70e3.com. For some reason preloader is not showing up for any of the images.

This is the script:

Code:
import mx.transitions.*;

_global.thisX = 37;
_global.thisY = 150;

_global.stageWidth = 700;
_global.stageHeight = 310;

var gallery_xml:XML = new XML();
gallery_xml.ignoreWhite = true;
gallery_xml.onLoad = function(success:Boolean) {
try {if (success) {
var images:Array = this.firstChild.childNodes;
var gallery_array:Array = new Array();
for (var i = 0; i<images.length; i++) {
gallery_array.push({src:images[i].firstChild.nodeValue});
}

displayGallery(gallery_array);
} else {
throw new Error("Unable to parse XML");
}
} catch (e_err:Error) {
trace(e_err.message);
} finally {
delete this;
}
};

gallery_xml.load("http://www.blablabla.com/123.xml");

function displayGallery(gallery_array:Array) {
var galleryLength:Number = gallery_array.length;
for (var i = 0; i<galleryLength; i++) {

var thisMC:MovieClip = this.createEmptyMovieClip("image"+i+"_mc", i);

mcLoader_mcl.loadClip(gallery_array[i].src, thisMC);

preloaderMC = this.attachMovie("preloader_mc", "preloader"+i+"_mc", 5000+i);

preloaderMC.bar_mc._xscale = 0;
preloaderMC.progress_txt.text = "0%";

thisMC._x = _global.thisX;
thisMC._y = _global.thisY;

preloaderMC._x = _global.thisX;
preloaderMC._y = _global.thisY+20;

// if you've displayed 5 columns of images, start a new row.
if ((i+1)%7 == 0) {
// reset the X and Y positions
_global.thisX = 37;
_global.thisY += 80;
} else {
_global.thisX += 80;
}
}
}

var mcLoader_mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
mclListener.onLoadStart = function() {
};

mclListener.onLoadProgress = function(target_mc, loadedBytes, totalBytes) {
var pctLoaded:Number = Math.round(loadedBytes/totalBytes*100);
var preloaderMC = target_mc._parent["preloader"+target_mc.getDepth()+"_mc"];
preloaderMC.bar_mc._xscale = pctLoaded;
preloaderMC.progress_txt.text = pctLoaded+"%";
};

mclListener.onLoadInit = function(evt:MovieClip) {
evt._parent["preloader"+evt.getDepth()+"_mc"].removeMovieClip();
var thisWidth:Number = evt._width;
var thisHeight:Number = evt._height;
var borderWidth:Number = 4;
var marginWidth:Number = 4;
evt.scale = 20;
evt.lineStyle(borderWidth, 0x000000, 100);
evt.beginFill(0xFFFFFF, 100);
evt.moveTo(-borderWidth-marginWidth, -borderWidth-marginWidth);
evt.lineTo(thisWidth+borderWidth+marginWidth, -borderWidth-marginWidth);
evt.lineTo(thisWidth+borderWidth+marginWidth, thisHeight+borderWidth+marginWidth);
evt.lineTo(-borderWidth-marginWidth, thisHeight+borderWidth+marginWidth);
evt.lineTo(-borderWidth-marginWidth, -borderWidth-marginWidth);
evt.endFill();

evt._xscale = evt.scale;
evt._yscale = evt.scale;
evt.onPress = function() {
this.startDrag();
this._xscale = 100;
this._yscale = 100;
this.origX = this._x;
this.origY = this._y;
this.origDepth = this.getDepth();
this.swapDepths(this._parent.getNextHighestDepth());
this._x = 183;
this._y = 150;
mx.transitions.TransitionManager.start(this, {type:mx.transitions.Photo, direction:0, duration:1, easing:mx.transitions.easing.Strong.easeOut, param1:empty, param2:empty});
};

evt.onRelease = function() {
this.stopDrag();
this._xscale = this.scale;
this._yscale = this.scale;
this._x = this.origX;
this._y = this.origY;
};

evt.onReleaseOutside = evt.onRelease;
};
mcLoader_mcl.addListener(mclListener);
There's gotta be something wrong in there that I just can't figure out...

And another question, while we're at it.
Is it possible to scale the pics down to some set size with automated cropping if required? So that both landscape and portrait-oriented pics would show up as say a 100x100 square? Not just by setting evt._height/width, because that screws up proportions. Maybe use part of the image and scale that down for the thumbnail? Kinda like at www.jkreps.com (check any of the photographers)... or are they creating buttons manually?

Thanks in advance

View Replies !    View Related
Dynamic Image Gallery
Hello,

I would lke to build or buy a Flash image gallery that does the following (or get the desired results):

- Using a select box or other widget, a directory name is selected
- the directory is read for image names and dumped into an array
- then as the forward or backward buttons are clicked, the image names are loaded into a variable and used as the image name parameter.
- it would also have the ability to run as a slideshow.

I am kind of new to Flash, but have some experience. I've had the above done in PHP for a long time now, but I'd really like it to work this way in flash.

If I just need some tips, perhaps there is a tutorial site you could recommend, if there is a gallery like this already built, I'd like to check it out.

I've seen a few nice ones out there, but none that do exactly what I want.

Thanks,

- dstefani

View Replies !    View Related
Help With Dynamic Image Gallery
Hi there.. I have an image gallery with two sets of code. you can see it here. If you care to take a look, you will see that the next buttons load the images successfully, and that the selector at the top fails to do so..

This code loads the scrolling images in the selection area at the top from an xml file..

Code:
myPhoto = new XML();
myPhoto.ignoreWhite = true;
myPhoto.onLoad = function(success) {
//portfolioTag = this.firstChild;
numimages = this.firstChild.childNodes.length;
spacing = 90;
for (i=0; i<numimages; i++) {
this.picHolder = this.firstChild.childNodes[i];
this.thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
this.thumbHolder._x = i*spacing;
this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 0);
this.thumbLoader.loadMovie(this.picHolder.attributes.thmb);
this.thumbHolder.title = this.picHolder.attributes.title;
this.thumbHolder.main = this.picHolder.attributes.main;
this.thumbHolder.onRelease = function() {
photo_mc._alpha = 0;
photo_mc.loadMovie(this.photo);
//photo_mc.loadMovie(this.main);
content.text = description[0];
//photo_mc.loadMovie(this.main);
//loader.loadMovie(this.main);
//title_txt.text = this.title;{
//function firstImage() {
//photo_mc.loadMovie(this.main);
//}
//}

};
}
};
myPhoto.load("images/listings/01/album_gal.xml");
this code loads the images into the movieclip (photo_mc) with the next/back button and resizes the border to fit the image

Code:
space = 10;
photo_mc._alpha = 0;

MovieClip.prototype.loadPhoto = function(photo){
photo_mc._alpha = 0;
this.loadMovie(photo);
_level0.onEnterFrame = function(){
// modified the total and loaded so as to round it up
// to smaller number.
var total = Math.round(photo_mc.getBytesTotal()/1024);
var loaded = Math.round(photo_mc.getBytesLoaded()/1024);
if (total != 0 && loaded>=total){
var w = photo_mc._width + space;
var h = photo_mc._height + space;
border.resize(w, h);
delete this.onEnterFrame;
}
}
};
MovieClip.prototype.resize = function(w, h){
//the higher the slower the resize of the border
var speed = 4;
this.onEnterFrame = function(){
this._width += (w - this._width)/speed;
this._height += (h - this._height)/speed;
if( Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1){
this._width = w;
this._height = h;
photo_mc._x = this._x - this._width/2 + space/2;
photo_mc._y = this._y - this._height/2 + space/2;
photo_mc._alpha = 100;
delete this.onEnterFrame;
}
}
};
btn1.onRelease = function() {
prevImage();
};
btn2.onRelease = function() {
nextImage();
};

These were taken from two diffrent tutorials and altered to fit my needs, but i am not 1337 enough of an actionscript coder to figure out how to incorporate these two scripts together.

Can somebody please help me with this??? Thank you in advanced =]

View Replies !    View Related
Dynamic Image Gallery
Hello,

I want to develop an image gallery that is driven via thumbnails.

Now I have the thumbnails on the stage. I want to be able to click a thumbnail and it loads the jpeg onto the stage, but I want it to fade up, and then fade away when I click on another thumbnail. Can I do this using duplicateMovieClip?

What is the easiest way?

Many thanks in advance.

View Replies !    View Related
Dynamic Image Gallery
Hi,

My name is Rajesh Kumar.

I m doing an image gallery in flash.
I hav got a file wer everything is there but i want to add some feature like multiline breaf image info.

File is attached here.

This image gallery is drag n drop.
i wanna wen u drag any image in the particular area wer image blowup beside the blow up image i wanna image information also.

i hav kept a textbox beside the image name info.

image info should change for every image drag n drop.


thanks


rajesh kumar

View Replies !    View Related
Dynamic Image Gallery.... I Did It
This is my first post, but I've been here quite a bit trying to figure out how to get actionscript to read the contents of a number of directories, gather all the images in thoes directories and then display them as galleries (with each gallery title equal to the name of the directory containing said picutes).

I coundn't find any examples that did this, but with the help of information I gathered from this site I was able to develop the code. I just wanted to share in case anyone else out there is trying to do the same:


Code:
//this script was designed to dynamically create multiple image galleries
//on the fly based on the structure and content of your web server
//
//it starts at a specified location on your server and parses all directories
//and files below that location and puts the results in an array that can be used to
//preload and display the images
//
//
//the following variables must be defined before calling this script:
//
//rootDir ... = "http://www.mywebsite.com/"//must end in "/"
//rootImageDir... = "images/gallery/"; //must end in "/"
//url... = rootDir+"lister.php?path="+rootImageDir;//see below for info on lister.php
//dirArr1... = new Array();//array to hold directory names
//imageArr ... = new Array();//array to hold image names
//dirArr2... = new Array();//nested array to hold all directories and images paths
//p... = 0;//variable to track each directory
//
//a lister.php file (displayed at the end of this script) must exist on the web server
//it's currently coded to only return .jpg files, but can be easily modifed to gather the filetype(s) of your choice
//
//the directory structure on the web server should match the
//following (or this script be changed to reflect your setup):
//
//.
//www
//images
//gallery
//directory1
//image1.jpg
//image2.jpg...
//directory2...


//create an XML listing of all the directories under rootImageDir_______________________________________
//
function listLayer1() {
varXML1 = new XML();//create new XML object for directory results
varXML1.ignoreWhite = true;//ignore white space in XML object
varXML1.load(url);//load data from php script into XML object
varXML1.onLoad = getDirList;//when XML object is fully loaded goto getDirList function
}


//create an XML listing of the contents of directories gathered in previous function____________________
//
function listLayer2() {
varXML2 = new XML();//create new XML object for image results
varXML2.ignoreWhite = true;//ignore white space in XML object
varXML2.load(url+dirArr1[p]);//load data from php script into XML object for specific directories
varXML2.onLoad = getImageList;//when XML object is fully loaded goto getImageList function
}


//parse the XML object that contains a listing of our directories (varXML1)_____________________________
//and populate the directory array (dirArr1)
//
//called by listLayer1()
//
function getDirList() {
for(i=0; i < varXML1.firstChild.childNodes.length; i++){//for each entry in varXML1 check...
if(varXML1.firstChild.childNodes[i].nodeName=="dir"){//if enty is a directory, and if it is...
dirArr1.push(varXML1.firstChild.childNodes[i].firstChild.nodeValue);//put it in the directory array
}
}
varXML1 = "";//cleanup
listLayer2(); //go after the contents once the directory array if populated
}

//parse the XML object that contains a listing of the contents of our directories (varXML2)_____________
//and poplulate the image array (dirArr2)
//
//called by listLayer2()
//
function getImageList() {
for(m=0; m < varXML2.firstChild.childNodes.length; m++){//loop through the results for each directory
if(varXML2.firstChild.childNodes[m].nodeName=="file"){//if entry is a file...
imagePath = rootDir + rootImageDir + dirArr1[p] + "/" + varXML2.firstChild.childNodes[m].firstChild.nodeValue;
imageArr.push(imagePath);//put it's full path in the files array
}
}
dirArr2[p] = new Array(dirArr1[p]);//create nested arrary with #.0 = gallery name
for(w=0; w < imageArr.length; w++){//for each image...
dirArr2[p].push(imageArr[w]);//populate nested array w/ image paths
}
p++//increment p (used in listLayer2)
if(p <= dirArr1.length -1){//if thre are more directories to parse...
listLayer2(); //request another file listing
}
else {call some funtion that processes the images();}//call a funtion that does something with the array (pre-load & display images)
imageArr = new Array();//clear imageArr for next cycle
}

//The following PHP script is to be placed in the root www folder on the web server:
//<?
////$path is sent from actionscript
//// Open the folder
//$dir_handle = @opendir($path) or die("Unable to open $path");
//echo "<?xml version='1.0' encoding='ISO-8859-1'?>";
//echo "<filelist>";
//// Loop through the files
//while ($file = (readdir($dir_handle))) {
// if($file == "." || $file == ".." || $file == "lister.php" )
//continue;
//$exploded = explode(".",$file);
//if((strtolower($exploded[1])) == "jpg"){
//echo "<file>$file</file>";
// }
//else {
//if(is_dir($path.$file)){
//echo "<dir>$file</dir>";
//}
//}
//}
//echo "</filelist>";
//// Close
//closedir($dir_handle);
//?>
Thanks for all the help! If anyone knows of a way to improve this, or is aware of another way to acheive the same results, please let me know (jd2000@gmail.com), but this code is working great for me so far.

-James

View Replies !    View Related
Dynamic Image Gallery V2
hello again all,
I am trying to put together a 'simple' gallery. I have used the script that CyanBlue provided in this post:
http://www.actionscript.org/forums/s...d.php3?t=40439
and adapted it slightly.

What I am trying to do is display an icon with an alpha of 33% to show how many images there are, preload the images in the background, and as each one loads, make the icon alpha 100% and make it an active button that can be clicked to display the image.

see that attached file. Any suggestions on the best way to do this would be great.
thanks.

View Replies !    View Related
Dynamic Image Gallery
Is there a way in flash to make a dynamic image gallery that checks a certain directory for .jpg extensions and then shows them in the gallery??

View Replies !    View Related
Dynamic Image Gallery
Hi,
I'm having a problem here with the dynamic gallery that loads data from XML. It's basically the same code as in the gallery_tween sample from Flash 8 with a few bits changed.

Here's the code:


Code:
stop();

import mx.transitions.*;

_global.thisX = 57;
_global.thisY = 150;

_global.stageWidth = 700;
_global.stageHeight = 310;

var gallery_xml:XML = new XML();
gallery_xml.ignoreWhite = true;
gallery_xml.onLoad = function(success:Boolean) {
try {if (success) {
var images:Array = this.firstChild.childNodes;
var gallery_array:Array = new Array();
for (var i = 0; i<images.length; i++) {
gallery_array.push({src:images[i].firstChild.nodeValue});
}

displayGallery(gallery_array);
} else {
throw new Error("Unable to parse XML");
}
} catch (e_err:Error) {
trace(e_err.message);
} finally {
delete this;
}
};

gallery_xml.load("http://www.blablabla.com/123.xml");

function displayGallery(gallery_array:Array) {
var galleryLength:Number = gallery_array.length;
for (var i = 0; i<galleryLength; i++) {

var thisMC:MovieClip = this.createEmptyMovieClip("image"+i+"_mc", i);

mcLoader_mcl.loadClip(gallery_array[i].src, thisMC);

preloaderMC = this.attachMovie("preloader_mc", "preloader"+i+"_mc", 5000+i);

preloaderMC.bar_mc._xscale = 0;
preloaderMC.progress_txt.text = "0%";

thisMC._x = _global.thisX;
thisMC._y = _global.thisY;

preloaderMC._x = _global.thisX;
preloaderMC._y = _global.thisY+20;

// if you've displayed 5 columns of images, start a new row.
if ((i+1)%7 == 0) {
// reset the X and Y positions
_global.thisX = 57;
_global.thisY += 80;
} else {
_global.thisX += 80+20;
}
}
}

var mcLoader_mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
mclListener.onLoadStart = function() {
};

mclListener.onLoadProgress = function(target_mc, loadedBytes, totalBytes) {
var pctLoaded:Number = Math.round(loadedBytes/totalBytes*100);
var preloaderMC = target_mc._parent["preloader"+target_mc.getDepth()+"_mc"];
preloaderMC.bar_mc._xscale = pctLoaded;
preloaderMC.progress_txt.text = pctLoaded+"%";
};

mclListener.onLoadInit = function(evt:MovieClip) {
evt._parent["preloader"+evt.getDepth()+"_mc"].removeMovieClip();
var thisWidth:Number = evt._width;
var thisHeight:Number = evt._height;
var borderWidth:Number = 4;
var marginWidth:Number = 4;
evt.scale = 20;
evt.lineStyle(borderWidth, 0x000000, 100);
evt.beginFill(0xFFFFFF, 100);
evt.moveTo(-borderWidth-marginWidth, -borderWidth-marginWidth);
evt.lineTo(thisWidth+borderWidth+marginWidth, -borderWidth-marginWidth);
evt.lineTo(thisWidth+borderWidth+marginWidth, thisHeight+borderWidth+marginWidth);
evt.lineTo(-borderWidth-marginWidth, thisHeight+borderWidth+marginWidth);
evt.lineTo(-borderWidth-marginWidth, -borderWidth-marginWidth);
evt.endFill();

evt._xscale = evt.scale;
evt._yscale = evt.scale;
evt.onPress = function() {
this.startDrag();
this._xscale = 100;
this._yscale = 100;
this.origX = this._x;
this.origY = this._y;
this.origDepth = this.getDepth();
this.swapDepths(this._parent.getNextHighestDepth());
this._x = 183;
this._y = 150;
mx.transitions.TransitionManager.start(this, {type:mx.transitions.Photo, direction:0, duration:1, easing:mx.transitions.easing.Strong.easeOut, param1:empty, param2:empty});
};

evt.onRelease = function() {
this.stopDrag();
this._xscale = this.scale;
this._yscale = this.scale;
this._x = this.origX;
this._y = this.origY;
};

evt.onReleaseOutside = evt.onRelease;
};
mcLoader_mcl.addListener(mclListener);
Now, how would I go about unloading the gallery? I have it placed on one frame, but when I want to go to some other one, the gallery is still loaded and placed above the rest of the movie. How to completely clear the frame again with a click of a button?

Thanks in advance.

View Replies !    View Related
Dynamic Image Gallery
Is there a tutorial anyone knows of where I can create an image gallery that when you click on a button the image is loaded in and shows up (even a preloader to show the image loading)? I want to do this instead of have each picture in my movie because of file size.

Thanks!

View Replies !    View Related
Dynamic Image Gallery AS2
I have dipped in almost every search engine and this site to locate some easier way to create dynamic image gallery in Flash 8 AS2 using ASP (as i am conversant with ASP only, although i found many sites suggesting PHP and XML). I'd be very greatful to u all if u could provide me some help in this part of my project.

I have tried this source also but neither the source throw any error nor it displays the images, what could be wrong with the source? Please Please Please Please Please Help me!!!!!!!!

this.createClassObject(mx.containers.ScrollPane, "scroller_sp", 10);
scroller_sp. setSize (100, 300);
swfThumbs=["imgs/img1.jpg","imgs/img2.jpg","imgs/img3.jpg"]
this.createEmptyMovieClip("clipLoader",1);
for(i=0;i< swfThumbs.length;i++){
clipLoader.createEmptyMovieClip("clip"+i+"_mc",i)
clipLoader.attachMovie("clip"+i+"_mc","clip"+i+"_mc",i+10);
clipLoader.loadMovieNum(swfThumbs,i+100);
}
scroller_sp.contentPath = clipLoader;

thanks in anticipation and regards

raajaindra





























Edited: 09/13/2007 at 12:26:10 AM by indianraaj

View Replies !    View Related
Dynamic Image Gallery
Hi all, I am new to the forum and I have a specific question about a dynamic image gallery i am making.

Everything goes well, until I want to click from a thuimbnail to see an enlarged image that is another file.
here is the specific code for that:

1) one problem is that -when I wlick one of the 5 jpegs attached- I always see the last one enlarged...
2) another problem is to go back to the thumbs after clicking the enlarged image...

PLease help me








Attach Code

//adding the thumbnails
//loading the vars
var loader:MovieClipLoader = new MovieClipLoader(); //loads the movieclip
var loader2:MovieClipLoader = new MovieClipLoader(); //loads the movieclip
var thumbPlace:MovieClip = thumbs_mc //the main movieclip on stage
var mc:MovieClip //the thumb movieclip under iteration
var lmc:MovieClip //the enlarged movieclip when RollOver/click
var mcInstance:String //the variable instance name of the thumb movieclip
//localizing the thumbplace and lmc empty movieclips
thumbPlace._x = 0
thumbPlace._y = 0
//let's make lmc
LargeMovie = _root.createEmptyMovieClip("LargeMovie", _root.getNextHighestDepth());
LargeMovie._x = 0 ;
LargeMovie._y = 0;
lmc = LargeMovie.createEmptyMovieClip("bigImage", _root.getNextHighestDepth());
lmc._x = 0
lmc._y = 0
//making the iteration
for (var i:Number=1; i<6; i++){
//making the thumbs
mcInstance = "thumb" + i //instance of the iterated movieclips
mc = thumbPlace.createEmptyMovieClip (mcInstance, thumbPlace.getNextHighestDepth()); //mc is being linked to the iteration, copying the thumbs
mc._x = i*90
mc._y = 300
var thumbPath = "Rozenhof/thumbs/" + i + ".jpg";
var bigImagePath = "Rozenhof/" + i + ".jpg";
loader.loadClip (thumbPath, mc)//loading the jpegs into the mc movieclip
var loaderListener:Object = new Object(); //making a loadlistener variable
loader.addListener (loaderListener); //make an addlistenser to the loaded movieclips
loaderListener.onLoadInit = function (target: MovieClip){
trace (target);
target.onPress = function (){
LargeMovie.enabled = true
LargeMovie._alpha = 100;
thumbPlace._alpha = 0;
loader2.loadClip (bigImagePath, lmc)
var loaderListener2:Object = new Object();
loader2.addListener (loaderListener2);
loaderListener2.onLoadInit = function (target2: MovieClip){
trace (target2)
target2.onPress = function (){
LargeMovie.enabled = false;
LargeMovie._alpha = 0;
thumbPlace._alpha = 100;
gotoAndPlay (target.onPress);
}
}
}
}
}

View Replies !    View Related
Dynamic Image Gallery
hello folks!

i need to create a dynamic image gallery. the files are defined in an array like imgs = ['img1.jpg','img2.jpg']; then i loop through the array. the images should be arranged horizontally..

how i do this?

thanks for any answer!
oliver


Code:
this.imgs = ['test.jpg','bla.jpg'];

var x = 0;
var y = 0;

var i;
for (i in imgs) {
var t = this.createEmptyMovieClip ("thumbnail" + i, i);
var c = t.createEmptyMovieClip ("picHolder", 0);
var thumb = imgs[i];
c.loadMovie (thumb);
c._x = x + i * c._width;
c._y = y;
}

View Replies !    View Related
Dynamic Image Gallery
We have loaded a series of dynamic images from a database into a thumbnail movie clips. Once clicked the thumbnail will open its image in larger dimensions.

Is there anyway to use the existing image data already preloaded in the thumbnail. At the moment it is loading twice.

Essentially is there anyway of getting the contents of one movie clip and putting it into another?

Many thanks!
J

View Replies !    View Related
Dynamic Image Gallery
Hey

I know that these issues have probably been discussed before, but I'll try anyway, since I have some minor problems.

1.I have been able to fill an array in flash with images that lies in a certain folder on my server, with the use of PHP, and this is the code:


PHP Code:



<?php$dir = opendir("images/");while ($file = readdir($dir)) {if ($file=="." or $file=="..") continue;$string.= $file;$string.= ", ";}echo "imgList=".$string;?>




I will catch the array in flash with this AS-code:


Code:
lv = new LoadVars();
lv.load("imagearray.php");

lv.onLoad = function(success) {
if (success) {
pArray = this.imgList.split(", ");
}
else {
trace("could not load file");
}
}
It works fine, except for one thing, when I first visit my site, the array is empty, it takes some surfing time on the site before the arrays start to work.

I have found out that I get this message when I trace the path:

Quote:




Error opening URL "http://www.mysite.com/mysite/image.jpg"




Do u think it's due to the server itself or the PHP ?


2.I get the images through the array on my site, now I wonder how I can create a dynamic image thumbnail scroller, the kind that moves the list with thumbnails to the left when the cursor enters the right side of the thumbnail row. This have been discussed before, but it always seem to require an xml-file, which I don't use (to be honest, because I can't see the benefit of it )

The problem is that all the thumbnails has to be dynamicly loaded into the "slideshow", i.e. read from the array and placed with a correct size, 40x40...



I would really appreciate some help here, have been working on my site for ages now, want to publish it soon!

Thanx dudes...



/henrik, sweden

ps.can Scotty step in and save the day for a person in need once again?.ds.

View Replies !    View Related
Dynamic Image Gallery With XML
OK. I know that there are tutorials on image galleries (both using an array and XML), and I have read tons of threads, including Scotty's great sticky one that summarizes all of the XML options. The one I am most interested in is the one that creates a PHP that automatically creates an array that is loaded into the flash file - this way I can just upload new images into a new folder and update the site very easily.

I can get this to work fine, however my server doesn't support PHP (I know that is a whole other issue in itself but bear with me).


That being siad, is there a way to do the same thing with XML - that is get it to automatically list the image names instead of needing to type in the names in a new file with every update?

Thanks for the help.

View Replies !    View Related
Dynamic Image Gallery / PHP Help
Background: I'm building a dynamic image gallery for a friend to showcase her design work. She is a fashion designer, and therefor her work is broken up into seasons.

Using the code from this thread, I have gotten a combination of AS and PHP to dynamically load whatever images are in a directory into the swf. That's step 1.

The catch is she needs to archive her stuff each new season, yet have it be accessible.

My PHP knowledge is essentially non-existent, so I turn to you, my invaluable Kirupa forum resource, to help me out.

What I was thinking of doing is simply having her create sub-directories for each archived season within the /archive directory; and from there, having a PHP file read each sub-directory name (or possibly a file within each directory) and then pass that on to AS where I can dynamically create buttons for each one (such as "Fall '06", "Winter2005" or something along those lines).

ALSO: the code I'm using has one slight hitch I need to try and resolve: when you reach the end of the gallery, it gets a little jenky. Is there any way for the PHP file to tell flash what the file count is, or perhaps start the gallery over?

Thank you oh so very much in advance.

View Replies !    View Related
Dynamic Image Gallery
hi guys i am lookin for similar to this image gallery

http://weedonphoto.com/gallery.php?i...04ecc5a7ed2276

dose any body knows how to get this kind of dynamic image gallery

or dose any body knows this kind of tutorial's link

View Replies !    View Related
Dynamic Image Gallery
Hello Friends,
I need your help because I have little knowledge about action script. I want to make a dynamic loaded flash gallery, which scroll horizontally through mouse position. You can here What I want to make.
http://anayaphoto.com

Please help me.


your friend
himanshu

View Replies !    View Related
Dynamic Image Gallery
hello folks!

i need to create a dynamic image gallery. the files are defined in an array like imgs = ['img1.jpg','img2.jpg']; then i loop through the array. the images should be arranged horizontally..

how i do this?

thanks for any answer!
oliver


Code:
this.imgs = ['test.jpg','bla.jpg'];

var x = 0;
var y = 0;

var i;
for (i in imgs) {
var t = this.createEmptyMovieClip ("thumbnail" + i, i);
var c = t.createEmptyMovieClip ("picHolder", 0);
var thumb = imgs[i];
c.loadMovie (thumb);
c._x = x + i * c._width;
c._y = y;
}

View Replies !    View Related
Dynamic Image Gallery
We have loaded a series of dynamic images from a database into a thumbnail movie clips. Once clicked the thumbnail will open its image in larger dimensions.

Is there anyway to use the existing image data already preloaded in the thumbnail. At the moment it is loading twice.

Essentially is there anyway of getting the contents of one movie clip and putting it into another?

Many thanks!
J

View Replies !    View Related
Dynamic Image Gallery
Hey

I know that these issues have probably been discussed before, but I'll try anyway, since I have some minor problems.

1.I have been able to fill an array in flash with images that lies in a certain folder on my server, with the use of PHP, and this is the code:


PHP Code:



<?php$dir = opendir("images/");while ($file = readdir($dir)) {if ($file=="." or $file=="..") continue;$string.= $file;$string.= ", ";}echo "imgList=".$string;?>




I will catch the array in flash with this AS-code:


Code:
lv = new LoadVars();
lv.load("imagearray.php");

lv.onLoad = function(success) {
if (success) {
pArray = this.imgList.split(", ");
}
else {
trace("could not load file");
}
}
It works fine, except for one thing, when I first visit my site, the array is empty, it takes some surfing time on the site before the arrays start to work.

I have found out that I get this message when I trace the path:

Quote:




Error opening URL "http://www.mysite.com/mysite/image.jpg"




Do u think it's due to the server itself or the PHP ?


2.I get the images through the array on my site, now I wonder how I can create a dynamic image thumbnail scroller, the kind that moves the list with thumbnails to the left when the cursor enters the right side of the thumbnail row. This have been discussed before, but it always seem to require an xml-file, which I don't use (to be honest, because I can't see the benefit of it )

The problem is that all the thumbnails has to be dynamicly loaded into the "slideshow", i.e. read from the array and placed with a correct size, 40x40...



I would really appreciate some help here, have been working on my site for ages now, want to publish it soon!

Thanx dudes...



/henrik, sweden

ps.can Scotty step in and save the day for a person in need once again?.ds.

View Replies !    View Related
Dynamic Image Gallery With XML
OK. I know that there are tutorials on image galleries (both using an array and XML), and I have read tons of threads, including Scotty's great sticky one that summarizes all of the XML options. The one I am most interested in is the one that creates a PHP that automatically creates an array that is loaded into the flash file - this way I can just upload new images into a new folder and update the site very easily.

I can get this to work fine, however my server doesn't support PHP (I know that is a whole other issue in itself but bear with me).


That being siad, is there a way to do the same thing with XML - that is get it to automatically list the image names instead of needing to type in the names in a new file with every update?

Thanks for the help.

View Replies !    View Related
Dynamic Image Gallery
I have loaded a series of dynamic images from a database into a thumbnail movie clips. Once clicked the thumbnail will open its image in larger dimensions.

Is there anyway to use the existing image data already preloaded in the thumbnail. At the moment it is loading twice.

Essentially is there anyway of getting the contents of one movie clip and putting it into another?

Many thanks
Jamie

View Replies !    View Related
Dynamic Image Gallery Help Needed
I am looking to do a photo gallery on a website that will be updated with new photos frequently. Does anyone have any samples or a direction that I can be pointed in that would allow me to quickly add photos (or change photos) in a gallery with minimal coding (or just change image file names).

Thank you in advance for any help!

Mark

View Replies !    View Related
Dynamic Image Gallery Question
Hi,

I am uing an array to create a gallery of images. This is the code I am using.


var gallery = new Array();
gallery = [ "img1.jpg", "img2.jpg", "img3.jpg", "img4.jpg", "img5.jpg", "img6.jpg"];
var textGallery = new Array();
textGallery = [ "This is the caption for image one.", "This is the caption for image two.", "This is the caption for image three.", "This is the caption for image four.", "This is the caption for image five.","This is the caption for image six."];

function buildThumbnails(colCount) {
trace("buildThumbnails");

// keep track of where the nav sits
var navX = 10;
var navY = 40;
var padding = 90;

// we look to see how many thumbs we need
var totalCount = _root.gallery.length;
trace(_root.gallery.length)

// keep track of column and row
var col = 0;
var row = 0;
// start our attach
for (i=0; i<totalCount; i++) {
// attach the object
var current = _root.attachMovie("thumbnail.src", "thumb"+i+"_mc", i );

// do we need to rest the column and up the row?

if ( ((i%colCount) == 0) && (i != 0) ) {
trace(i%colCount);
col= 0;
row++;
}
// now position the parts!
current._x = navX+(padding*col);
current._Y = navY+(padding*row);
current._alpha = 50;

// pass an id into each thumbnail (make new var in each one called id)
current.id = i;

current.onRelease = function () {
_root.showImage(this.id);
//trace(i);
_root.display_txt.text = _root.textGallery[this.id];
}

current.onRollOver = function () {
this._alpha = 100;
this.gotoAndStop(2);
}


current.onRollOut = function () {
this._alpha = 70;
this.gotoAndStop(1);
}


// load some thumbnail art
current.loadzone_mc.loadMovie( "thumb/" + _root.gallery[i] );
current.display_txt.text = _root.gallery[i];

// and up the column so the next one moves over
col++;


}
}

function showImage ( choice ) {
trace("showImage for "+choice);
_root.loadzone_mc.loadMovie( "normal/" + _root.gallery[choice])
_root.display_txt.text = _root.textGallery[0];
}



function init () {
trace("init");
// call the build thumbnail function
buildThumbnails(6);
showImage(0);
}

init ();

This works perfectly. My question is this how do I load a second gallery using the same script. Do I need a second array? Basically I want two buttons, gallery1 and gallery 2. They will load new thumbnails into the same position as the original thumbnails.

Thanks

View Replies !    View Related
[MX04] Dynamic Image Gallery
Hi,

I am having trouble finding a good resource for this matter. I want to code it myself so I can customize later down the road. I would like to dynamically make an image gallery using PHP and Flash. I have tested a few different things, but I can't figure out how to put the pieces together. I have no problem with the PHP part, I just need help fitting the Actionscript to work. This is what I have that might work:


Code:
createEmptyMovieClip("image_clip", this.getNextHighestDepth());
createEmptyMovieClip("image_clip2", this.getNextHighestDepth());

var imagegallery:Array = Array();
varLoader = new LoadVars();
varLoader.load("PHPfile.php");
varLoader.onLoad = function(success) {
if(success) {
imagegallery['thumb1'] = thumb1;
imagegallery['thumb2'] = thumb2;
} else {
trace('Error loading the PHP file');
}
}

image_clip.loadMovie(thumb1);
image_clip2.loadMovie(thumb2);
PHP file:

PHP Code:



<?php
$thumbpath = "www.fakedomain.com";
for ($count = 1; $count < 3; $count++) {
    $output .= "&thumb" . $count . "=" . $thumbpath . "thumb" . $count . ".jpg";
}
echo $output;
?>




I want to make a loop eventually in Flash (I can probably do myself, but just warning those who might help) that automatically makes the movies and their images. I have a problem with the calling of the Flash variable thumb1 and thumb2. I also want to be able to make sure that when the images are loading, I can put a preloader. I do want the images to align in a grid not just everywhere, so I might not dynamically make the empty movie files, but I still need help with this. Also, I want to make a rollover effect, so help with that part would also be appreciated. I do want to avoid using XML due to my lack of knowledge on it, but I will if I have to.

View Replies !    View Related
SIMPLE Non-dynamic Image Gallery
Hi there,

As always, the world of Flash has moved on and developed new classes like MovieClipLoader since last I did a site. Before I invest the time, I just want to be sure I can't do something SIMPLE for my portfolio gallery without relying on too much fancy new stuff. I'm in a bit of a hurry you see.

Each gallery will be an externally loaded swf. The gallery layout is simple - a big image, with a row of little thumbnails underneath. I thought I could eliminate the need for pre-loaders etc. by trying to work with the linear nature of how flash loads an external swf:

Functionally I'd like to see the first big image appear and it's thumbnail, then the other thumbnails appear along the bottom WHEN their larger versions are loaded into the player (thus letting the user know what is ready to view). If my thumbnails are just scaled instances of my large images, this relationship would SEEM easy to exploit - if the player loads a large image, it's thumbnail appears or vice versa. Yet I'm stuck.

If an external swf. has an image on each frame, I know it will just chug along and loading and displaying them as they load. This mechanism (visible or not) will eventually load them into the player (max. 20 images) and I believe that should the user jump the playhead to a frame that hasn't yet loaded, it will be blank - in which case a simple looped 'loading' animation on the layer below would suit me fine.

Assuming I used this mechanism to populate my thumbnail bar. How could I work it so that clicking on the thumbnail button would display the larger version ? The normal mechanism would be a movieClip with the larger versions in it and a gotoAndStop(x) ... though when flash sees a mc on a frame it won't display anthing until it's fully downloaded it's contents, so that's out.

I guess I have to dynamically (?) call and postion images/instances already loaded into the player ... ? I dunno.

Any suggestions ?

If there's a simple solution, I'd love to hear it.

Cheers,

Morgan

View Replies !    View Related
[F8] Dynamic Resizing Image Gallery
Hello everyone,

I've been trying to learn how to dynamically resize a box on stage to fit externally loaded images. I'm sure everyone has seen it done a number of times, but I'm finding surprisingly little resources out there explaining how. I've searched all the forums, unfortunately to no avail. The only thing I've found on Google is this:

http://www.cambodiaxp.com/flash-experiment-movie6.html

Which is very close to what I'm looking to do, except I want to anchor the top left of the box to the corner, so that it only expands/retracts to the right and down. I'd also like to have additional padding to the left for a description of the item. I downloaded the source, and it was written for Flash 6, and without any instructions so I'm having a hard time modifying it for what I need.

Does anyone know of any good tutorials or source files for this type of thing? I'm finding it really hard to find anything relating to dynamic resizing in Flash. Any tips greatly appreciated!!

Thanks,

Luke

View Replies !    View Related
Dynamic Resizing Image Gallery
Hello everyone,

I've been trying to learn how to dynamically resize a box on stage to fit externally loaded images. I'm sure everyone has seen it done a number of times, but I'm finding surprisingly little resources out there explaining how. I've searched all the forums, unfortunately to no avail. The only thing I've found on Google is this:

http://www.cambodiaxp.com/flash-experiment-movie6.html

Which is very close to what I'm looking to do, except I want to anchor the top left of the box to the corner, so that it only expands/retracts to the right and down. I'd also like to have additional padding to the left for a description of the item. I downloaded the source, and it was written for Flash 6, and without any instructions so I'm having a hard time modifying it for what I need.

Does anyone know of any good tutorials or source files for this type of thing? I'm finding it really hard to find anything relating to dynamic resizing in Flash. Any tips greatly appreciated!!

Thanks,

Luke

View Replies !    View Related
Dynamic Image Gallery Issue
Hello All!

I am creating a dynamic image gallery, but when my external images load in the empty movie clip, all the images are loading in the same size/dimension. Does anyone know how I can command the MC to load the images in different sizes, another words - to load them according to its own size?

here's the AS

onClipEvent (load)
{
function imageMove()
{
var _loc1 = this;
for (i = 1; i <= num_of_image; i++)
{
mc = _loc1["image" + i];
if (i < hit)
{
tempx = small * (i - 1) + 30;
temps = small - 5;
mc.useHandCursor = true;
}
else if (i > hit)
{
tempx = big + small * (i - 2) + 30;
temps = small - 5;
mc.useHandCursor = true;
}
else
{
tempx = small * (i - 1) + 150; //distance of how far out the displayed image jumps.
temps = big - 5; //distance between the displayed image and thumbnails.
mc.swapDepths(1000);
display = txt;
mc.useHandCursor = false;
} // end else if
mc._x = mc._x + (tempx - mc._x) / 3; //number of pixals on x-axis the displayed image moves over to right side before growing big.
mc._width = mc._width + (temps - mc._width) / 3; //number of pixals on x-axis the displayed image moves over to left side before growing big.
mc._height = mc._width * 4 / 3;
if (Math.abs(mc._width - temps) <= 1)
{
title._x = hit < 5 ? (_loc1["image" + hit]._x + big / 2) : (_loc1["image" + hit]._x - big / 2 - 100);
title._y = 100;
} // end if
} // end of for
} // End of the function
function loopHye()
{
if (hit != num_of_image)
{
++_global.hit;
}
else
{
_global.hit = 1;
} // end else if
} // End of the function
getURL("FSCommand:allowscale", false);

big = 300;
//Large image width (400 works best for my portfolio site)
small = 60;//Small image width (40 works well for my portfolio site)
num_of_image = 8;//Total number of images
timeGap = none;//Speed (speed of gaptime when each image is displayed automatically. "2000" is default of this original file. larger the number the slower the image changes. (type in "none" will stop automatic images from changing.
_global.hit = 0;//First displyed image number (type "0" to stop images from growing out)
txt = [" ", "image1", "image2", "image3", "image4", "image5", "image6", "image7", "image8"];//insert text of each images between " "
for (i = 1; i <= num_of_image; i++)
{
attachMovie("image", "image" + i, i);
loadMovie("image/" + i + ".jpg", this["image" + i].tar);//image folder path
mc = this["image" + i];
mc._x = small * (i - 1) + 30;
mc._y = 200; //where on the axis should the displays be.
mc._width = small - 5;
mc._height = mc._width * 4 / 3;
this["image" + i].onRelease = function ()
{
clearInterval(interval);
_global.hit = this._name.substr(5);
interval = setInterval(loopHye, timeGap);
};
} // end of for
interval = setInterval(loopHye, timeGap);
}
onClipEvent (enterFrame)
{
imageMove();
}
____________________

check out the file
http://www.wendiland.com/Gallery122b.fla

this is what the current gallery looks like
http://www.wendiland.com/print2.html

I'd appreciated if someone replies with any sort of suggestions! thanks in advance!!!

- W£NDI

View Replies !    View Related
Dynamic Image Scrolling Gallery
With the help of Scotty and several of the tutorials here in these forums I have a dynamic scroller. The only problem is that I cannot figure out how to have one of the images appear on stage as an initial placeholder. Currently it is blank. The following is the code:

this.pathToPics = "image1folder/";
this.pArray = ["image0.jpg", "image1.jpg", "image2.jpg", "image3.jpg", "image4.jpg", "image5.jpg"];
this.fadeSpeed = 20;
MovieClip.prototype.changePhoto = function(d) {
this.pIndex = d;
this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
if (this.photo._alpha>this.fadeSpeed) {
this.photo._alpha -= this.fadeSpeed;
} else {
this.loadPhoto();
}
};
MovieClip.prototype.loadPhoto = function() {
var p = this.photo;
p._alpha = 0;
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
var i, l, t;
l = this.photo.getBytesLoaded();
t = this.photo.getBytesTotal();
if (t>0 && t == l) {
this.onEnterFrame = fadeIn;
} else {
// trace(l/t);
}
};
MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
this.photo._alpha += this.fadeSpeed;
} else {
this.photo._alpha = 100;
this.onEnterFrame = null;
}
};
// code for the menu
xcenter = 185;
speed = 1/20;
wijd = menu._width/2+19;
menu.setMask(mask);
menu.onEnterFrame = function() {
if (mask.hitTest(this._root._xmouse, this._root._ymouse)) {
var distance = this._parent._xmouse-xcenter;
this._x += (distance*speed);
if (this._x>0) {
this._x = -wijd;
}
if (this._x<-wijd) {
this._x = 0;
}
}
};

Any help or direction would be greatly appreciated. Scotty are you out there?

Gazzer

View Replies !    View Related
Dynamic Image Gallery Questions
Hi

I have a few questions regarding image galleries. I just want to know your views on these 2 ideas.

Is it possible for Flash to dynamically produce thumbnails from a master image? The gallery examples i've looked at so far require a main image and a smaller thumbnail. I just thought it would make things easier if only a main image was required, and flash produced the thumbnail itself dynamically? Is that possible?

Secondly, is an XML file essential for flash to load images. Can Flash just load images from a specified directory and use/load the properties directly from the image file itself. I know this can be done with ID3 tags when loading MP3 files. Possible?

Cheers

View Replies !    View Related
Scrolling Dynamic Image Gallery?
Hi everyone,

Im not sure how possible it is to do this but I need to create a "gallery" that is continously scrolling (from right to left) that loads images (.jpg's) from a certain folder, anyone know how to do it?

I need it so it loads in whatever .jpgs are in the folder so people can just put jpgs in the folder and it will appear in the scroller.

I've attached a simple version of what the scroller should do and look like.

Thanks

View Replies !    View Related
Dynamic Image Gallery Resize
Hey guys, come on!!! A little help here. PLEEEEEEEEEEEASE!!!!
I'm trying to get the images on my gallery to resize. I tried several times but was unsuccessful at it.

Here's how it looks now:

Code:
this.onEnterFrame = function() {
filesize = container_mc.picture_mc.getBytesTotal();
loaded = container_mc.picture_mc.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (container_mc.picture_mc._alpha<100) {
container_mc.picture_mc._alpha += 10;
}
if(container_mc.picture_mc._width > 0) {
resizeImage();
}
container_mc.picture_mc._x = (container_mc._width-container_mc.picture_mc._width)/2;
container_mc.picture_mc._y = (container_mc._height-container_mc.picture_mc._height)/2;
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
container_mc.picture_mc._alpha = 0;
container_mc.picture_mc.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}

}
}
function prevImage() {
if (p>0) {
p--;
container_mc.picture_mc._alpha = 0;
container_mc.picture_mc.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
if (container_mc.picture_mc._width>0) {
}
}
}
function firstImage() {
if (loaded == filesize) {
container_mc.picture_mc._alpha = 0;
container_mc.picture_mc.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
_global.resizeImage = function() {
//maximum image dimensions
wMax = 420;
hMax = 340;
if (container_mc.picture_mc._width>wMax || container_mc.picture_mc._height>hMax) {
//which dimension is the most oversized
wDiff = container_mc.picture_mc._width-wMax;
hDiff = container_mc.picture_mc._height-hMax;
//calculate ratio
if (wDiff>hDiff) {
ratio = (wMax/container_mc.picture_mc._width)*100;
} else {
ratio = (hMax/container_mc.picture_mc._height)*100;
}
} else {
//if image doesn't need to be resized set ratio to 100
ratio = 100;
}
container_mc.picture_mc._xscale = container_mc.picture_mc._yscale=ratio;
};
As it is, the picture just keeps resizing itself non-stop. I already tried to use the resizeImage(); in the nextImage and prevImage functions, but it would only resize the images some times.

Anyone care to enlighten me on where I might be wrong? Any help will be welcome! Thanks in advance for any answers!

View Replies !    View Related
Dynamic Image Gallery - Next Button
I am a photographer and also design my own site. Please visit http://www.adamstockland.com to view what I am trying to do. As it is now my images are loaded via a function that is called when one of the icons is pressed. What I am having trouble doing is creating a "next" and "back" btn or a slideshow. What I have been trying to do is have a hidden text box that holds a dynamic image # (instance name = ImageNumber). Then I am trying to attach a function to the "next" btn that basically says "if" image number = 1 load image 2 else if image number = 6 load 7, and so on. I cant seem to get it all to work. Any ideas??

Here is my code. The "next btn" function is limited to three statements as I am just trying to get it to work. Eventually it will have 34 statements....once I get it work properly..

All other function are working properly.


My code:

stop();
//load initial image
infoField._visible = true;
ImageNumber.text = "1";
startLoading("portfolio/images/image1.jpg");
//
//next_btn function
this.next_btn.onRelease = function() {
if (this.ImageNumber.text="2") {
ImageNumber.text = "3";
startLoading("portfolio/images/image3.jpg");
} else if (this.ImageNumber.text="3") {
ImageNumber.text = "4";
startLoading("portfolio/images/image4.jpg");
} else if (this.ImageNumber.text="4") {
ImageNumber.text = "5";
startLoading("portfolio/images/image5.jpg");
}
};
//
this.icon1_mv.icon1_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "1";
startLoading("portfolio/images/image1.jpg");
};
this.icon2_mv.icon2_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "2";
startLoading("portfolio/images/image2.jpg");
};
this.icon3_mv.icon3_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "3";
startLoading("portfolio/images/image3.jpg");
};
this.icon4_mv.icon4_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "4";
startLoading("portfolio/images/image4.jpg");
};
this.icon5_mv.icon5_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "5";
startLoading("portfolio/images/image5.jpg");
};
this.icon6_mv.icon6_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "6";
startLoading("portfolio/images/image6.jpg");
};
this.icon7_mv.icon7_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "7";
startLoading("portfolio/images/image7.jpg");
};
this.icon8_mv.icon8_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "8";
startLoading("portfolio/images/image8.jpg");
};
this.icon9_mv.icon9_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "9";
startLoading("portfolio/images/image9.jpg");
};
this.icon10_mv.icon10_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "10";
startLoading("portfolio/images/image10.jpg");
};
this.icon11_mv.icon11_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "11";
startLoading("portfolio/images/image11.jpg");
};
this.icon12_mv.icon12_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "12";
startLoading("portfolio/images/image12.jpg");
};
this.icon13_mv.icon13_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "13";
startLoading("portfolio/images/image13.jpg");
};
this.icon14_mv.icon14_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "14";
startLoading("portfolio/images/image14.jpg");
};
this.icon15_mv.icon15_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "15";
startLoading("portfolio/images/image15.jpg");
};
this.icon16_mv.icon16_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "16";
startLoading("portfolio/images/image16.jpg");
};
this.icon17_mv.icon17_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "17";
startLoading("portfolio/images/image17.jpg");
};
this.icon18_mv.icon18_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "18";
startLoading("portfolio/images/image18.jpg");
};
this.icon19_mv.icon19_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "19";
startLoading("portfolio/images/image19.jpg");
};
this.icon20_mv.icon20_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "20";
startLoading("portfolio/images/image20.jpg");
};
this.icon21_mv.icon21_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "21";
startLoading("portfolio/images/image21.jpg");
};
this.icon22_mv.icon22_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "22";
startLoading("portfolio/images/image22.jpg");
};
this.icon23_mv.icon23_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "23";
startLoading("portfolio/images/image23.jpg");
};
this.icon24_mv.icon24_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "24";
startLoading("portfolio/images/image24.jpg");
};
this.icon25_mv.icon25_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "25";
startLoading("portfolio/images/image25.jpg");
};
this.icon26_mv.icon26_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "26";
startLoading("portfolio/images/image26.jpg");
};
this.icon27_mv.icon27_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "27";
startLoading("portfolio/images/image27.jpg");
};
this.icon28_mv.icon28_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "28";
startLoading("portfolio/images/image28.jpg");
};
this.icon29_mv.icon29_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "29";
startLoading("portfolio/images/image29.jpg");
};
this.icon30_mv.icon30_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "30";
startLoading("portfolio/images/image30.jpg");
};
this.icon31_mv.icon31_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "31";
startLoading("portfolio/images/image31.jpg");
};
this.icon32_mv.icon32_btn.onRelease = function() {
infoField._visible = true;
ImageNumber.text = "32";
startLoading("portfolio/images/image32.jpg");
};
function startLoading(whichImage) {
loadMovie(whichImage, "imageLoader");
_root.onEnterFrame = function() {
L = imageLoader.getBytesLoaded();
T = imageLoader.getBytesTotal();
P = Math.floor((L/T)*100);
if (P>1, P<25) {
this.infoField.text = "...";
} else if (P>25, P<50) {
this.infoField.text = "1/4";
} else if (P>50, P<75) {
this.infoField.text = "1/2";
} else if (P>75, P<99) {
this.infoField.text = "3/4";
} else if (P>99) {
this.infoField.text = "";
this.infoField._visible = false;
delete this.onEnterFrame;
}
};
}

View Replies !    View Related
Dynamic Image Scrolling Gallery
With the help of Scotty and several of the tutorials here in these forums I have a dynamic scroller. The only problem is that I cannot figure out how to have one of the images appear on stage as an initial placeholder. Currently it is blank. The following is the code:

this.pathToPics = "image1folder/";
this.pArray = ["image0.jpg", "image1.jpg", "image2.jpg", "image3.jpg", "image4.jpg", "image5.jpg"];
this.fadeSpeed = 20;
MovieClip.prototype.changePhoto = function(d) {
this.pIndex = d;
this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
if (this.photo._alpha>this.fadeSpeed) {
this.photo._alpha -= this.fadeSpeed;
} else {
this.loadPhoto();
}
};
MovieClip.prototype.loadPhoto = function() {
var p = this.photo;
p._alpha = 0;
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
var i, l, t;
l = this.photo.getBytesLoaded();
t = this.photo.getBytesTotal();
if (t>0 && t == l) {
this.onEnterFrame = fadeIn;
} else {
// trace(l/t);
}
};
MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
this.photo._alpha += this.fadeSpeed;
} else {
this.photo._alpha = 100;
this.onEnterFrame = null;
}
};
// code for the menu
xcenter = 185;
speed = 1/20;
wijd = menu._width/2+19;
menu.setMask(mask);
menu.onEnterFrame = function() {
if (mask.hitTest(this._root._xmouse, this._root._ymouse)) {
var distance = this._parent._xmouse-xcenter;
this._x += (distance*speed);
if (this._x>0) {
this._x = -wijd;
}
if (this._x<-wijd) {
this._x = 0;
}
}
};

Any help or direction would be greatly appreciated. Scotty are you out there?

Gazzer

View Replies !    View Related
Dynamic Image Gallery (not Working So Well)
Hello I am working on a dynamic image gallery that is a bit out of my league, if you can’t already tell from my sloppy code. The gallery loads .jpgs resizes them, centers them and then it is supposed to resize a frame to fit around them, the frame resize is not going so well and I cannot figure out why, so if anyone can shed some light on my crappy code please do so, thank you. I have commented out the parts that don’t work as they should.

ActionScript Code:
mclListener.onLoadInit = function(target_mc:MovieClip):Void {
   
    var ratio:Number = 500/400;
    var w:Number = target_mc._width;
    var h:Number = target_mc._height;
    var targetsRatio:Number = w / h;
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    if (targetsRatio <= ratio) {
        var scaler:Number = 400/h;
        trace("if");
        var newWidth:Number = target_mc._width * scaler;
        target_mc._width = newWidth;
        var newHeight:Number = target_mc._height * scaler;
        target_mc._height = newHeight;
        target_mc._x = Stage.width/2-target_mc._width/2;
        //trace("image h= " + target_mc._height);
        //trace("image w= " + target_mc._width);
        //_parent.box_mc._x = target_mc._x;
        //_parent.box_mc._y = target_mc._y + 75;
        //var boxNewXscale:Number = (target_mc._width / _parent.box_mc._width) * 100;
        //var boxNewYscale:Number = (target_mc._height / _parent.box_mc._height) * 100;
       
        //var xScaleT:Tween  = new  Tween(_parent.box_mc, "_xscale", Elastic.easeOut, 100, boxNewXscale + 1, 3, true);
        //var yScaleT:Tween  = new  Tween(_parent.box_mc, "_yscale", Elastic.easeOut, 100, boxNewYscale + 1, 3, true);
        //_parent.box_mc._width = target_mc._width;
        //_parent.box_mc._height = target_mc._height;      
    } else {
        var scaler:Number = 500/w;
        trace("else");
        var newWidth:Number = target_mc._width * scaler;
        target_mc._width = newWidth;
        var newHeight:Number = target_mc._height * scaler;
        target_mc._height = newHeight;
        target_mc._x = Stage.width/2-target_mc._width/2;
       
        /*
        trace("image h= " + target_mc._height);
        trace("image w= " + target_mc._width);
        _parent.box_mc._x = target_mc._x;
        _parent.box_mc._y = target_mc._y + 75;
        var boxNewXscale:Number = (target_mc._width / _parent.box_mc._width) * 100;
        var boxNewYscale:Number = (target_mc._height / _parent.box_mc._height) * 100;
       
        var xScaleTe:Tween  = new  Tween(_parent.box_mc, "_xscale", Elastic.easeOut, 100, boxNewXscale + 1, 3, true);
        var yScaleTe:Tween  = new  Tween(_parent.box_mc, "_yscale", Elastic.easeOut, 100, boxNewYscale + 1, 3, true);
        _parent.box_mc._width = target_mc._width
        _parent.box_mc._height = target_mc._height
        */
    }
};

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved