update sample to use haxe js api