all groups > flash (macromedia) > march 2006 >
You're in the

flash (macromedia)

group:

Setting Button Component Params


Setting Button Component Params Sir Cuitous
3/29/2006 10:02:54 PM
flash (macromedia):
Hello, forum users and many thanks to all contributors. I'm new to Flash, but
with experience elsewhere. I'm learning fast. I have tested this issue
independently from my main project and it is simple to recreate. I have two
instances of a button component. One does not have a label. As you can see from
my code (which may or may not be well formed), the label is set in the
ActionScript by calling a function:

function reset(){
test_btn.icon = "";
test_btn.label = "Test";
}

reset();

test_btn.onRelease = function() {
test_btn.label = "";
test_btn.icon = "plussign";
}

reset_btn.onRelease = function() {
reset();
}

When this file is previewed, the button does indeed get a label "Test".
Clicking the "Test" button removes the label from the button and adds a button
icon. The icon is simply a graphic symbol and so far this works well. The
problem is when I click the "Reset" button. The reset button calls the same
function that is called when the file loads, it removes the icon, but it does
not set the label parameter. It's the same function, can anyone figure out why
it does not perform the same way?
Re: Setting Button Component Params gravideo
3/30/2006 4:34:10 PM
In your reset function, change test_btn.icon = ""; to test_btn.icon = null;

Re: Setting Button Component Params Sir Cuitous
3/31/2006 12:57:31 AM
Hot damn, that works. I thought of that, but it is contrary to the Component
Language Reference help topic which states:

"The default value is an empty string (""), which indicates that there is no
icon."

Macromedia couldn't figure it out either. And oddly, the empty string does
appear to remove the icon. Thanks for taking the time to test it.


AddThis Social Bookmark Button