# XML gallery; thumbnail buttons refuse to operate

**URL:** <https://forum.kirupa.com/t/xml-gallery-thumbnail-buttons-refuse-to-operate/241986>\
**Category:** flash\
**Created:** [October 20, 2007, 1:26pm UTC](https://forum.kirupa.com/t/xml-gallery-thumbnail-buttons-refuse-to-operate/241986 "2007-10-20T13:26:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Derugash](https://avatars.discourse-cdn.com/v4/letter/d/c68b51/32.png) [@Derugash](https://forum.kirupa.com/u/Derugash)\
**Post date:** [October 20, 2007, 1:26pm UTC](https://forum.kirupa.com/t/xml-gallery-thumbnail-buttons-refuse-to-operate/241986/1 "2007-10-20T13:26:34Z")

</div>

I have a bit of code that doesn’t do what I want it to do. As this is not an uncommon occurence, I’ll elaborate!

The piece of code is a modified (by me) snippet from the ‘‘Adding thumbnails’’ tutorial for the XML gallery here on kirupa.

```auto

[IMG]file:///J:/DCIM/124CANON/IMG_2480.JPG[/IMG]function thumbNailScroller() {
this.createEmptyMovieClip("tscroller", 1000);
scroll_speed = 10;

this.onMouseDown=function()
{
    MouseDown=true
}
this.onMouseUp=function()
{
    MouseDown=false
}

tscroller.onEnterFrame = function() {

if ((_root._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {

if ((_root._xmouse>=(hit_right._x-40)) && (thumbnail_mc.hitTest(hit_right)) && (MouseDown == true)) {

thumbnail_mc._x -= scroll_speed;

} else if ((_root._xmouse<=23) && (thumbnail_mc.hitTest(hit_left) && (MouseDown == true))) {

thumbnail_mc._x += scroll_speed;
}
} else {
delete tscroller.onEnterFrame;
}
};
}

```

This code works more or less fine, with the sidenote that the buttons will cease functioning when you release the mouse outside one. Thats a minor issue I’m sure I can find a way to fix. (although I’m open to suggestions )  
The main issue is that these buttons stop working completely when I load the .swf containing above code into a movieclip in my ‘‘main’’ flash file.  
I’m using

```auto

PortfolioContainer.loadMovie("Portfolio.swf");

```

to load it. Everything inside the portfolio.swf works as its supposed to when its loaded into the ‘PortfolioContainer’ moveclip, but the thumbnail buttons do not.  
I’ve tried adding a \_root here and there, but that didn’t seem to change anything. I have a feeling the code can’t find the hit\_left and hit\_right buttons for some reason, but am unsure how to fix that.  
I’d appreciate it if someone would be kind enough to take a look at this and hopefully see whats wrong!
