Hi!
I finally got my image gallery code working. It is already showing the images. Now I need to make this images slide when the user passes a mouse over the images.
I was thinking about putting all the images inside a MC ( container) and make this container scrolls to left or right depending on the mouse position.
Here is my code so far.
package
{
import flash.display.Loader;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.MouseEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
public class imageGallery extends MovieClip
{
var xmlPic : XML;
var xmlLoader : URLLoader = new URLLoader();
var imgLoader : Loader;
var container : MovieClip = new MovieClip();
var thumbs : Array = new Array();
public function imageGallery()
{
init();
}
private function init():void
{
loadImgs();
}
private function loadImgs():void
{
xmlLoader.load(new URLRequest("album.xml"));
xmlLoader.addEventListener(Event.COMPLETE,onXMLLoaded);
}
private function onXMLLoaded(event:Event):void
{
xmlPic = new XML(xmlLoader.data);
for (var i:uint = 0;i < 3;i++)
{
thumbs.push(xmlPic.pic*.@url);
}
loadThumbs();
}
private function loadThumbs():void
{
for(var j:uint = 0; j < thumbs.length ;j++)
{
imgLoader = new Loader();
imgLoader.load(new URLRequest(thumbs[j]));
imgLoader.x += (102 * j);
imgLoader.y = 10;
addChild(imgLoader);
}
}
}
}
How would I add the images into a container MC? I try to create a MC and add it like container.addChild(imgLoader); but the images dont appear.
How would I do it? Put those images inside a container MC and make it scroll?