On Sun, Apr 26, 2015 at 10:58 PM, WelshAndy <a...@eazyweb.net> wrote:
> Thanks Om. Yes, that was the source of the code I mentioned. Problem comes > when I try and call it using AS3. In MXML, it works as expected by adding a > ToggleSwitch component and then adding a skinclass = skins.togYesNo. > But when I add it using AS3 (which I need to do, because the rest of the > page is built dynamically at runtime) I just get a non-working toggle. I > load it with: > <pre> > var myTog:skins.togYesNo = new togYesNo(); > group.addElement(myTog); > </pre> > I don't think this will work the way you want it to. > > ... which shows the toggle in the correct place, but not working. ie in the > on position but not highlighted, and interactive at all. I also tried > adding > the style directly to it, with: > <pre> > myTog.setStyle('skinClass',skins.togYesNo); > </pre> > I must be missing something, as Im sure that Im not the first person to > want > to add a ToggleSwitch using AS3!! It seems like such a simple thing (adding > a Yes No toggle in code) but I cant find much about it on the web, and a > deadline looms... Happy to post all code here if it helps. > Thanks very much for any insight. > > Does setting the skinclass in your CSS file like this work for you? myTog { skinClass: ClassReference("skins.togYesNo"); } If that does not work, please post some more code so we can help debug. Thanks, Om > > > > -- > View this message in context: > http://apache-flex-development.2333347.n4.nabble.com/Custom-ToggleSwitch-in-code-tp46201p46203.html > Sent from the Apache Flex Development mailing list archive at Nabble.com. >