# Help with AS driven button

**URL:** <https://forum.kirupa.com/t/help-with-as-driven-button/168654>\
**Category:** flash\
**Created:** [November 9, 2005, 1:35am UTC](https://forum.kirupa.com/t/help-with-as-driven-button/168654 "2005-11-09T01:35:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![enforcer73](https://avatars.discourse-cdn.com/v4/letter/e/ecd19e/32.png) [@enforcer73](https://forum.kirupa.com/u/enforcer73)\
**Post date:** [November 9, 2005, 1:35am UTC](https://forum.kirupa.com/t/help-with-as-driven-button/168654/1 "2005-11-09T01:35:12Z")

</div>

Hi all,

I just need a little help to finish of this bottom I am creating for an offline Flash interactive piece I am doing.

Thanks to you helpful jokers, I got some advice on how to animate this button without the use of Tweens, but with Actionscript instead. I am trying to develop my knowledge of AS, so am trying to create this interactive solely (well almost soley) with AS.  
So here’s how it is:

When you enter the interactive, all the buttons are as below:  
[[img=http://img331.imageshack.us/img331/9076/initialstate7dg.th.jpg]](http://img331.imageshack.us/my.php?image=initialstate7dg.jpg)  
Then when you rollover individual buttons they look like this:  
[[url=“http://img331.imageshack.us/my.php?image=rollover0cf.jpg”][img=http://img331.imageshack.us/img331/6258/rollover0cf.th.jpg]](http://attachment.php?attachmentid=&stc=1)  
I have got this working using the following AS:

```auto
on (rollOver) {
	var colorful = new Color("_root.graphics.text");
	colorful.setRGB(0xFFFFFF);
}
on (rollOut) {
	var colorful = new Color("_root.graphics.text");
	colorful.setRGB(0x034008);
}
on (rollOver) {
	_root.graphics.bg.onEnterFrame = function() {
		if (_root.graphics.bg._alpha<100) {
			_root.graphics.bg._alpha += 25;
		} else {
			_root.graphics.bg.onEnterFrame = null;
		}
	};
}
on (rollOut) {
	_root.graphics.bg.onEnterFrame = function() {
		if (_root.graphics.bg._alpha>0) {
			_root.graphics.bg._alpha -= 25;
		} else {
			_root.graphics.bg.onEnterFrame = null;
		}
	};
}

```

where ‘graphics’ is the Instance name of the button, and ‘text’ is the Instance name of the text within the button that changes colour.

\*\*What I would like to know, is when I click the button to load an external .swf, how do I keep the button in it’s ‘rollover’ state when you move your mouse off it?

\*\*As it is, after I click the button and my .swf loads, it returns to its initial state when I roll off it. I’m guessing there isn’t a lot to fix this problem, but I just seem to be having problems with AS.

If anyone could help, that would be sweet,

ta very much

Enforcer73
