Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

control _x and _y of dynamic thumbnails

Status
Not open for further replies.

storm80y

Programmer
Mar 9, 2005
1
AU
Help with basic AS please - dynamic image placement

I am having trouble with a script that was purchased for a clients site, it draws thumbnails within a scroller component. I

need the images to be aligned x and y axis differently based on whether they are portrait (29px H) or landscape (122px H). As

all of the loaded images conform to a naming convention based on whether they are portrait or landscape I figure you should

be able to test the current image name and display it as necessary eg. LE_BEA_PL_001.jpg will always contain "PL" Panoramic

Landscape and LE_BEA_PP_001.jpg will always contain "PP" for Panoramic Portrait. So I tried:

Code:
                  curMCsize = curMC.substr(7,8);
		if (curMCsize =="PP"){
		curMC._x=myCol*(curMC._width+50);
		curMC._y=myRow*(curMC._height+80);
		}else{
		curMC._x=myCol*(curMC._width+1);
		curMC._y=myRow*(curMC._height+1);
		}


Where the as that alters the x and y of the thumbnails is:
Code:
curMC._x=myCol*(curMC._width+50);
curMC._y=myRow*(curMC._height+80);

in the following script (which is part of a larger movie):


Code:
	function createClip(i){
		skin = "0";
		var attachWhat:String = (useThumbnails=="true") ? "skin"+skin+"_thumbnail" : "skin"+skin+"_galItem";
		thumbLoader.content.attachMovie(attachWhat,"gal"+i,i);
		var curMC:MovieClip = thumbLoader.content["gal"+i];
		curMC._alpha=0;
		if(useThumbnails=="true"){
			var imageStuff:Array = String(myArray[i][0]).split("/");
			var myThumb:String = curGalDir+"/thumbs/"+(imageStuff[imageStuff.length - 1]);
			curMC.image_mc.loadMovie(myThumb);
			var tmpMC:MovieClip = curMC._parent.createEmptyMovieClip("tmp"+i, i+10000);
			tmpMC.onEnterFrame=function(){
				

if((curMC.image_mc.getBytesLoaded()==curMC.image_mc.getBytesTotal())&&curMC.image_mc.getBytesTotal()>50){
					curMC.image_mc._x-=(curMC.image_mc._width/2);
					curMC.image_mc._y-=(curMC.image_mc._height/2);
					delete this.onEnterFrame;
				}
			}
		}
		curMC.current_mc._alpha=0;
		curMC.i = i;
		animateIn(curMC, 100, "_alpha", 30);
		curMC.myImage=myArray[i][0];
		curMC.i=i;
		curMC._x=myCol*(curMC._width+50);
		curMC._y=myRow*(curMC._height+80);
		var colMax:Number =  (useThumbnails=="true") ?  columns_thumbs : columns_no_thumbs ;
		if(myCol==colMax)myRow++;
		myCol=(myCol<colMax)? myCol+1 : 0;
		curMC.onRollOver=function() {
			if(galEnabled!=0)animateIn(this.btn1_mc, 15, "frame", 15);
		}

I can post the .fla if necessary, I would love to see the end of this one as I've been toying with it on and off for weeks.

Scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top