Flex custom toggleswitch not working in actionscript
Posted
by
Gavin Jones
on Stack Overflow
See other posts from Stack Overflow
or by Gavin Jones
Published on 2012-10-05T09:32:48Z
Indexed on
2012/10/05
9:37 UTC
Read the original article
Hit count: 199
I have a custom Flex Toggleswitch component that changes the text values of the switch.
package skins
{
import spark.skins.mobile.ToggleSwitchSkin;
public class MyToggleSwitchSkin extends ToggleSwitchSkin
{
public function MyToggleSwitchSkin()
{
super();
selectedLabel="Serviceable";
unselectedLabel="Fault";
}
}
}
If I add the control using the MXML tag, it works fine. However, when I add the component using action script, it does not.
import skins.MyToggleSwitchSkin;
public function addToggle():void {
var myCustomToggle:MyToggleSwitchSkin = new MyToggleSwitchSkin();
hgroup.addElement(myCustomToggle);
}
The control dsiplays but will not activate.
Any ideas what I have missed?
© Stack Overflow or respective owner