# Following mouse bar resizeble (more or less)

**URL:** https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175
**Category:** Uncategorized
**Created:** [April 25, 2003, 12:34am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175 "2003-04-25T00:34:12Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![thekok](https://avatars.discourse-cdn.com/v4/letter/t/9e8a1a/32.png) [@thekok](https://forum.kirupa.com/u/thekok)
#### Post date: [April 25, 2003, 12:34am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/1 "2003-04-25T00:34:12Z")

</div>

Hi there!  
In my main movie i got few buttons of different size and one bar on the bottom of the stage which is following the mouse.  
Because the buttons are different i would like to shape this bar with the same size ( width ) every time.  
sample :  
small link like HOME will have a bar so long ----  
long link like PERSONAL RESEARCH will have this bar ----------------------

hope u get what i mean.

//action for the controller

onClipEvent (enterFrame){  
cX=\_root.follow.\_x;  
difX=cX-xPos;  
setProperty (\_root.follow, \_x, cX-(difX/3));  
}

//action for buttons

on (rollOver){  
\_root.control.xPos= 41;  
}  
// i know i should use and define a function but …don’t know how.

thank for any suggestion u can make  
:toad:

---

<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: [April 25, 2003, 1:36am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/2 "2003-04-25T01:36:13Z")

</div>

just set the \_width property of \_root.follow (assuming follow is the instance name of the bar… ?) equal to the width of each button.

if you’re using Button symbols, you’ll need to use the instance name.

```auto
on (rollOver) {
_root.control.xPos = 41;
_root.follow._width = buttonInstance._width;
}

```

if you’re using a MovieClip symbol as Button:

```auto
on (rollOver) {
_root.control.xPos = 41;
_root.follow._width = this._width;
}

```

hope it helps. =)

---

<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: [April 25, 2003, 1:45am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/3 "2003-04-25T01:45:18Z")

</div>

thanks man  
guess i 'll need few hours to realize what u suggested me.  
i am using button symbols.  
iz 15 mins to 4 am here but i 'll try ur way.  
be back soon  
thanks again

---

<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: [April 25, 2003, 1:55am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/4 "2003-04-25T01:55:47Z")

</div>

ok first trial.

on (rollOver){  
\_root.control.xPos=187;  
\_root.follow.\_width = tw.\_width;  
}  
on (release) {  
loadMovie(“tw.swf”,“bio\_dummy”);  
}

# // tw is the button istance.

as soon as u go over this button the bar became very very long (nearly the w-stage ) and it doesn’t change anymore.  
funny trick but i guess i miss something…

i assigned an istance to the one of the buttons and i paste your code after mine as above…  
going to try again  
thanks  
ciao

---

<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: [April 25, 2003, 2:01am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/5 "2003-04-25T02:01:33Z")

</div>

it can be sounds very stupid but i was thinking  
who 's gonna tell the controller to reset the size bar when the user goes out of the hit area ??  
do i need a onRollOut action ??  
very stupid but…

---

<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: [April 25, 2003, 2:07am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/6 "2003-04-25T02:07:02Z")

</div>

yup… you could store the original width of the bar in a variable, then in the rollOut event:

```auto
on (rollOut) {
_root.follow._width = yourVariable;
}

```

🙂

---

<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: [April 25, 2003, 2:11am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/7 "2003-04-25T02:11:17Z")

</div>

sorry man i am thick  
can u be more clear because i am not having breakfast with variables…

---

<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: [April 25, 2003, 2:14am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/8 "2003-04-25T02:14:02Z")

</div>

paste this code in the timeline:

```auto
_global.originalWidth = follow._width;

```

on the buttons you’d have this code:

```auto
on (rollOut) {
_root.follow._width = originalWidth;
}

```

😉

---

<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: [April 25, 2003, 2:15am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/9 "2003-04-25T02:15:09Z")

</div>

going now 2 paste  
what time is in there?

---

<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: [April 25, 2003, 2:19am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/10 "2003-04-25T02:19:17Z")

</div>

09:15 pm

i’m leaving at 11:00 pm (party!!) so we still have time. 😛

---

<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: [April 25, 2003, 2:21am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/11 "2003-04-25T02:21:02Z")

</div>

man i am so sorry ,  
following ur tips but it doesn’t work to me and i hope i’ll get u in few hours .  
ciao and grazie!!!

---

<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: [April 25, 2003, 2:23am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/12 "2003-04-25T02:23:11Z")

</div>

gonna be alive for 10 mins  
can we do it  
don’t forget i am thick!

---

<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: [April 25, 2003, 2:23am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/13 "2003-04-25T02:23:43Z")

</div>

ok… i guess i could set up an example for you. 😉

---

<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: [April 25, 2003, 2:27am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/14 "2003-04-25T02:27:59Z")

</div>

on one of the buttons:

on (rollOver) {  
\_root.control.xPos = 187;  
\_root.follow.\_width = thougtswords.\_width;  
}

on (rollOut) {  
\_root.follow.\_width = originalWidth;  
}

on the first frame of the timeline:

\_global.originalWidth = follow.\_width;

smelling errors  
did i still miss smthing?

---

<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: [April 25, 2003, 2:30am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/15 "2003-04-25T02:30:09Z")

</div>

don’t work too much …save energy x the party  
appreciating

---

<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: [April 25, 2003, 2:36am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/16 "2003-04-25T02:36:52Z")

</div>

ok… here it is. =)

---

<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: [April 25, 2003, 2:43am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/17 "2003-04-25T02:43:44Z")

</div>

sorry… my friends are here (a bit early!?). got to go. :-\

i hope you can solve the problem. 😉

---

<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: [April 25, 2003, 2:48am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/18 "2003-04-25T02:48:44Z")

</div>

dead now  
thanks  
need to sleep  
thanks  
do u mind a question after the party  
ciao

---

<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: [April 25, 2003, 6:02am UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/19 "2003-04-25T06:02:39Z")

</div>

> _Originally posted by thekok_  
> **do u mind a question after the party**

shoot. 😉

**ps.** party sucked big time. :-\

---

<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: [April 25, 2003, 2:28pm UTC](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175/20 "2003-04-25T14:28:51Z")

</div>

i am here but i guess u sleeping now…??

[Next page](https://forum.kirupa.com/t/following-mouse-bar-resizeble-more-or-less/19175.md?page=2)
