arrays - HaxeFlixel: FlxSprite animation fails at runtime with Neko target -


i have date , i'm using haxeflixel experiment assets import , automation. i'm trying accomplish frames sprite sheet , automate add.animation process. example, need first row of sheet form run animation, second 1 animation etc...

i use code

class examplesprite extends flxsprite {      public function new(x:float=0, y:float=0, ?simplegraphic:dynamic)      {         super(x, y, simplegraphic);         loadgraphic(assetpaths.examplesprite__png, true, 16, 16);          // work         //animation.add("run", [0, 1, 2, 3, 4, 5], 10, true);          // has problem when run neko         var animationarray:array<int> = new array();         var i:int = 0;         var frames_per_row:int = cast(pixels.width / 16, int);         while (i < frames_per_row) {             animationarray.push(0*frames_per_row + i);             i++;         }         animation.add("run", animationarray, 10, true);          animation.play("run");     }  } 

i want calculate how many frames there in row and, in single cicle, put right frame numbers own animation array. when add animation flxsprite i'm passing array containing numbers, instead of hard coding everything.

this works expected in html5, flash, windows. builds in neko fails @ runtime.

this @ runtime while debugging in neko

invalid array access called array::__get line 291 called flixel.animation.flxbaseanimation::set_curindex line 34 called flixel.animation.flxanimation::set_curframe line 186 called flixel.animation.flxanimation::play line 112 called flixel.animation.flxanimationcontroller::play line 493 called player::new line 147 called player::$init line 16 called playstate::create line 44 ... 

when populate array, curiously, works animationarray.push(i); , fails animationarray.push(0*frames_per_row + i); need second writing because have populate multiple arrays @ once

animationarray0.push(0*frames_per_row + i); animationarray1.push(1*frames_per_row + i); animationarray2.push(2*frames_per_row + i); ... 

am missing something?

neko sensible var initialization, should inspect value of frames_per_row.

what pixels? pixels.width defined? try use math.floor() instead of cast(pixels.width / 16, int).


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -