# \[FMX\] Movieclips with linkage

**URL:** https://forum.kirupa.com/t/fmx-movieclips-with-linkage/119078
**Category:** flash
**Created:** [August 11, 2004, 9:58am UTC](https://forum.kirupa.com/t/fmx-movieclips-with-linkage/119078 "2004-08-11T09:58:15Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![dboers](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@dboers](https://forum.kirupa.com/u/dboers)
#### Post date: [August 11, 2004, 9:58am UTC](https://forum.kirupa.com/t/fmx-movieclips-with-linkage/119078/1 "2004-08-11T09:58:15Z")

</div>

I have 8 mc’s (thumb\_01, thumb\_02 …thumb\_08). Those mc’s are insite another mc (thumbsMC) I control them the following way:

```auto
function setButton() {
for (var i in thumbsMc) {
if (thumbsMc*._name.substr(0, 6) == "thumb_") {
clip = thumbsMc*;
clip.onRollOver = function() {
	this.gotoAndStop(2);
};
clip.onRollOut = function() {
	if (!this.pushed) {
	 this.gotoAndStop(1);
	} else {
	 this.gotoAndStop(2);
	}
};
clip.onRelease = function() {
	_root.resetKnop();
	this.pushed = true;
	this.gotoAndStop(2);
};
}
}
}
function resetKnop() {
for (var i in thumbsMC) {
if (thumbsMC*._name.substr(0, 6) == "thumb_") {
clip = thumbsMc*;
clip.pushed = false;
clip.gotoAndStop(1);
}
}
}
setButton();

```

In the library I have 8 picture mc’s (album01, album02 … album08) all with a linkage. What kind of function do I need to accomplish that when thumb\_01 is pressed, album01 is attached to the container on the stage and the same with the other thumbs.

---

<div class="post-metadata">

### Author: ![RvGaTe](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rvgate/32/126_2.png) [@RvGaTe](https://forum.kirupa.com/u/RvGaTe)
#### Post date: [August 11, 2004, 3:32pm UTC](https://forum.kirupa.com/t/fmx-movieclips-with-linkage/119078/2 "2004-08-11T15:32:21Z")

</div>

\_root.container.attachMovie(“linkageName”",“newname”,level);

will give you:

\_root.container.newname

containing the thing that was in the library

---

<div class="post-metadata">

### Author: ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)
#### Post date: [August 11, 2004, 3:51pm UTC](https://forum.kirupa.com/t/fmx-movieclips-with-linkage/119078/3 "2004-08-11T15:51:34Z")

</div>

Try this on the main timeline  
for (var i = 1; i\<9; i++) {  
thumbsMC[“thumb\_0”+i].ivar = i;  
thumbsMC[“thumb\_0”+i].onPress = function() {  
\_root.container.attachMovie(“album\_0”+this.ivar, “album\_0”+this.ivar, this.ivar);  
};  
}  
I`ve done it so each is attached at a different depth but if you want to replace one with another just use the same depth.

---

<div class="post-metadata">

### Author: ![dboers](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@dboers](https://forum.kirupa.com/u/dboers)
#### Post date: [August 11, 2004, 4:11pm UTC](https://forum.kirupa.com/t/fmx-movieclips-with-linkage/119078/4 "2004-08-11T16:11:05Z")

</div>

Thanks a lot RvGaTe and stringy 😉

@ stringy

Where do I itegrate this in the excisting script

Thanks in advance

---

<div class="post-metadata">

### Author: ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)
#### Post date: [August 11, 2004, 4:38pm UTC](https://forum.kirupa.com/t/fmx-movieclips-with-linkage/119078/5 "2004-08-11T16:38:52Z")

</div>

> [@dboers](#):
>
> Thanks a lot RvGaTe and stringy 😉
> 
> @ stringy
> 
> Where do I itegrate this in the excisting script
> 
> Thanks in advance

for (var i = 1; i\<9; i++) {  
thumbsMC[“thumb\_0”+i].ivar = i;  
}  
function setButton() {  
for (var i in thumbsMc) {  
if (thumbsMc\*._name.substr(0, 6) == "thumb_") {  
clip = thumbsMc\*;  
clip.onRollOver = function() {  
this.gotoAndStop(2);  
};  
clip.onRollOut = function() {  
if (!this.pushed) {  
this.gotoAndStop(1);  
} else {  
this.gotoAndStop(2);  
}  
};  
clip.onRelease = function() {  
\_root.container.attachMovie(“album\_0”+this.ivar, “album\_0”+this.ivar, this.ivar);  
\_root.resetKnop();  
this.pushed = true;  
this.gotoAndStop(2);  
};  
}  
}  
}  
setButton();

it does not really go with your script and there is probably a better way but i think it will work

EDIT:-try  
if (thumbsMc\*._name.substr(0, 6) == "thumb_") {  
clip = thumbsMc\*;  
this line-\> clip.ivar = Number(clip.\_name.substr(7, 1));

instead of my loop

---

<div class="post-metadata">

### Author: ![dboers](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@dboers](https://forum.kirupa.com/u/dboers)
#### Post date: [August 12, 2004, 4:11am UTC](https://forum.kirupa.com/t/fmx-movieclips-with-linkage/119078/6 "2004-08-12T04:11:09Z")

</div>

The first part isn’t working

I get a little confused. Where should I place that last line ?

```auto
clip.ivar = Number(clip._name.substr(7, 1));

```

And what part should I leave out.

---

<div class="post-metadata">

### Author: ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)
#### Post date: [August 12, 2004, 6:56am UTC](https://forum.kirupa.com/t/fmx-movieclips-with-linkage/119078/7 "2004-08-12T06:56:07Z")

</div>

> [@dboers](#):
>
> The first part isn’t working
> 
> I get a little confused. Where should I place that last line ?
> 
> ```auto
> clip.ivar = Number(clip._name.substr(7, 1));
> 
> ```
> 
> And what part should I leave out.

Well the other option is unlikely to work,does the same thing but i thought it matched your code a little better.

for (var i in thumbsMc) {  
if (thumbsMc\*._name.substr(0, 6) == "thumb_") {  
clip = thumbsMc\*;  
clip.ivar = Number(clip.\_name.substr(7, 1));  
clip.onRollOver = function() {  
this.gotoAndStop(2);  
};

and later

clip.onRelease = function() {  
\_root.container.attachMovie(“album\_0”+this.ivar, “album\_0”+this.ivar, this.ivar);  
\_root.resetKnop();  
this.pushed = true;  
this.gotoAndStop(2);  
};

---

<div class="post-metadata">

### Author: ![dboers](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@dboers](https://forum.kirupa.com/u/dboers)
#### Post date: [August 12, 2004, 8:05am UTC](https://forum.kirupa.com/t/fmx-movieclips-with-linkage/119078/8 "2004-08-12T08:05:02Z")

</div>

I did what you;ve said but I cant get it to work. I have attached the zip file. Maybe If you have the time you can have a look at it. To make the file not to heavy I removed the big pictures.

Thanks in advance,  
Donald

---

<div class="post-metadata">

### Author: ![dboers](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@dboers](https://forum.kirupa.com/u/dboers)
#### Post date: [August 12, 2004, 3:40pm UTC](https://forum.kirupa.com/t/fmx-movieclips-with-linkage/119078/9 "2004-08-12T15:40:00Z")

</div>

Anybody else?

---

<div class="post-metadata">

### Author: ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)
#### Post date: [August 12, 2004, 4:09pm UTC](https://forum.kirupa.com/t/fmx-movieclips-with-linkage/119078/10 "2004-08-12T16:09:52Z")

</div>

> [@dboers](#):
>
> Anybody else?

I am unable to find anything with linkage identifier album01 etc.  
when i wrote the code before i thought you were attaching album\_01etc  
so if you give linkage identifiers album01,album02…  
use  
\_root.fotos.containerMC.attachMovie(“album0”+this.ivar, “album0”+this.ivar, 5);

try putting a trace in the clip.onRelease and you`ll see what is happening better  
trace(this.ivar)  
Both sets of code should work with this.

---

<div class="post-metadata">

### Author: ![dboers](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@dboers](https://forum.kirupa.com/u/dboers)
#### Post date: [August 13, 2004, 5:15am UTC](https://forum.kirupa.com/t/fmx-movieclips-with-linkage/119078/11 "2004-08-13T05:15:44Z")

</div>

Hi stringy,

It’s almost working 🙂 but what should I do to make them load at the same depth?

---

<div class="post-metadata">

### Author: ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)
#### Post date: [August 13, 2004, 5:28am UTC](https://forum.kirupa.com/t/fmx-movieclips-with-linkage/119078/12 "2004-08-13T05:28:33Z")

</div>

> [@dboers](#):
>
> Hi stringy,
> 
> It’s almost working 🙂 but what should I do to make them load at the same depth?

Just put a value into the depth thing like above  
\_root.fotos.containerMC.attachMovie(“album0”+this.ivar, “album0”+this.ivar, 5);

One should then replace the other.

---

<div class="post-metadata">

### Author: ![dboers](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@dboers](https://forum.kirupa.com/u/dboers)
#### Post date: [August 13, 2004, 5:47am UTC](https://forum.kirupa.com/t/fmx-movieclips-with-linkage/119078/13 "2004-08-13T05:47:43Z")

</div>

That simple 😊 Thank you very very much :thumb: Everything is working fine!

One quoestion of intrest You lately added this line of code:

```auto
clip.ivar = Number(clip._name.substr(7, 1));

```

What is that one doing?

Cheers stringy 🍺

---

<div class="post-metadata">

### Author: ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)
#### Post date: [August 13, 2004, 5:53am UTC](https://forum.kirupa.com/t/fmx-movieclips-with-linkage/119078/14 "2004-08-13T05:53:25Z")

</div>

> [@dboers](#):
>
> That simple 😊 Thank you very very much :thumb: Everything is working fine!
> 
> One quoestion of intrest You lately added this line of code:
> 
> ```auto
> clip.ivar = Number(clip._name.substr(7, 1));
> 
> ```
> 
> What is that one doing?
> 
> Cheers stringy 🍺

That was instead of the loop  
for (var i = 1; i\<9; i++) {  
thumbsMC[“thumb\_0”+i].ivar = i;  
}  
so you only need one or the other  
I just thought it was more in line with how you are scripting.

---

<div class="post-metadata">

### Author: ![dboers](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@dboers](https://forum.kirupa.com/u/dboers)
#### Post date: [August 13, 2004, 6:58am UTC](https://forum.kirupa.com/t/fmx-movieclips-with-linkage/119078/15 "2004-08-13T06:58:50Z")

</div>

I understand 🙂 Thanks a lot

---

<div class="post-metadata">

### Author: ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)
#### Post date: [August 13, 2004, 12:08pm UTC](https://forum.kirupa.com/t/fmx-movieclips-with-linkage/119078/16 "2004-08-13T12:08:13Z")

</div>

> [@dboers](#):
>
> I understand 🙂 Thanks a lot

you are welcome
