# I dare you to fix my problem!

**URL:** <https://forum.kirupa.com/t/i-dare-you-to-fix-my-problem/187178>\
**Category:** flash\
**Created:** [April 27, 2006, 6:57am UTC](https://forum.kirupa.com/t/i-dare-you-to-fix-my-problem/187178 "2006-04-27T06:57:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pixeladdict](https://avatars.discourse-cdn.com/v4/letter/p/c89c15/32.png) [@Pixeladdict](https://forum.kirupa.com/u/Pixeladdict)\
**Post date:** [April 27, 2006, 6:57am UTC](https://forum.kirupa.com/t/i-dare-you-to-fix-my-problem/187178/1 "2006-04-27T06:57:22Z")

</div>

Apparently this is a toughy… OR nobody really wants to help me out on this one.  
I got this scroller, right… and it automatically generates thumbs within a mask, accordingly to an XML file.

UNFORTUNATELY the WIDTH of the thumb is static… bad thing… very bad.

I got the thing to dynamically be the width of the thumb MC the image-thumb is in, BUT it will only be the width it is BEFORE the image is loaded in, which means 0px width.

```auto
MovieClip.prototype.easeX = function(x) {
 this.onEnterFrame = function() {
  this._x = x-(x-this._x)/1.2;
  if (Math.abs(x-this._x)<=1) {
   delete this.onEnterFrame;
   this._x = x;
  }
 };
};
images = new Array();
xml_file = "images2.xml";
xmlload = new XML();
xmlload.ignoreWhite = true;
xmlload.onLoad = function(ok) {
 if (ok) {
  count = this.firstChild.childNodes.length;
  for (var i = 0; i<count; i++) {
   curNode = this.firstChild.childNodes*;
   images* = {path:curNode.childNodes[0].firstChild.nodeValue,link:curNode.childNodes[1].firstChild.nodeValue,caption:curNode.childNodes[2].firstChild.nodeValue};
  }
  boot();
 } else {
  trace("Could not load "+xml_file+".");
 }
};
xmlload.load(xml_file);
// ------------------------------------------------------------
spacing = 1;
boot = function () {
 for (var i = 0; i<images.length; i++) {
  mc = container.attachMovie("thumbMC", "thumb"+i, i);
//the 56 is width of thumb
  mc._x = i*(50+spacing);
  mc.path = images*.path;
  mc.link = images*.link;
  mc.caption = images*.caption;
 }
 setRollOver();
};
setRollOver = function () {
 this.onEnterFrame = function() {
  if (this.mask.hitTest(_root._xmouse, _root._ymouse)) {
   slideMenu();
  }
 };
};
slideMenu = function () {
 diff = _xmouse-this._x;
 scale = diff*100/this.mask._width;
 target = -scale*(this.container._width-this.mask._width)/100;
 this.arrows.easeX(diff);
 this.container.easeX(target);
};

```

This is the complete code of the main MC - where the sroller is

```auto
MovieClip.prototype.backwards = function(){
 this.onEnterFrame = function(){
  this.prevFrame();
  if(this._currentframe == 1) delete this.onEnterFrame;
 }
}
loader.loadMovie(this.path);
percent = Math.floor(loader.getBytesLoaded()/loader.getBytesTotal()*100);
percentage.text = percent + "%";
aux.onEnterFrame = function() {
 if(loader._width>0) {
  delete this.onEnterFrame;
  loader.onRollOver = function(){
   delete over.onEnterFrame;
   over.play();
  }
  loader.onRollOut = function(){
   over.backwards();
  }
  loader.onRelease = function() {
   _root.containerMC.loadPic (this._parent.link);
   _root.captionMC.context.text = (this._parent.caption);
  };
 }
};

```

AS for the thumb MC

THIS is the code I’M thinking needs a little messing with, but I have failed misserably.

```auto
spacing = 1;
boot = function () {
 for (var i = 0; i<images.length; i++) {
  mc = container.attachMovie("thumbMC", "thumb"+i, i);
//the 50 is the static width of the thumb
  mc._x = i*(50+spacing);
  mc.path = images*.path;
  mc.link = images*.link;
  mc.caption = images*.caption;
 }
 setRollOver();
};

```

I’d REALLY love for that mc.\_x to be dynamic.

thanks in advance  
pxa

---

<div class="post-metadata">

**Author:** ![Pixeladdict](https://avatars.discourse-cdn.com/v4/letter/p/c89c15/32.png) [@Pixeladdict](https://forum.kirupa.com/u/Pixeladdict)\
**Post date:** [May 1, 2006, 10:18am UTC](https://forum.kirupa.com/t/i-dare-you-to-fix-my-problem/187178/2 "2006-05-01T10:18:51Z")

</div>

> [@thesean](#):
>
> DARE me to solve it eh?
> 
> I’m not quite sure what your problem is.
> 
> You are loading images into thumbnails, and then placing those thumbnails into an MC, then the MC is inside a scroll pane?
> 
> So we have  
> Scrollpane
> 
> - MC
> - thumbs
> - images
> 
> As far as I can tell, the thumbs are named thumbMC, and the MC that contains them is container, but where are your scroll pane properties? What is the scrollpane called?
> 
> So, which component are you having trouble setting the width with? Is it the thumbMC, the container, or the scroll pane?
> 
> Also, perhaps if you post an example or the .fla file I can help easier 🙂

thesean,

I sent you a message with the link to the fla.  
Hope you can help me out.
