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




Carousel Image Gallery



i am interested to know how this IMAGE GALLERY was created and worked out.

i searched on FK and found THIS Carousel sorta thing but i was not successful implementing images within it.

anyhelp is greatly appreciated.



FlashKit > Flash Help > Flash ActionScript
Posted on: 06-12-2004, 06:25 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Bug In The Attached Carousel Image Gallery
I need to fix the bug in a carousel based image gallery. I tried to figure it out but I couldn't.
Can anybody help me in this. I would be glad if somebody can explain what's going on in the action script

Carousel Image Gallery Scale
I finished my first design in flsh 8 using autoscript. It is a carousel gallery of 14 images rotating around.
I am very new to this area but i hava a knowledge on programming language.
What i want is when an image comes in the center of the monitor to scale
automatically, stay at the max scale for around 2 secs then scale back to its original size.
when an image is in the proccess of scaling, the other images should stop and wait until the image gets its original size.
actually the proccess goes like that:
1st image in screen center - scale for 2 secs - remain at max size for 2 sec - scale back to original size - carousel rotation -
2nd image - scale.....and so on
Actually what i am lookin for is in url http://www.greekmilitary.net/
I would be very gratefull if anyone can supply me with an appropriate actionscript code or any reference tutorials on this

Video Gallery Carousel
I'm working on a project that's already been completed, not by me, except now another operation has to be added. Basically there is carousel that has thumbnails and when you click a thumbnail an external video loads and plays. But when the video is over it just stops and the player doesn't go anywhere. If you click the player however it will go back to the carousel. What it needs to do now though is automatically go back to the carousel when the video is done and I want to use that same function it uses when the player is clicked. Problem is I'm not sure where to start. Any ideas on how to go about this? Thanks!

Using The Carousel As A Photo Gallery?
Hi there,
I am wondering how hard it would be to use the carousel created by Lee in his tutorial and change it so instead of having a icon that moves beside the text when click, rather when clicked it enlages and becomes a photo so effectivly you have a carousel made up of lots of little photo icons that when clicked becomes bigger and the carousel disapears and when clicked photo shricks back into the carousel. I dont think it would be that hard to do Im just not very good with actionscript or xml. And I was wondering if someone who knows a bit more would be able to give me some advice on how to make this possible? I would really appriciate the help.
cheers :D

Carousel And Xml Picture Gallery Together
Hi,

for my hollyday pictures i put together a gallery. well, i have 11 gallerys and so i used the carousel tutorial to choose the gallery and the xml pictures as the gallery.

now, my problem is that on the click on an icon in the carousel the proper xml file for the gallery is not loaded. i tried it with a function, i tried to put the whole gallery code in the release function but the xml just doens't load.
does anyone have an idea?

EDIT: deletet the code

Carousel And Xml Picture Gallery Together
Hi,

for my hollyday pictures i put together a gallery. well, i have 11 gallerys and so i used the carousel tutorial to choose the gallery and the xml pictures as the gallery.

now, my problem is that on the click on an icon in the carousel the proper xml file for the gallery is not loaded. i tried it with a function, i tried to put the whole gallery code in the release function but the xml just doens't load.
does anyone have an idea?

Code:

import mx.utils.Delegate;
import mx.transitions.Tween;
import mx.transitions.easing.*;

_global.s = new Sound();
_global.s.attachSound("sound1");
textBox.text = "";

var numOfItems:Number;
var radiusX:Number = 300;
var radiusY:Number = 75;
var centerX:Number = Stage.width / 2;
var centerY:Number = Stage.height / 2;
var speed:Number = 0.05;
var perspective:Number = 130;
var home:MovieClip = this;
//-------------------set up for the picture gallery

fscommand("allowscale", false);

var x:XML = new XML ();
x.ignoreWhite = true;

var fullURL:Array = new Array;
var thumbURL:Array = new Array;
var moNames:Array = new Array;
var thumbX:Number = 15;
//---------------------------------------------------------------
picFolder = "beijing";

theText._alpha = 0;
bildg._alpha = 0;
stroke._alpha = 0;
panel._alpha = 0;

var tooltip:MovieClip = this.attachMovie("tooltip","tooltip",10000);
tooltip._alpha = 0;

var xml:XML = new XML();
xml.ignoreWhite = true;

xml.onLoad = function()
{
   var nodes = this.firstChild.childNodes;
   numOfItems = nodes.length;
   for(var i=0;i<numOfItems;i++)
   {
      var t = home.attachMovie("item","item"+i,i+1);
      t.angle = i * ((Math.PI*2)/numOfItems);
      t.onEnterFrame = mover;
      t.toolText = nodes[i].attributes.tooltip;
      t.content = nodes[i].attributes.content;
      t.folder = nodes[i].attributes.folder;
      t.icon.inner.loadMovie(nodes[i].attributes.image);
      t.r.inner.loadMovie(nodes[i].attributes.image);
      t.icon.onRollOver = over;
      t.icon.onRollOut = out;
      t.icon.onRelease = released;
   }
}

function over()
{
   //BONUS Section
   var sou:Sound = new Sound();
   sou.attachSound("sover");
   sou.start();
   
   home.tooltip.tipText.text = this._parent.toolText;
   home.tooltip._x = this._parent._x;
   home.tooltip._y = this._parent._y - this._parent._height/2;
   home.tooltip.onEnterFrame = Delegate.create(this,moveTip);
   home.tooltip._alpha = 100;
}

function out()
{
   delete home.tooltip.onEnterFrame;
   home.tooltip._alpha = 0;
}

function released()
{
   //BONUS Section
   var sou:Sound = new Sound();
   sou.attachSound("sdown");
   sou.start();
   
   home.tooltip._alpha = 0;
   for(var i=0;i<numOfItems;i++)
   {
      var t:MovieClip = home["item"+i];
      t.xPos = t._x;
      t.yPos = t._y;
      t.theScale = t._xscale;
      delete t.icon.onRollOver;
      delete t.icon.onRollOut;
      delete t.icon.onRelease;
      delete t.onEnterFrame;
      if(t != this._parent)
      {
         var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,t._xscale,0,1,true);
         var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,t._yscale,0,1,true);
         var tw3:Tween = new Tween(t,"_alpha",Strong.easeOut,100,0,1,true);
      }
      else
      {
         var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,t._xscale,100,1,true);
         var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,t._yscale,100,1,true);
         var tw3:Tween = new Tween(t,"_x",Strong.easeOut,t._x,100,1,true);
         var tw4:Tween = new Tween(t,"_y",Strong.easeOut,t._y,320,1,true);
         var tw5:Tween = new Tween(theText,"_alpha",Strong.easeOut,0,100,1,true);
         theText.text = t.content;
         
//----------------------------- release function to set new pic gallery         
         picFolder = t.folder;
         bildg._alpha = 100;
         stroke._alpha = 100;
         panel._alpha = 100;
         trace(picFolder);
x.load (picFolder+"/bilder.xml");// path to XML file         
         
         var s:Object = this;
         tw.onMotionStopped = function()
         {
            s.onRelease = unReleased;
         }
      }
   }
}

function unReleased()
{
   //BONUS Section
   var sou:Sound = new Sound();
   sou.attachSound("sdown");
   sou.start();
   
   delete this.onRelease;
   var tw:Tween = new Tween(theText,"_alpha",Strong.easeOut,100,0,0.5,true);
   bildg._alpha = 0;
   stroke._alpha = 0;
   panel._alpha = 0;
   
   for(var i=0;i<numOfItems;i++)
   {
      var t:MovieClip = home["item"+i];
      if(t != this._parent)
      {
         var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,0,t.theScale,1,true);
         var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,0,t.theScale,1,true);
         var tw3:Tween = new Tween(t,"_alpha",Strong.easeOut,0,100,1,true);
      }
      else
      {
         var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,100,t.theScale,1,true);
         var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,100,t.theScale,1,true);
         var tw3:Tween = new Tween(t,"_x",Strong.easeOut,t._x,t.xPos,1,true);
         var tw4:Tween = new Tween(t,"_y",Strong.easeOut,t._y,t.yPos,1,true);
         tw.onMotionStopped = function()
         {
            for(var i=0;i<numOfItems;i++)
            {
               var t:MovieClip = home["item"+i];
               t.icon.onRollOver = Delegate.create(t.icon,over);
               t.icon.onRollOut = Delegate.create(t.icon,out);
               t.icon.onRelease = Delegate.create(t.icon,released);
               t.onEnterFrame = mover;
            }
         }
      }
   }
}


function moveTip()
{
   home.tooltip._x = this._parent._x;
   home.tooltip._y = this._parent._y - this._parent._height/2;
}

xml.load("icons.xml");

function mover()
{
   this._x = Math.cos(this.angle) * radiusX + centerX;
   this._y = Math.sin(this.angle) * radiusY + centerY;
   var s = (this._y - perspective) /(centerY+radiusY-perspective);
   this._xscale = this._yscale = s*100;
   this.angle += this._parent.speed;
   this.swapDepths(Math.round(this._xscale) + 100);
}

this.onMouseMove = function()
{
   speed = (this._xmouse-centerX)/2500;
}
//------------------------------- picture gallery function

x.onLoad = function(){ //Function runs after XML is loaded
    var photos:Array = this.firstChild.childNodes;//Defines variable for length of XML file
   for (i=0;i<photos.length;i++) {//For loop to step through all entry lines of XML file
      fullURL.push(photos[i].attributes.urls);//Each loop, adds URL for full sized image to Array fullURL
      thumbURL.push(photos[i].attributes.thumbs);
      moNames.push(photos[i].attributes.namen);//Each loop, adds URL for thumbnails to Array thumbURL
      trace(i+". Full Image = "+fullURL[i]+"  Thumb Image = "+thumbURL[i]+"namen = "+moNames[i]);      
      var t = panel.attachMovie("b","b"+i,i);//Each loop, Define local variable 't' as a new instance of 'b' movie clip, given unique instance name of 'b' plus the index number of the For loop
      t.img.loadMovie(thumbURL[i]);// Each loop, load thumbnail image from XML data into variable movie clip
      t._y = 0;//Set Y coordinate of variable movie clip
      t._x = thumbX;//Set X coordinate of variable movie clip based on variable thumbX
      t.numb = i;//Set sub-variable 'numb' inside variable t to hold index number
      t._alpha = 50;//Set the Alpha value of the variable movie clip to 75% - for onRollOver highlight action
      thumbX += 180;//Increment thumbX value so next thumbnail is placed xxx pixels to the right of the one before
      
      t.onRollOver = function () {//define onRollOver event of the variable movie clip
         this._alpha = 100;//Set thumbnail alpha to 100% for highlight
         modeltext.chick.text = moNames[this.numb];
      }
      t.onRollOut = function () {//define onRollOut event of the variable movie clip
         this._alpha = 50;//Reset thumbnail alpha to 75%
      }
      t.onPress = function () {//define onPress event of the variable movie clip
         this._rotation += 3;//rotates thumbnail 3 degrees to indicate it's been pressed
         this._x += 3;//Offset X coordinate by 3 pixels to keep clip centered during rotation
         this._y -= 3;//Offset Y coordinate by 3 pixels to keep clip centered during rotation
      }
      t.onReleaseOutside = function () {//define onRelease event of the variable movie clip
         this._rotation -= 3;//rotate thumbnail back 3 degrees
         this._x -= 3;//Reset X coordinate by 3 pixels to keep clip centered during rotation
         this._y += 3;//Reset Y coordinate by 3 pixels to keep clip centered during rotation
         this._alpha = 50;//Reset thumbnail alpha to 75%

      }
      t.onRelease  = function () {//define onRelease function to load full sized image
         this._rotation -= 3;//rotate thumbnail back 3 degrees
         this._x -= 3;//Reset X coordinate by 3 pixels to keep clip centered during
         this._y += 3;//Reset Y coordinate by 3 pixels to keep clip centered during
         this._alpha = 50;//Reset thumbnail alpha to 75%
         trace(bild);
         _global.bild = fullURL[this.numb];
         _root.bildg.loadMovie("bildg.swf");
      }
   }
}
x.load (picFolder+"/bilder.xml");// path to XML file

panel.onRollOver = panelOver;

function panelOver() {
   this.onEnterFrame = scrollPanel;
   delete this.onRollOver;
}

var b = stroke.getBounds(_root);

function scrollPanel() {
   if (_xmouse<b.xMin||_xmouse>b.xMax||_ymouse<b.yMin||_ymouse>b.yMax) {
   this.onRollOver = panelOver;
   delete this.onEnterFrame;
   }
   var xDist = _xmouse - 400;
   
   if (panel._x >= 10) {
   panel._x = 10;
   }
   if (panel._x <= -(thumbX-780)) {
   panel._x = -(thumbX-780);
   }
   
   panel._x += -xDist/65;
}

stop();

Carousel View XML Gallery Problem
Carousel View XML Gallery Problem

I have hosted the source files for carousel view xml galllery following URL http://www.sstudio.in/carousel.zip. It has some problem with picture width that is the width and height of the picture is fixed.

But i need reduce the picture dimesions according to the stage size.

Please help me to fix this problem.

Activate Carousel Gallery OnRollOver...
hey there


could someone please explain to me how i would deactivate a carousel gallery until rollOver? reason being it doesn’t look to good when the page loads with something spinning real fast.


is it possible??


I’m running Flash CS3 with actionScript 2.0.
Help would be appreciated


::Thanks in advance::

AS3 Image Carousel
Hi I am trying to replicate the an image carousel like the one on nissanusa.com.

I have created a movie(image1) with five layers containing the images.

and given them instance names ClipA, ClipB, etc.

I then moved ClipA from the top layer to below ClipB but then the listeners dont catch any mose roll over.

Any Ideas?

Is there a way to dynamically move them up or down layers?


image1.clipA.addEventListener(MouseEvent.ROLL_OVER,overFunction1);
image1.clipA.addEventListener(MouseEvent.ROLL_OUT,outFunction1);

image1.clipB.addEventListener(MouseEvent.ROLL_OVER,overFunction2);
image1.clipB.addEventListener(MouseEvent.ROLL_OUT,outFunction1);


function overFunction1(obj:Object) {
trace ("on roll called");
display_txt.text = "CLIP A";
bgdark.visible = true;
image1.stop();
image1.clipA.gotoAndStop(10);
image1.clipB.gotoAndStop(20);
image1.clipC.gotoAndStop(20);
image1.clipD.gotoAndStop(20);
image1.clipE.gotoAndStop(20);
}


Thanks

Chris

Anyone Know Any Image Carousel Tutorial?
Hi,

I'm looking for an image carousel (rotating like those found in carnival rides) done in Flash5. Preferably horizontally rotating and customizable...

Anyone seen one lately? Somewhat looks like this except this one is done with java applets and is more like a ferris wheel rather than a carousel.


Thanks!

I Need An Image Carousel, Scroller Like This One...
Hi there,

Im looking to build a scrolling image carousel like the one shown here

http://www.nikoleramsay.com/

The requirements are:
The images must be loaded in individually to reduce preload time.
For it to be scrolling.
To have a dragable bar
To remain 100% width in any browser.

Does any know of a script, a site, a tutorial that might help me complete this? Doesn’t have to be a free script, i don’t mind paying for this.

To be honest, any help in the right direction would be fantastically helpful here.

Tim

I Need An Image Carousel, Scroller Like This One...
Hi there,

Im looking to build a scrolling image carousel like the one shown here

http://www.nikoleramsay.com/

The requirements are:
The images must be loaded in individually to reduce preload time.
For it to be scrolling.
To have a dragable bar
To remain 100% width in any browser.

Does any know of a script, a site, a tutorial that might help me complete this? Doesn’t have to be a free script, i don’t mind paying for this.

To be honest, any help in the right direction would be fantastically helpful here.

Tim

Carousel Image Quality
Trying to figure out how to make the images in my carousel not jump around so much. Does anybody know of an effect, file type, flash setting or anything else that can help smoooth this out?

Thanks fo the help.

if you want to see what im talking about go here
http://www.symbioticmeg.com

A Static Image To 3D Carousel
I did the fantastic 3D carousel tutorial and got it working properly. I'd like to put a statis picture in the middle of the carousel though, something that the items revolve around, so I'd need the items to go behind the image somehow. I imagine this can be accomplished by a mask but I have no idea how to mask the dynamically created items and now they just move on top of the middle image. Can someone help me with this?

Carousel Tut. Image Instead Of Text
Hi
I am trying to work with the carousel tutorial. It is possible to display text on the right when an icon is clicked. Is it possible to display an image instead of the text (reading from the Xml)?

Henk

Carousel - Foreground Image
What would be the best way to overlay an image on the carousel script. I'm trying to make the icons in the rear pass behind the overlayed image.

Here's an example of what's happening now when I simply place the image on it's own layer.

http://pmgroup.com/ready2go/_caro2/caro ... enter.html

Best Practices - Flash Image Carousel
When creating an image Carousel in flash for a web page, what are the best practices for loading quickly and changing images?

So for instance, on an ecommerce site, the home page often has a block created in flash in which 4-6 images are included with arrows or image numbers are displayed at the bottom as buttons. The images automatically change to the next ever x seconds unless the user selects an image number or the forward/back arrows.

Obviously, smaller the image the better. But how about best practices for things like:

Do you include one image in the block and then load dynamically the other images? Should all images be dynamically loaded if you want to change them on a daily/weekly basis? Any suggestions for making sure the images, especially the first one is loaded quickly?

Anyone have sample ~gpl code that demonstrates a block like this?

Two examples - kohls.com, jcrew.com

Image In Center Of Carousel Menu?
Hi, I recently built myself a carousel menu that works well, and was just wondering if it was possible to place a movieclip at it's center? the problem i've been having is that the icons at the back still seem to display overtop of the central movie clip, is there perhaps some way to set the depth of the movie clip I want in the center, so that the icons in front pass in front of the movie clip while the ones in back pass behind?


sorry if this is a bit confusing, i've been up all night trying to figure this out =/

thx in adv.

-wraith

3D Carousel Weird Image At Loading?
Hello

The 3d carousel is fantastic but i seem to have encountered an issue


when it loads it has a very odd royal blue blue box about 2 inches tall by half inch wide appear on the screen briefly. this appears in the upper left portion of the screen


any ideas what this might be? would like to make it go away! since it is all loading dynamically i have no idea where this little gremlin is coming from


thanks

justin

Carousel - Image Instead Of Text Upon ROLLOVER
I watched all 3 Carousel tutorials but can not figure out how to use an image instead of dynamic text for the rollover bubble that appears above each icon. I found a few threads on this forum with similar questions but none were answered.

Thanks in advance for your help.

How Can I Load An External Image Using This Carousel Code
I found this beautiful carousel ported to actionscript 3.0.
http://board.flashkit.com/board/atta...7&d=1188450564

How can I change the code so I can click one of the carousel images and have it load the companion large image located in a different folder into a movieclip on stage.

I am a newbie to AS3 and struggling to learn how to do things.

Hopefully, someday I will be smart enough to contribute to the forum with intelligent submissions.

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....

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....

Can't Find A Simple Image Rotator Tutorial (not Carousel)
Hi,

I need to make a simple movie that rotates through images/swfs, in order, and has a small navigation to select any of the images in the rotator. Probably will only contain 3 - 6 images/swfs at a time. I have come across many pre-made flash image rotators, but I need something a bit more open that I can customize to my liking. I'm not necessarily looking for ease of use or automated. I know enough AS that I understand it, I just need help writing it sometimes. Kinda like when you can read a language, but you're not fluent in writing it. Anyway, I'm not asking for someone to write AS for me, but if anyone has something already on hand that they don't mind sharing or if you know of a tutorial that may help, I would appreciate it. Thanks.

Movie/anim Gallery? (not Image Gallery)
Ive come across this gallery and preloader

http://www.flashkit.com/movies/Scrip...7797/index.php

I love the way I can just dump my images in a folder and with a few tweaks it will put these images in the gallery.

What I am looking at is a way to do this with seperate .swf animations.

What I want to be able to do is dump a number of linear animation swf files into a folder, then when I launch the gallery, the first animation plays, and when it reaches the end it automatically plays the next animation in the folder. Then I want the whole thing to loop.

Any ideas?

XML Gallery - Generate XML Path For Image Gallery
I learned from great tutorial of kirupa .
I tried to create own image gallery, now I stay in front of problem.
How can I generate path for my images and thumbnails for XML file.
E.g. I have 110 images paths and 110 thumbnails path.
Manually takes it lot of time , how can I make this code for XML file?


<pic>
<image>images/img/ref/img/img_001.jpg</image>
<thumbnail>images/img/ref/thm/img_001.jpg</thumbnail>
</pic>

next node, next node,
...
last node:

<pic>
<image>images/img/ref/img/img_110.jpg</image>
<thumbnail>images/img/ref/thm/img_110.jpg</thumbnail>
</pic>

Product Gallery, Image Gallery Or Portfolio..
Hi! This is probably insanely much to ask for but I do it anyway This is for us designers that want to learn some action script to help us show some xml driven data in our flash projects.

I’ve been searching the web for tutorials that can help me with a specific project that I want to develop. I’ve found a bounce of things that is close to what I’m looking for but not right on the spot. And I think that there are many out there that are looking for the same tutorial as I am. For me the best way to learn is to deconstruct example files with code hints. So if any of you flash gurus out there could help us with an example .Fla for this project I think many would be very happy!

The project:
I want to create a gallery of “what ever”. It could be a product gallery, image gallery or a portfolio. This can be used for many things. I’ve attached an image (template.jpg) that pretty much explains what I’m looking for. I also included an example of how the xml file could look like.

I think this could be an excellent example for many designers/developers that are new to dealing with xml, images and flash.

Kirupa Picture Gallery / Keeping The Image On Stage As New Image Loads
Hi, I have the Kirupa Image Gallery implemented and it works great. But I was wondering how I can go about having the image stay on screen as it is loading the next image, so it's not such an abrupt transition. Currently the image container goes blank as it loads the next image. I assume I will need another image movieclip that sits underneath the first one... but then what?

Thanks!

Simple Gallery Example Flash With PHP Serving Image List And Image Sizes
this is simple gallery example for AS2
gallery is nothing special ease to use and implement

interesting thing about this example is that you pass a folder, and PHP side gathers images list from folder and returns it to Flash in XML form together with images widths and height which makes it more easier to implement this sort of galleries like I've made

example : http://www.hagane.us/as/gallery/
ZIP : http://www.hagane.us/as/gallery/gallery.zip

blogpost : http://mrsteel.wordpress.com/2008/01...s-from-folder/

Seeking Flash Image Gallery That Resizes Movie To Fit Image Dimensions
I am looking for a flash gallery that resizes the movie dimensions to fit the width and height of the image in real-time. Alternatively, the movie does not display a background color or border. I've used slideshowpro and it's feasible ...just looking for another suggestion. Prefer xml-based.

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

Actionscript Image Gallery > Updating Thumbnail And Main Image
Hi all,

I'm helping a friend produce a small Flash website. For some artwork/photos.

Basically a strip of thumbnail images at the bottom, clicking a thumbnail will load the (fullsize) image above.

Currently ten thumbnails scroll across.

**The problem**

.. is he wants to be able to drop a thumbnail image and the corresponding fullsize image into a folder on the server. The Movie should then display the latest additions. I can produce a simple slideshow where extra images are loaded at run-time (MX introduced this). But am trying to figure out how to update both the thumbnail strip and the main image.

Any help/pointers greatly appreciated.

Robert

XML Gallery: Preload On Current Image/cross-fade Image
Hello,
I am new to action script but I am learning quickly.

I took the following tutorials and made a hybrid:
Photo Gallery Using XML and Flash
Photo Slideshow Using XML and Flash


I redesigned the interface and created this:
http://www.onarresdesign.com/greg/work2.html

Everything works great, but now I want to take it further than the tutorial.
I am trying to make the images cross-fade. I am open to any suggestions and I have tried many techniques with little success.

Here is the closest solution steps I have come up with:

Code:
1) First image preloads (grey background showing)
2) First image loaded into top level MC 1
3) First image fades in
4) First image in top level MC 1 remains visible
5) First image gets loaded into bottom level MC 2 behind current movie clip.
6) Top level MC 1 clears because its preloading next image
Bottom level MC 2 remains visible
7) Preloader shows on top of bottom level MC 2
8) Next image is loaded into top level MC 1
9) Next image fades in (cross-fade effect achieved because previous image is behind it)
10) Next image gets loaded into bottom level MC 2
Repeat process
I can't get the action script to do what I want. I have off set the moveclips to show that the images are loading into both movieclips. I currently have the 'nextImage()' function controlling this so it is understandable the both images are cleared because the function is loading new images into the movie clips at the same time. How do I get one movie clip to remain constant while the other is loading? It seems to be a matter of where the function is placed. Or so I think.

I would appreciate any help I can get on this. If would also appreciate any suggestions for making the code for the control buttons cleaner.

Thank you,
</asla>

Rollover Image Gallery With Swap Image Effect?
I'm trying to do a flash banner like the one from:

http://www.eyeblaster.com/

when you rollover the buttons that say: eyeblaster ACM v2.0, advanced analytics, etc. the nice artistic banner appears. when you are no longer over it, it still stays to that same banner until you rollover the other buttons. so it's like a swap image effect, only in flash.

how would i go about this?

Photo Gallery Rollover Image Image Swap
I am using the XML Photo Gallery with thumbnails, and i have managed to modify it to suit my needs for the most part. However, some of the work i want to use it to display is photo restoration and i would like to be able to rollover the image and have a different image show on rollover. Something like you see here...http://homepage.mac.com/gapodaca/digital/bikini/ only using the XML Photo Gallery.

Any ideas?

Photo Gallery Tutorial Turned Into Photo Carousel
i've taken the tutorial on this site on how to create an flash photo gallery that loads the content from an xml file. i'd like to alter the output of this fine tutorial and would appreciate any help in doing so.

i would like to create gallery, but instead of only showing one picture at a time, i would like to have a carousel effect where more than one picture is shown at a time, and the buttons control the turn of the carousel. i'm thinking in order to do this i'll need to have the as create a movie clip for each picture (maybe during the for loop). each mc instance would have to have a unique name, and then the buttons could play with the properties of each created mc instance.

here's the code from the tutorial on this. any help would be much appreciated....

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("images.xml");
/////////////////////////////////////
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;
}
}
};
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;
}

Image Gallery... Save Image To Computer?
Hey all,
I just wondered if there was a way to save image files in a dynamic gallery? For example... when an image is displayed, a little save icon appears that allows the user to save the jpeg file to their computer. Thanks!

XML Image Gallery: Replacing Xml To Load New Image Set?
Hi Kirupa crew!

First, big thanks for this great site!

Second, I'm struggling a bit on xml and hoping for a hand. Your xml image gallery is a sweet piece of work, and I would like to be able to add the functionality of being able to load different galleries from a menu without loading a new mc with gallery inside it. I managed to botch the file up pretty good on my own, and was wondering if there is a ready answer nearby.

So I'm thinking have but1, but2 and but3, with a seperate xml file for each. What would you recommend for a smooth way to swap the the xml files to the gallery, and load the first image of the new xml file? Also, can it be done with one big ol' xml file while keeping the galleries seperate? It's not necessary, but could be handy, and save some loading.

It would also be interesting to apply the same principle to the resizing script that Scotty has in that big Resizing thread, just a thought.

Many many thanks!
John

Gallery Image Loading - Getting Image Width..help
Ladies and gents:

having a problem with my code somewhere; I'm stumped. Here's what i'm trying to do:

-When you click on a thumbnail in my gallery a load bar appears that is the width of the loading image
-While the image loads the load bar scales from full width to zero
-Once it finishes loading the image fades in
-Click on a new thumbnail, and the old image fades out, then the scrollbar is supposed to take the width of the NEW image and do the same thing

What is happening is that the scrollbar width does not set itself to the new image size until i click the thumbnail a second time...try this link to see what i mean. it's on the "portfolio" page.

http://www.lewisweb.ws/staging

here's the code:



Code:
//CONSTANTS
frame_x = 387; //the exact x coordinate where the box originates
frame_y = 184; //the exact y coordinate where the box originates
alphaSpeed = 5; //spped at which the pics fade in

//INITIAL SETTINGS
containerMC._alpha = 0;
containerMC._x = frame_x;
containerMC._y = frame_y;

//Fades in a picture loaded externally
MovieClip.prototype.loadPic = function(pic){
containerMC.fadeOldPic(); //fade out old picture
containerMC._alpha = 0;
this.loadMovie(pic); //load new pic
var loadIsComplete = false; //reset load checker
var w = containerMC._width;
loadBar._width = w; //set loadbar to new movieclip width
loadBar._alpha = 100; //make loadbar opaque
_root.onEnterFrame = function(){
var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
loadIsComplete = (Math.round(l/t) == 1); //check to see if load completed
loadBar._width = w - ((l/t) * w); //sets width of loadbar dynamically
if (loadIsComplete){
containerMC._alpha += alphaSpeed; //if load is complete, fade pic in
}
//if the load is complete and the picture is fully faded in...
if (t != 0 && loadIsComplete && _root.containerMC._alpha == 100){
loadBar._alpha = 0; //make the load bar disappear
delete _root.onEnterFrame;
}
}
};

//Fades out an old picture...pretty self explanatory
MovieClip.prototype.fadeOldPic = function(){
_root.onEnterFrame = function(){
_root.containerMC._alpha -= alphaSpeed;
if (_root.containerMC._alpha == 0){
delete _root.onEnterFrame;
}
}
};

containerMC.loadPic("portfolio/westin.jpg");
stop();
ANY help will be appreciated!

Kirupa XML Image Gallery - Skip To Image
So I'm having some trouble modifying this script. I have a text box so a user can go to a certain image (In my case page). So if the user type 5 it should go to image 5.

I've tried numerous methods, none of which are working (they work but then my next and previous buttons aren't working properly). I know I need to just get go to the number image in the array but the way the script is set up it seems I would have to change the current position value but that doesn't seem to be the case.

Am I over complicating this?

ActionScript Code:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("xml/config.xml");
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;
}
}
};

function nextImage() {
if (p<(total-1)) {
p++;
picture._alpha = 0;
picture.loadMovie("images/"+image[current_pos]+".jpg", 1);
picture_num();
}
}

function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie("images/"+image[p]+".jpg", 1);
picture_num();
}
}

function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie("images/"+image[0]+".jpg", 1);
picture_num();
}
}


function picture_num() {
current_pos = p+1;
_root.currPageNum.text = "Page " + current_pos;
}

_root.goButton.onPress = function(){
// load the image typed into the text area.
}

Flash 8 - Help W Xml Image Gallery, Thumbnails For Each Image
Hey.

New here and have found some really good tutorials! Thanks.
I desperately need a bit of help with some Actionscripting if anyone has any ideas how to do this?
I have created a photo gallery using the kirupa tutorial. That works fine. Now for each main image that the code cycles through my client wants 1-3 thumbnails to display on the side of the image and they should all be clickable and display full size in place of the main image when clicked. The previous and next buttons should still only go through the main images. Here is the xml code (as I imagine it should look like):

[code]

Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
<pic>
<image>images/bowandkey_main.jpg</image>
<caption>Bow and Key Necklace: £225.00</caption>
<description>Mother of pearl (or onyx) necklace with silver-plated bow and key, cast from vintage originals </description>
<thumbnail>
<thumb1>thumbnails/bowandkey_main.jpg</thumb1>
<thumb2>thumbnails/bowandkey_portrait.jpg</thumb2>
<thumb3>thumbnails/bowandkey_closeup.jpg</thumb2>
</thumbnail>
</pic>
<pic>
<image>images/bowandkey2_main.jpg</image>
<caption>Bow and Key Necklace: £230.00</caption>
<description>Onyx necklace with silver-plated bow and key, cast from vintage originals </description>
<thumbnail>
<thumb1>thumbnails/bowandkey2_main.jpg</thumb1>
<thumb2>thumbnails/bowandkey2_portrait.jpg</thumb2>
</thumbnail>
</pic>
<pic>
<image>images/crossedfingers.jpg</image>
<caption>Crossed Fingers Necklace: £150.00</caption>
<description>Solid silver crossed fingers good luck charm, cast from 1940s celluloid gumball toy, strung on mother of pearl or onyx beads.</description>
<thumbnail>
<thumb1>thumbnails/crossedfingers_main.jpg</thumb1>
<thumb2>thumbnails/crossedfingers_closeup.jpg</thumb1>
</thumbnail>
</pic>
</images>
The thumb 1,2 and 3 are childNodes of thumbnail.

I have created a MovieClip holder to hold the thumbnails. Could someone please show me how to add to the Actionscript so that it loops through (displays) the thumb1 - thumb 3 for each main image? I suppose I would have to store the thumbnails for each image in separate folders so the flash can determine the length of the array of thumbnails for each image? And then make them clickable.

I am pulling my hair out here not getting this working... Any hinters on what to do would be greatly appreciated!

Here is the actionscript code for the image gallery:


Code:

function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
caption = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
caption[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
/////////////////////////////////////
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;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
cap_txt.text = caption[p];
desc_txt.text = description[p];
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
cap_txt.text = caption[p];
desc_txt.text = description[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
cap_txt.text = caption[0];
desc_txt.text = description[0];
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
Thanks!!

XML Image Gallery: Replacing Xml To Load New Image Set?
Hi Kirupa crew!

First, big thanks for this great site!

Second, I'm struggling a bit on xml and hoping for a hand. Your xml image gallery is a sweet piece of work, and I would like to be able to add the functionality of being able to load different galleries from a menu without loading a new mc with gallery inside it. I managed to botch the file up pretty good on my own, and was wondering if there is a ready answer nearby.

So I'm thinking have but1, but2 and but3, with a seperate xml file for each. What would you recommend for a smooth way to swap the the xml files to the gallery, and load the first image of the new xml file? Also, can it be done with one big ol' xml file while keeping the galleries seperate? It's not necessary, but could be handy, and save some loading.

It would also be interesting to apply the same principle to the resizing script that Scotty has in that big Resizing thread, just a thought.

Many many thanks!
John

Image Gallery - Image Width
Hi,

I'm putting an image gallery together with all the pictures at the same _y. Here's my AS code:


a = 1;
pushOverX = 0;
var my_lv:LoadVars = new LoadVars();
my_lv.onLoad = function(success:Boolean) {
if (success) {
while (a<100) {
slider_mc.attachMovie("holder", "holder"+a, a, {_xushOverX, _y:0});
set("slider_mc.holder"+a+".load_var", eval("this.data"+a));
a = a+1;
pushOverX = pushOverX+100;
if (eval("this.data"+a) == undefined) {
break;
}
}
}
};
my_lv.load("load_in/image_data.txt");


All that works fine. However, I would like the images to be placed on the _x axis according to the width of each previous image instead of relying on pushOverX = pushOverX+100;

At the moment, an image is placed every 100px, but if an image is 50, I want the following one to be placed 50px after it and not fixed at every 100px.

Has anybody got an idea?

Thanks

Help- How To Load First Image From XML Image Gallery
Hi-
Help- I'd like to making the first image load onto movie. Attached is the code. Any hints would be awesome.

myPhoto = new XML();
myPhoto.ignoreWhite = true;
myPhoto.onLoad = function(success) {
//portfolioTag = this.firstChild;
numimages = this.firstChild.childNodes.length;
spacing = 70;
for (i=0; i<numimages; i++) {
picHolder = this.firstChild.childNodes[i];
thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
thumbHolder._x = i*spacing;
thumbLoader = thumbholder.createEmptyMovieClip("thumbnail_image" , 0);
thumbLoader.loadMovie(picHolder.attributes.appthmb );
thumbHolder.app = picHolder.attributes.app;
thumbHolder.appdesc = picHolder.attributes.appdesc;
thumbHolder.appmain = picHolder.attributes.appmain;
thumbHolder.onRelease = function() {
loader.loadMovie(this.appmain);
app_txt.text = this.app;
appdesc_txt.text = this.appdesc;
};
}
};
myPhoto.load("appphoto.xml");

XML Image Gallery Image Resize
I just got through with the XML image gallery tutorial that Kirupa made. First of all, I would like to thank him for it -- a great tutorial.
I am in the process of modifying the tutorial file to suit my needs, and I have come across a problem:
There is an empty movie clip with the instance name "image" that controls where the images from the XML flie are showed in the SWF. The empty movie clip "node" or placeholder aligns itself to the top left-hand corner of the images file. For my gallery to funciton correctly, I need the node to be aligned to the center of the image files, so I can display pictures of different aspect ratios and alignments. I will try and post a file on the internet some time today to demonstrate this if I am unclear with my explination. Thanks in advance!

XML Image Gallery - Setting X,y Of Image Via XML?
I'm working on version of Kirupa's XML Image Gallery, only I want to be able to set the x,y coordinates individually for each image. How do I do this via the XML.

I'm trying this to no avail:
XML looks like this:

<pic>
<image x="0" y="0">001.jpg</image>
<caption>description line 1</caption>
<caption2>description line 2</caption2>
<caption3>description line 3</caption3>
</pic>

<pic>
<image x="100" y="200">002.jpg</image>
<caption>description line 1</caption>
<caption2>description line 2</caption2>
<caption3>description line 3</caption3>
</pic>

Actionscript looks like this:

function placeImage() {
var image_x:Number = Number(picture.attributes.x);
var image_y:Number = Number(picture.attributes.y);
}

Can anyone let me know what I'm doing wrong, what I'm missing?
Or how better to go about this?

Thanks!

Centering Image In The Xml Image Gallery...
did the tutorial on this site for an xml image gallery - it worked great... My question would be is there a way to accomodate for multiple image sizes that would allow the image displayed to be centered?

Thanks!

Image Sizing In Image Gallery
I have used the Kirupa xml flash photo gallery at this link (code below) http://www.kirupa.com/developer/mx20...togallery9.htm

i was wondering how do i change the code so that the pictures can be different sizes... and where would the new code fit in to what i have already got from the tutorial?


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("images.xml");
/////////////////////////////////////
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;
}
}
};
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;
}


thanks

cazwalks

XML Image Gallery Image Resize
I just got through with the XML image gallery tutorial that Kirupa made. First of all, I would like to thank him for it -- a great tutorial.
I am in the process of modifying the tutorial file to suit my needs, and I have come across a problem:
There is an empty movie clip with the instance name "image" that controls where the images from the XML flie are showed in the SWF. The empty movie clip "node" or placeholder aligns itself to the top left-hand corner of the images file. For my gallery to funciton correctly, I need the node to be aligned to the center of the image files, so I can display pictures of different aspect ratios and alignments. I will try and post a file on the internet some time today to demonstrate this if I am unclear with my explination. Thanks in advance!

Copyright © 2005-08 www.BigResource.com, All rights reserved