# Frame script effect makes buttons not work

**URL:** <https://forum.kirupa.com/t/frame-script-effect-makes-buttons-not-work/184863>\
**Category:** Uncategorized\
**Created:** [April 8, 2006, 4:37pm UTC](https://forum.kirupa.com/t/frame-script-effect-makes-buttons-not-work/184863 "2006-04-08T16:37:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mini\_me1](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mini\_me1](https://forum.kirupa.com/u/mini_me1)\
**Post date:** [April 8, 2006, 4:37pm UTC](https://forum.kirupa.com/t/frame-script-effect-makes-buttons-not-work/184863/1 "2006-04-08T16:37:44Z")

</div>

Hi Im currently redoing my web site using flash. I came across this awesome script for animating text buttons that generate random leters as the user rolls over them.  
To get the example check out [http://www.theronin.co.uk/index\_flash.html](http://www.theronin.co.uk/index_flash.html)  
So at the moment Ive got the rollover effect happening but I cant actually make the buttons go any where.  
Here is the frame script (written by Danny Franzreb from Toabot)

ref\_mc = this.dynBtn\_mc;

ref\_mc.\_alpha = 75;

ref\_mc.textButton\_txt.autoSize = true;

ref\_mc.text\_str = ref\_mc.textButton\_txt.text;

ref\_mc.inv\_btn.\_width = ref\_mc.textButton\_txt.\_width;

ref\_mc.aniFrames = 6;

ref\_mc.count = 0;

ref\_mc.inv\_btn.onRollOver = function(){  
this.\_parent.onEnterFrame = btnRollOver;  
}

ref\_mc.inv\_btn.onRollOut = function(){  
this.\_parent.onEnterFrame = btnRollOut;  
}  
function btnRollOver(){

```
if(this.count &lt; this.aniFrames){
    this._alpha = Math.ceil(Math.random() * 50) + 50;
    var temp_str = "";
    for(var i = 0; i &lt; this.text_str.length; i++){
        temp_str += String.fromCharCode(65 + Math.round(Math.random()*25));
    }
this.textButton_txt.text = temp_str;
    this.count++;
}else{
    this._alpha = 100;
    this.textButton_txt.text = this.text_str.toUpperCase();
    this.onEnterFrame = undefined;
}

```

}  
function btnRollOut(){  
if(this.count \> 0){  
this.\_alpha = Math.ceil(Math.random() \* 50) + 50;  
var temp\_str = “”;  
for(var i = 0; i \< this.text\_str.length; i++){  
temp\_str += String.fromCharCode(97 + Math.round(Math.random()\*25));  
}  
this.textButton\_txt.text = temp\_str;  
this.count–;  
}else{  
this.\_alpha = 75;  
this.textButton\_txt.text = this.text\_str.toLowerCase();  
this.onEnterFrame = undefined;  
}  
}

then Im trying to add the regular button action on to the buttons  
on(release) {  
gotoAndPlay(20);  
}

I know this isnt really the way to go but not sure if this is the way to go I know that its possible because the effect is used on theronin site for the navigation buttons

---

<div class="post-metadata">

**Author:** ![rhamej](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rhamej](https://forum.kirupa.com/u/rhamej)\
**Post date:** [April 8, 2006, 5:54pm UTC](https://forum.kirupa.com/t/frame-script-effect-makes-buttons-not-work/184863/2 "2006-04-08T17:54:28Z")

</div>

Instead of putting it on the buttons, which isn’t really recommended, put the action in a frame,

```auto

ref_mc.inv_btn.onRelease = function(){
gotoAndPlay(20)
}

```

Im just guessing here, post a fla if you want it fixed faster. Kinda hard to fix when we cant see how you have it set up. =)

---

<div class="post-metadata">

**Author:** ![mini\_me1](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mini\_me1](https://forum.kirupa.com/u/mini_me1)\
**Post date:** [April 9, 2006, 12:26am UTC](https://forum.kirupa.com/t/frame-script-effect-makes-buttons-not-work/184863/3 "2006-04-09T00:26:53Z")

</div>

> [@rhamej](#):
>
> Instead of putting it on the buttons, which isn’t really recommended, put the action in a frame,
> 
> ```auto
> 
> ref_mc.inv_btn.onRelease = function(){
> gotoAndPlay(20)
> }
> 
> ```
> 
> Im just guessing here, post a fla if you want it fixed faster. Kinda hard to fix when we cant see how you have it set up. =)

Great, thanks rhamej I was thinking thats the way to go but my attempts at putting the action in the frame didnt work out. That script you have posted looks promising. If it doesn’t work I’ll put up a fla.  
:thumb2:

---

<div class="post-metadata">

**Author:** ![mini\_me1](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mini\_me1](https://forum.kirupa.com/u/mini_me1)\
**Post date:** [April 9, 2006, 12:44am UTC](https://forum.kirupa.com/t/frame-script-effect-makes-buttons-not-work/184863/4 "2006-04-09T00:44:03Z")

</div>

rhamej You Rock!  
Worked like a charm, Thanks heaps mate. :bu:

---

<div class="post-metadata">

**Author:** ![rhamej](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rhamej](https://forum.kirupa.com/u/rhamej)\
**Post date:** [April 9, 2006, 1:30am UTC](https://forum.kirupa.com/t/frame-script-effect-makes-buttons-not-work/184863/5 "2006-04-09T01:30:23Z")

</div>

:thumb:
