[Flash] Dictionary.each() issue


#1

I can’t seem to iterate through values of a Dictionary on Flash target, works fine on Windows target.

Map class doesn’t have this issue : I can iterate through keys and values with no problem on both targets so I’ll use that but thought I would post about the issue anyway :slight_smile:

Here is sample code to reproduce the issue :

var dic:Dictionary<String, String> = new Dictionary<String, String>();

for (i in 0...3)
{
	dic["key" + i] = "value" + i;
}

for (str in dic.iterator())
{
	trace(str);
}

for (str in dic.each())
{
	trace(str);
}

flash output :

Test.hx:117: key1
Test.hx:117: key0
Test.hx:117: key2
Test.hx:122: null
Test.hx:122: null
Test.hx:122: null

windows (c++) output :

Test.hx:117: key1
Test.hx:117: key2
Test.hx:117: key0
Test.hx:122: value1
Test.hx:122: value2
Test.hx:122: value0


#2

Thanks for the report!

This appears to fix it for me, using Haxe 4 (and probably older versions as well):


#3

Great ! Thanks for the fix !
I’d gladly test it but I’m still pretty ignorant of GIT outside of using GithubDesktop app or do a simple git clone cmd :smile: (some day I’ll dive into it, some day…)
I guess I’ll just wait for the next openfl update for now :blush: