A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: [F8] [FCS3] Photo album-ish thumbnail popping up larger image problem.

  1. #1
    Junior Member
    Join Date
    Mar 2003
    Posts
    21

    [F8] [FCS3] Photo album-ish thumbnail popping up larger image problem.

    I'm using Flash CS3, but this project began in 8 and uses AS 1 and 2, so I figured this was the more appropriate section.

    So I have a basic photo album for prototyping that is populated by values from an XML file. There are 9 maximum thumbnails (3 x 3) in each album. This all works.

    Upon onRelease of each thumbnail a pop up larger-view movie clip appears to display the respective larger image. The viewer movie clip appears fine and in the correct position. The problem is the larger image does not get loaded into the holder clip within the viewer. Output is telling me that the value that I'm pulling from the XML file is undefined.

    Both the thumbs and the larger images are using the same XML file and the same array. All of the pertinent code is within a class. All the correct files are in the folder they should be in. It is not a file not found error. Typos have been accounted for. The code for populating the thumbs is almost identical to the code for the larger image. It's just that one works, and the other doesn't.

    Code:
    class Photos extends MovieClip {
    	//
    	public var a:Number;
    	public var i:Number;
    	//
    	public function Photos() {
    	//load in XML
    		_root.photoXML = new XML();
    		_root.photoXML.ignoreWhite = true;
    		_root.photoXML.load("xmlData/photos.xml");
    		_root.photoXML.onLoad = function(success)	{
          	  if(success) {
    			  this.XmlConnect();
    			}
    		}
    	}
    	public function goPhotos() {
    		//
    		//	First build arrays:
    		_root.photosArray = new Array();
    		_root.totalPhotos = _root.photoXML.childNodes[0].childNodes.length;
    		// fill arrays ::
    		for (a=0; a<_root.totalPhotos; a++) {
    			if(_root.photoXML.childNodes[0].childNodes[a].attributes.blockNum == _root.blockNum and _root.photoXML.childNodes[0].childNodes[a].attributes.locNum == _root.locNum+1) {
    				_root.photosArray.push({photoName:_root.photoXML.childNodes[0].childNodes[a].attributes.title, photoFile:_root.photoXML.childNodes[0].childNodes[a].attributes.filename});
    			}
    		}
    		trace("photosArray length = "+_root.photosArray.length);
    		//
    		for(a=0;a<10;a++) {
    			_root.detail.photoSec.photosHolder["img"+a].img._alpha = 0;
    			_root.detail.photoSec.photosHolder["img"+a].img._visible = false;
    		}
    		//
    		for(a=0;a<_root.photosArray.length;a++) {
    			_root.detail.photoSec.photosHolder["img"+a].img.loadMovie("images/sm_"+_root.photosArray[a].photoFile+".jpg",a);
    			_root.detail.photoSec.photosHolder["img"+a].img._visible = true;
    			_root.detail.photoSec.photosHolder["img"+a].img._alpha = 100;
    		}
    		//
    		//
    		//
    		_root.detail.audioSec.vLoader.vHolder.unloadMovie();
    		_root.detail.audioSec.audioControlsHolder.vStat.grabBar._x = 0;
    		_root.detail.audioSec.vLoader.gotoAndStop(1);
    		//
    		//
    		//
    	}
    	public function hidePhotos() {
    		for(i=0;i<_root.photosArray.length;i++) {
    			_root.detail.photoSec.photosHolder["img"+i].enabled = false;
    		}
    	}
    	public function showPhotos() {
    		for(i=0;i<_root.photosArray.length;i++) {
    			_root.detail.photoSec.photosHolder["img"+i].enabled = true;
    		}
    	}
    	public function launchLargePhotoViewer(photoNum) {
    		/*_root.detail.photoSec.photosHolder["img"+_root.locNum].onRelease=function():Void {
    			_root.detail.largeViewerHolder.removeMovieClip();
    			_root.detail.createEmptyMovieClip("largeViewerHolder", _root.detail.getNextHighestDepth());
    			_root.detail.largeViewerHolder.attachMovie("largeViewer", "largeViewer"+i, _root.detail.largeViewerHolder.getNextHighestDepth(), {_x: 251.1, _y:-27.9});
    			_root.detail.largeViewerHolder["largeViewer"+i].createEmptyMovieClip("img", _root.detail.largeViewerHolder["largeViewer"+i].getNextHighestDepth());
    			_root.detail.largeViewerHolder["largeViewer"+i].img.loadMovie("images/md_"+_root.photosArray[i].photoFile+".jpg", i);
    			_root.detail.largeViewerHolder["largeViewer"+i].img._x = _root.detail.largeViewerHolder["largeViewer"+i]._x + (_root.detail.largeViewerHolder._width - _root.detail.largeViewerHolder["largeViewer"+i].pic._width)*.5;
    			_root.detail.largeViewerHolder["largeViewer"+i].img._y = _root.detail.largeViewerHolder["largeViewer"+i]._y + (_root.detail.largeViewerHolder._height - _root.detail.largeViewerHolder["largeViewer"+i].pic._height)*.5;
    		}*/
    		for (i=0;i<_root.photosArray.length;i++) {
    			_root.detail.photoSec.photosHolder["img"+i].onRelease=function():Void {
    				_root.detail.largeViewerHolder.removeMovieClip();
    				_root.detail.createEmptyMovieClip("largeViewerHolder", _root.detail.getNextHighestDepth());
    				_root.detail.largeViewerHolder.attachMovie("largeViewer", "largeViewer"+i, _root.detail.largeViewerHolder.getNextHighestDepth(), {_x: 251.1, _y:-27.9});
    				_root.detail.largeViewerHolder["largeViewer"+i].createEmptyMovieClip("img", _root.detail.largeViewerHolder["largeViewer"+i].getNextHighestDepth());
    				_root.detail.largeViewerHolder["largeViewer"+i].img.loadMovie("images/md_"+_root.photoXML.childNodes[0].childNodes[i].attributes.filename+".jpg", i);
    				_root.detail.largeViewerHolder["largeViewer"+i].img._x = _root.detail.largeViewerHolder["largeViewer"+i]._x + (_root.detail.largeViewerHolder._width - _root.detail.largeViewerHolder["largeViewer"+i].pic._width)*.5;
    				_root.detail.largeViewerHolder["largeViewer"+i].img._y = _root.detail.largeViewerHolder["largeViewer"+i]._y + (_root.detail.largeViewerHolder._height - _root.detail.largeViewerHolder["largeViewer"+i].pic._height)*.5;
    			}
    		}
    	}
    }
    I appreciate any insight into this conundrum.

    ETA: photoFile is the culprit of 'undefined'
    Last edited by Tandaemonium; 05-04-2007 at 12:27 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center