all groups > flash actionscript > october 2006 >
You're in the

flash actionscript

group:

creating dynamic buttons


creating dynamic buttons xaosai
10/11/2006 11:56:13 PM
flash actionscript:
I am attempting to create a dynamic mailto button and have run into some
problems.

First, I realized that a dynamic text field inside of a button renders a
"hole" in the button where ever there is dynamic text.

I then found a method by reading forums that supposedly should work. I have
taken the following steps:

setup:
1 - Created a button symbol in the library that defines the clickable space
2 - Created a movie symbol in the library that will house the dynamic content
3 - Created a dynamic text field inside the movie symbol
4 - Created 3 frames inside the movie for each state of the button and labeled
accordingly (out, over, click)
5 - Modified the dynamic text box color for each frame accordingly

event handling:
6 - named the instance of the movie "email" in order to reference through
action script
7 - Added the following AS to an instance of the clickable button area:

on (rollOut) {
email.gotoAndStop("out");
}
on (rollOver) {
email.gotoAndStop("over");
}
on (press) {
email.gotoAndStop("click");
}
on (releaseOutside) {
email.gotoAndStop("out");
}
on (release) {
email.gotoAndStop("over");
//place mailto here
}

I get the following error from the output:

**Error** Scene=treatment, layer=hit, frame=1:Line 1: Mouse events are
permitted only for button instances
on (rollOut) {

**Error** Scene=treatment, layer=hit, frame=1:Line 5: Mouse events are
permitted only for button instances
on (rollOver) {

**Error** Scene=treatment, layer=hit, frame=1:Line 10: Mouse events are
permitted only for button instances
on (press) {

**Error** Scene=treatment, layer=hit, frame=1:Line 13: Mouse events are
permitted only for button instances
on (releaseOutside) {

**Error** Scene=treatment, layer=hit, frame=1:Line 16: Mouse events are
permitted only for button instances
on (release) {

Why would this be the case?? I created the instance by dragging the button
from the library onto the stage. Is that not the proper way to create an
instance?
Re: creating dynamic buttons LSNsaltlamp
10/12/2006 12:39:29 AM
The reason I asked is because the errors are referenced in "Scene=treatment,
layer=hit, frame=1" Double check that there is no actionscript in frame one of
your hit layer. If there's not send me your .fla file and I'll take a quick
look at it. It's always hard to describe actions when they cross over symbols
and frames.
AddThis Social Bookmark Button