OpenFL ActionScript 3 function overriding

Hello.
I’m porting flash game to html5 and faced an issue:

import openfl.display.Sprite;
public class GUIComponent extends Sprite 
{
		override public function set width (value:Number):void
		{
			resizeTo(value, currentHeight);
		}
}

I get “A conflict exists with inherited definition width in class openfl.display.DisplayObject.(1554)” error while in flash it worked perfectly. Any way to solve this issue?

Properties are little different in Haxe (add _ between set and property name, and also return same type as parameter).
Here is the property : https://github.com/openfl/openfl/blob/develop/src/openfl/display/DisplayObject.hx#L866
Here is the function signature: https://github.com/openfl/openfl/blob/develop/src/openfl/display/DisplayObject.hx#L2298
So you need to do that:
override private function set_width(value:Float):Float

Thanks for your answer but I’m writing in ActionScript3 not Haxe. Tried to change code to

	override private function set_width(value:Number):void

I’ve got the same error “A conflict exists with inherited definition set_width in class openfl.display.DisplayObject.(1554)”

I see. I’m afraid I can’t answer this. Try in the discord channel if you don’t have any answer here.

@uzurik Maybe you should tell us a little more. Your question indicates that you’re having an old AS3 project you’re ‘converting’ to HTML5 with the help of the OpenFL framework. In that case you are actually coding in Haxe - not ActionScript. Loudo already gave you the correct answer.
What happens if you try this:

package;

import openfl.display.Sprite;

class GUIComponent extends Sprite
{

	public function new()
	{
		super();
	}

	override private function set_width(value:Float):Float
	{
		return width;
	}
}

Here is the output:

/home/uzurik/Projects/kor/src/gui/core/GUIComponent.as(21): col: 19 Warning: return value for function 'new' has no type declaration.

                public function new()
                                ^

/home/uzurik/Projects/kor/src/gui/core/GUIComponent.as(23): col: 4 Error: A super statement can be used only inside class instance constructors.

                        super();
                        ^

/home/uzurik/Projects/kor/src/gui/core/GUIComponent.as(57): col: 3 Error: A conflict exists with inherited definition set_width in class openfl.display.DisplayObject.

                override private function set_width(value:Float):Float
                ^

/home/uzurik/Projects/kor/src/gui/core/GUIComponent.as(57): col: 29 Error: Method marked override must override another method.

                override private function set_width(value:Float):Float
                                          ^

/home/uzurik/Projects/kor/src/gui/core/GUIComponent.as(57): col: 45 Error: Type was not found or was not a compile-time constant: Float.

                override private function set_width(value:Float):Float
                                                          ^

/home/uzurik/Projects/kor/src/gui/core/GUIComponent.as(57): col: 52 Error: Type was not found or was not a compile-time constant: Float.

                override private function set_width(value:Float):Float
                                                                 ^

Well @obscure you can target html5 with as3 with OpenFl (through Apache Royale). ActionScript 3.0 Support
Anyway, I don’t know how this works, never tried, there may be little quirks, maybe the Apache Royale community can answer. I don’t know where OpenFl is involved, maybe it adds Tilemap and few other features.

Well this is actually how I’m trying to run my project, target html5 with as3 through apache royale) I used configs from https://github.com/openfl/openfl-samples-as3 as an example how to do it. My project is 1200+ files and I managed to convert most of them to compile successfully but I got few files wich I can’t get why it’s not working.

@loudo Aaah, I see! I completely forgot about this possibility. Well @uzurik my honest apologies and forget what I said as it’s not applicable in this case.