actuate icon indicating copy to clipboard operation
actuate copied to clipboard

HTML5 issue with getter/setter

Open alamboley opened this issue 8 years ago • 2 comments

Hey, I noticed with the HTML5 target, I was not able to use @isVar. I've to create a variable and also the default getter prevents Tween to work. I've to create getter/setter this way:

var _alpha:Float = 1;
public var alpha(get, set):Float;

function get_alpha():Float {

    return _alpha;
}

function set_alpha(value:Float) {

    return _alpha = value;
}

alamboley avatar May 27 '16 08:05 alamboley

I'm having this issue as well with this.

	public var x(default, set):Float = 0;
	public var y(default, set):Float = 0;
	public var scaleX(default, set):Float = 1;
	public var scaleY(default, set):Float = 1;
	public var rotation(default, set):Float = 0;
	public function set_x(value:Float):Float { trace("Setting x to: "+value); transDirty = true; return x = value; }
	public function set_y(value:Float):Float { transDirty = true; return y = value; }
	public function set_scaleX(value:Float):Float { transDirty = true; return scaleX = value; }
	public function set_scaleY(value:Float):Float { transDirty = true; return scaleY = value; }
	public function set_rotation(value:Float):Float { transDirty = true; return rotation = value; }

I'm not seeing the tween getting the traces in set_x while targeting js, but am in flash, I have -dce no and putting @:keep before the vars, functions, or both doesn't seem to do anything. onComplete and onUpdate seem to fire in time as normal.

MintPaw avatar Mar 05 '17 14:03 MintPaw

Hi, i have same problem with -dce full, and fixed it like that: Actuate.tween(mySprite, 2.2, {x:1000}); mySprite.x; Now getter dont die and tween works fine 😊

DarthVan avatar Apr 20 '18 19:04 DarthVan