[Flashr] Photo movieclip help

Kelvin Luck kelvin at kelvinluck.com
Tue Aug 12 20:23:07 PDT 2008


Hi,

The simplist way might be to pass a reference to the photo into the movieclip.

e.g. - just after your mc._alpha line add this:

mc.photo = thisPhoto;

And then change this line:

mc2.my_txt.text = thisPhoto.title;

to:

mc2.my_txt.text = photo.title;

Hopefully that will work - it's been quite a while since I've programmed any AS2... If not let me know and I'll try and suggest another approach,

Hope that helps,

Kelvin :)

On Fri, 08 Aug 2008 15:30:19 -0300, charles carlson <ccarlson83 at yahoo.com> wrote:

> I'm not the most advanced programmer so I'm hoping you guys could help out on a bit of code. I'm using the UserRecentPhoto.as demo file right now.
>
> Is there a way to call a certain photo movieclip in the for loop section so that I can grab the photo's title and other information to put into a dynamic text box on rollover?  Right now when I rollover any photo, it calls the last  'thisPhoto.title' of the loop.
>
> here's an example of my for loop code:
>
> mc2.createTextField("my_txt", 1, 100, 100, 300, 100);
>
> for (var i:Number=0; i<photosArray.length; i++) {
>
> 		var thisPhoto:Photo = Photo(photosArray[i]);
> 		
> 		var mc:MovieClip = _target.createEmptyMovieClip("photo"+i, i);
> 		
> 		mc._x = (i%6) * 75;
>
> 		mc._y = 20 + Math.floor(i/6) *20;
>
> 		mc.createEmptyMovieClip("jpgHolder", 1);
>
> 		mc.jpgHolder.loadMovie(thisPhoto.mediumUrl);
> 		
> 		mc._alpha=25;
> 		
> 		mc.onRollover = function(){
> 			//trace(thisPhoto.title);
> 			this._alpha=100;
> 			this.swapDepths(_root.x);
> 			mc2.my_txt.text = thisPhoto.title;
> 		}
>
> mc.onRollOut = function(){
> 			this._alpha=25;
> 			mc2.my_txt.text = " ";
> 		}
> 		
> 		mc.onPress = function(){
> 			//trace("onPress");
> 			startDrag(this, false);
> 		}
> 		
> 		mc.onRelease = function(){
> 			//trace("onRelease");
> 			stopDrag();
> 		}
>
>
> }
>
>
>
> 
>
> _______________________________________________
> Flashr mailing list
> Flashr at osflash.org
> http://osflash.org/mailman/listinfo/flashr_osflash.org
> 






More information about the Flashr mailing list