# Resizing invisible buttons?

**URL:** <https://forum.kirupa.com/t/resizing-invisible-buttons/63462>\
**Category:** flash\
**Created:** [September 7, 2004, 4:51am UTC](https://forum.kirupa.com/t/resizing-invisible-buttons/63462 "2004-09-07T04:51:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![3rdeye](https://avatars.discourse-cdn.com/v4/letter/3/58f4c7/32.png) [@3rdeye](https://forum.kirupa.com/u/3rdeye)\
**Post date:** [September 7, 2004, 4:51am UTC](https://forum.kirupa.com/t/resizing-invisible-buttons/63462/1 "2004-09-07T04:51:27Z")

</div>

I’m loading jpegs dynamically and have an invisible button over top to cycle through them, but I can’t seem to get the “hit” part of the button to resize. Here’s my code:

var myMCL = new MovieClipLoader();

myMCL.loadClip(“images/db/body/”+imgLoad.imgLocal,"\_root.holder1.chapter1.holder2.combo1.imgHolder");

myMCL.onLoadInit = function(targetMC) {  
[indent]imgHit.\_x = targetMC.\_x;  
imgHit.\_y = targetMC.\_y;  
imgHit.\_width = targetMC.\_width;  
imgHit.\_height = targetMC.\_height;  
[/indent] }  
where “imgHit” is the instance of my button;  
the image loads no problems and a few other bits of code I have (resizing and centering) work fine… but I can’t get the button resized… any tips?

cheers

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 14, 2004, 5:08am UTC](https://forum.kirupa.com/t/resizing-invisible-buttons/63462/2 "2004-09-14T05:08:45Z")

</div>

anyone???

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 14, 2004, 5:55am UTC](https://forum.kirupa.com/t/resizing-invisible-buttons/63462/3 "2004-09-14T05:55:03Z")

</div>

If that’s not working, you could try putting the button AS in it’s own event handler:

```auto
imgHit.onEnterFrame = function() {
     this._x = someMC._x;
     this._y = someMC._y;
     this._width = someMC._width;
     this._height = someMC._height;
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 14, 2004, 6:15am UTC](https://forum.kirupa.com/t/resizing-invisible-buttons/63462/4 "2004-09-14T06:15:16Z")

</div>

thanks for the reply… it’s weird because the resize now works with an invisible element in the “up” frame of the button… but then only once… after the first click, button dissapears… ???

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 14, 2004, 11:43am UTC](https://forum.kirupa.com/t/resizing-invisible-buttons/63462/5 "2004-09-14T11:43:45Z")

</div>

I have a problem that’s bugging me too that’s a bit like this…  
First of all, I’ve loaded some images onto the stage using attachMovie and I now want to add actionscript to them. The images and the widths and heights were loaded from XML…

```auto

	for (i=_root.currentImage; i < _root.currentImage+6; i++) {
		if (i < _root.totalImages) {
			_root.attachMovie("pictureClip","image"+i,i);
			_root["image"+i].pictureFrame.loadMovie(_root.imagesFilename*+".jpg");
			_root["image"+i]._x = xpos;
			_root["image"+i]._y = ypos;
			xpos += 160;
			if (xpos > 160) {
				xpos = 0;
				ypos += 110;
			}
			thisImageName = _root.imagesFilename*+".jpg";
			thisImageWidth = Number(_root.imagesWidth*);
			thisImageWidth += 20;
			thisImageHeight = Number(_root.imagesHeight*);
			thisImageHeight += 30;
			**_root["image"+i].onRelease = function() {
				getURL ("JavaScript:openWin('"+thisImageName+"','"+thisImageWidth+"','"+thisImageHeight+"')");
			}** } else {
			_root.nextButton._visible = false;
		}
	}

```

Now it loads up all the images properly and puts actionscript on them but the problem is, the values for the image height and width are applied to ALL of the buttons (so the last image overwrites all the previous ones!). Can anyone help with how I can prevent this?

Many thanks,  
David Fox

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 14, 2004, 2:11pm UTC](https://forum.kirupa.com/t/resizing-invisible-buttons/63462/6 "2004-09-14T14:11:10Z")

</div>

Could you post your FLA 3rd?
