Hello people some body can help me? Please.
I’have a simple flash galery,
I need to change little logic.
Now it works lkee that, you click at the thumbs, then show big image.
What i want,
is that when I click on thumb, it stll open a big mage, but if this big image have another image i can navigate. Its like category.
So some bodey can help me?
Here is a code.
import fl.containers.UILoader;
import caurina.transitions.*;
//---------loading the external xml file-------
var urlRequest:URLRequest = new URLRequest("pics.xml");
var urlLoader:URLLoader = new URLLoader();
var myXML:XML = new XML();
var xmlList:XMLList;
myXML.ignoreWhitespace = true;
urlLoader.addEventListener(Event.COMPLETE,fileLoaded);
urlLoader.load(urlRequest);
//--------holds the paths to the thumbnails-------
var arrayURL:Array = new Array();
//--------holds the paths to the big photos-------
var arrayName:Array = new Array();
//--------holds the thumbnail objects-------
var holderArray:Array = new Array();
//--------represents the number of collumns-------
var nrColumns:uint = 5;
//-------represents the container of our gallery
var sprite:Sprite = new Sprite();
addChild(sprite);
var thumb:Thumbnail;
//-------- the thumbnails container-------
var thumbsHolder:Sprite = new Sprite();
sprite.addChild(thumbsHolder);
//-------- the photoLoader container-------
var loaderHolder:Sprite = new Sprite();
loaderHolder.graphics.beginFill(0xffffff,1);
loaderHolder.graphics.drawRect(0,0,550,330);
loaderHolder.graphics.endFill();
loaderHolder.x = 1000;
loaderHolder.y = 10;
sprite.addChild(loaderHolder);
//-------- loads the big photo-------
var photoLoader:UILoader = new UILoader();
photoLoader.width = 540;
photoLoader.height = 320;
photoLoader.y = 5;
photoLoader.x = 5;
photoLoader.buttonMode = true;
photoLoader.addEventListener(MouseEvent.CLICK,onClickBack);
loaderHolder.addChild(photoLoader);
/* we loop through the xml file
populate the arrayURL, arrayName and position the thumbnalis*/
function fileLoaded(event:Event):void {
myXML = XML(event.target.data);
xmlList = myXML.children();
for (var i:int=0; i<xmlList.length(); i++) {
var picURL:String = xmlList*.url;
var picName:String = xmlList*.big_url;
arrayURL.push(picURL);
arrayName.push(picName);
holderArray* = new Thumbnail(arrayURL*,i,arrayName*);
holderArray*.addEventListener(MouseEvent.CLICK,onClick);
holderArray*.name = arrayName*;
trace(arrayName*);
holderArray*.buttonMode = true;
if (i<nrColumns) {
holderArray*.y = 65;
holderArray*.x = i*110+65;
} else {
holderArray*.y = holderArray[i-nrColumns].y+110;
holderArray*.x = holderArray[i-nrColumns].x;
}
thumbsHolder.addChild(holderArray*);
}
}
//----handles the Click event added to the thumbnails--
function onClick(event:MouseEvent):void {
photoLoader.source = event.currentTarget.name;
Tweener.addTween(thumbsHolder, {x:-650, time:1, transition:"easeInElastic"});
Tweener.addTween(loaderHolder, {x:10, time:1, transition:"easeInElastic"});
Tweener.addTween(thumbsHolder, {alpha:0, time:1, transition:"linear"});
Tweener.addTween(loaderHolder, {alpha:1, time:1, transition:"linear"});
}
//----handles the Click event added to the photoLoader----
function onClickBack(event:MouseEvent):void {
Tweener.addTween(thumbsHolder, {x:0, time:1, transition:"easeInElastic"});
Tweener.addTween(loaderHolder, {x:1000, time:1, transition:"easeInElastic"});
Tweener.addTween(thumbsHolder, {alpha:1, time:2, transition:"linear"});
Tweener.addTween(loaderHolder, {alpha:0, time:2, transition:"linear"});
}