Actuate.transform color doesn't work on neko

This throws an error on neko (seems to work fine on other targets).

button.addEventListener(MouseEvent.ROLL_OVER, onOver);
private function onOver(e:MouseEvent):Void 
{
	var sprite:Sprite = cast e.currentTarget;
	Actuate.transform (sprite, 1).color (color, amount);
}
Invalid operation (>>)
Called from motion.actuators.TransformActuator::initializeColor line 96
Called from motion.actuators.TransformActuator::initialize line 52
Called from motion.actuators.SimpleActuator::update line 403
Called from motion.actuators.TransformActuator::update line 176
Called from motion.actuators.SimpleActuator::stage_onEnterFrame line 559
Called from openfl._v2.events.EventDispatcher::dispatchEvent line 98
Called from openfl._v2.display.DisplayObject::__dispatchEvent line 182
Called from openfl._v2.display.DisplayObject::__broadcast line 161
Called from openfl._v2.display.DisplayObjectContainer::__broadcast line 280
Called from openfl._v2.display.Stage::__render line 1046
Called from openfl._v2.display.Stage::__checkRender line 325
Called from openfl._v2.display.Stage::__pollTimers line 1031
Called from openfl._v2.display.Stage::__doProcessStageEvent line 400

Seems there is a simple-type variable ( int ) which is not initialized and Neko’s default value is Null. That’s why invalid operation. So you can go to the problem line, find where this variables must be initialized and add for them default values (In some class constructor, I think).

There are no null values on line 96 in TransformAcutator class :confused: Both offset and color have values.

endColorTransform.redOffset = offset * ((color >> 16) & 0xFF);

Edit: casting color to int fixes this. I think it’s weird since color is intialized like this: var color:Int = properties.colorValue; Why is the cast needed? :smile:

endColorTransform.redOffset = offset * ((Std.int(color) >> 16) & 0xFF);
endColorTransform.greenOffset = offset * ((Std.int(color) >> 8) & 0xFF);
endColorTransform.blueOffset = offset * (Std.int(color) & 0xFF);

Problem may be with your properties object from which color was readed. In properties object color value can be null or float, that’s why Std.int() helps here. Also you can convert color to int directly when it is reading from properties object: var color:Int = Std.int(properties.colorValue).

1 Like

Does this seem like something to be done on the Actuate side, or is this on the other side, before the color value is set?

This is how I was using transform function:

private static var color:UInt = 0xFFFFFF; Actuate.transform (sprite, 1).color (color, amount);
So the problem was caused by using UInt instead of int or float :slight_smile: I wonder why. How comes this doesn’t throw an error?

var a:UInt = 0x666666;
trace(a, a >> 16);

Also using Std.is(myUInt, UInt); on neko always returns false.

I just found that changing “color” to an Int instead of a Float (as it should be anyway) in Actuate fixes this, but I’m reporting an issue to the Haxe repository about UInt to Float conversion, we’ll see what happens :slight_smile:

1 Like