v78f: Flash (async image loading)

Monkey Forums/Monkey Bug Reports/v78f: Flash (async image loading)

dragon(Posted 2014) [#1]
I think that AsyncImageLoader is broken in flash...
It seems that my game try to load local file instead integrated file

???

i use this to load:
LoadImageAsync("image/help" + help_page + ".jpg", 1, Image.MidHandle, Prog.prog)


SecurityError: Error #2148: SWF-Datei file:///C|/Projekte/xxx/source/prog.buildv78f/flash/MonkeyGame.swf kann nicht auf lokale Ressource file:///C|/Projekte/xxx/source/prog.buildv78f/flash/data/image/help1.jpg zugreifen. Nur SWF-Dateien in der Sandbox 'local-with-filesystem' sowie vertrauenswürdige lokale Dateien dürfen auf lokale Ressourcen zugreifen.
	at flash.display::LoaderInfo/get content()
	at MethodInfo-251()


translated:

MonkeyGame.swf can not access local resource file xyz...
Only SWF-files in sandbox 'local-with-filesystem' and trusted local files can access local resources.


marksibly(Posted 2014) [#2]
This below works here, using the alien1.png image from bouncyaliens.

Tested by building/running in standard Monkey IDE with latest Chrome - how are you testing your app? Anyone else have any ideas?




dragon(Posted 2014) [#3]
Mark your example do not work for me:

Win 8.1


FLEX FLASH PLAYER:
create same warning from 1st post / Image is not loaded
my config.winnt.txt variable:
FLASH_PLAYER="C:\Prog\Prog\Flex\runtimes\player\11.1\win\FlashPlayerDebugger.exe"

BROWSER FLASH PLAYER (Firefox and Chrome)
do not display warning and do not load image

FLASH PLAYER over MEDIA PLAYER CLASSIC
ok: no warning and load image



modified code:

Import mojo

Class MyApp Extends App Implements IOnLoadImageComplete

	Global var:String
	Global img:Image

	Method OnLoadImageComplete:Void( image:Image,path:String,source:IAsyncEventSource )

		If image Then var = "YES!";img=image Else var = "NO!"

	End
	
	Method OnCreate()
	
		LoadImageAsync( "alien1.png",,,Self )

	End
	
	Method OnUpdate()
	
		UpdateAsyncEvents
	
 	End
 	
	Method OnRender()

		DrawText var,0,0
		If img <> Null Then DrawImage(img, 0,50)

	End
	
End

Function Main()

	New MyApp
	
End


it should display "YES" and loaded image


marksibly(Posted 2014) [#4]
Well, I can kludge the flash async loader so it uses plain sync loading for 'data://' files, but this negates the point of async loading in the first place, ie: to be able to load large images in the background.

And your setup seems to be incapable of loading images from it's *own* domain - normally, it's only cross-domain loads that are problematic - so before kludging this up, I'd like to confirm it's not just something to do with your config, and that I'm not messing things up for other people who are successfully using LoadImageAsync in flash.

So is anyone else besides me actually using LoadImageAsync successfully in flash?


dragon(Posted 2014) [#5]
ok...
i only tested on local drive
this info should everybody find in docs.