I need to use the Button component from the UI Components Panel in the Flash IDE, with the toggle property set to true.
If I use it with a timeline script it works great.
If I use within a class(a Document Class), the selected property is reversed (I get true when it's not toggled and vice versa).
Also if I set toggle to false in the Property Inspector, then set toggle to true in the document class, it still traces out as false. If I invalidate, I toggle traces true, but the selected property always traces false.
Timeline code is as simple as this:
bold_b.addEventListener(MouseEvent.CLICK, onClick);
function onClick(event:MouseEvent):void {
trace(event.currentTarget.selected);
}
Document class is simple as well:
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class ButtonTester extends MovieClip
{
public function ButtonTester()
{
//in timeline works fine, in class it's the other way around
bold_b.addEventListener(MouseEvent.CLICK, onClick);
bold_b.toggle = true;
bold_b.invalidate('toggle',true);
bold_b.drawNow();
stage.invalidate();
trace('bold_b.toggle: ' + bold_b.toggle);
function onClick(event:MouseEvent):void {
trace(event.currentTarget.selected);
}
}
}
}
Currently I'm using Flash CS3. I've got Flash Player 10 installed. Don't know the components 'build' version, but they were written in 2007 under Flash Player 9.0.28.0
Does anyone know how to get around this ?