I have a photo gallery but what i want to do is when i click on a photo i want the name of that photo to be shown in a dynamic text field. pls help because i am beating my brain over it
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=4; //-------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=500; loaderHolder.y=300; sprite.addChild(loaderHolder); //-------- loads the big photo------- var photoLoader:UILoader = new UILoader(); photoLoader.width=550; photoLoader.height=330; photoLoader.y=0; photoLoader.x=0; photoLoader.buttonMode=true; photoLoader.addEventListener(MouseEvent.CLICK,onClickBack); loaderHolder.addChild(photoLoader); loaderHolder.visible=false; /* 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; iand the thumbnail class
package { import flash.display.Sprite; import fl.containers.UILoader; import caurina.transitions.*; import flash.events.MouseEvent; public class Thumbnail extends Sprite { public var nume:String; public var url:String; private var id:int; private var loader:UILoader; function Thumbnail(source:String,itemNr:int,numeThumb:String):void { url = source; id = itemNr; this.nume = numeThumb; drawLoader(); addEventListener(MouseEvent.MOUSE_OVER,onOver); addEventListener(MouseEvent.MOUSE_OUT,onOut); scaleThumb(); } private function drawLoader():void { loader = new UILoader(); loader.source = url; loader.mouseEnabled = false; loader.x = -50; loader.y = -50; addChild(loader); } private function onOver(event:MouseEvent):void { Tweener.addTween(this, {scaleX:1,scaleY:1, time:1, transition:"easeoutelastic"}); Tweener.addTween(this, {alpha:1, time:1, transition:"easeoutelastic"}); } private function onOut(event:MouseEvent):void { Tweener.addTween(this, {scaleX:.9,scaleY:.9, time:1, transition:"easeoutelastic"}); Tweener.addTween(this, {alpha:.5, time:1, transition:"easeoutelastic"}); } private function scaleThumb():void { this.scaleX = .9; this.scaleY = .9; this.alpha = .5; } } }