load image from URL

maharadjah

  • Posts: 26
hello,

please, i want to load : http://www.passageweather.com/maps/natlantic/clouds/003.png


with :

but, it don't work ! ? may be i do something wrong... :o

i know how to use "load image from file"
but what i want to do is to load the image from the URL, because it is change every 3h,
so the game will be "real time"

Please, can some one show me WHAT write in the "load image from URL" block  :)
thanks
sorry for my bad english, i am French ;-)

mdotedot

  • Posts: 1654
Hello Maharadjah,

Make an actor name ShowImage and put it on the scene. Then in the scene after 1 scecond put this:


When you are using Flash you can only access files that are on the same server as the flash object is. In this case www.passageweather.com

You will probably getting an exception handler message.

SecurityError: Error #2122: Security sandbox violation: LoaderInfo.content: file://
cannot access http://www.pass

There are ways for you to accept that location as a source but you have to alter your security settings on your computer. If you publish a game to the world you can't expect your users to do the same.

Running from a desktop application (publication to Windows/Mac) will allow the load of the image.
Also from Mobile it will not be a problem to load the image. But don't expect flash to work.
Flash can show images just fine if they are from the same server and you have even ways of getting things to work if you own the server you publish your flash game on. But standard Flash will give you problems.

Hope this will help a bit.

Best regards from
M.E.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

gstevenshome

  • Posts: 29
Hi - I'm having the security problem.  Trying to make a swf on one of my servers (http://www.funkydoo.co.uk) load an image from another of my servers (http://www.gamenet.com)  I have a crossdomain.xml file on http://www.gamenet.com, so I thought the swf on funkydoo.co.uk would be able to access an image?

ME - are you suggesting that this is impossible?  That flash won't allow a swf on external sites (which normally happens) to load an image from my site? Even if I have an open crossdomain.xml?

mdotedot

  • Posts: 1654
GStevensHome,

What is the exact message?
My guess is that the funky (also) needs a cross since that is trying to access something that is outside of its own sandbox.


Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

gstevenshome

  • Posts: 29
When testing on stencyl locally it says SecurityError 2122:

SecurityError: Error #2122: Security sandbox violation: LoaderInfo.content: file:///Users/paul/stencylworks/games-generated/Game/Export/flash/bin/Game.swf cannot access http://thumbs.gamenet.com/image.jpg. A policy file is required, but the checkPolicyFile flag was not set when this media was loaded.
   at flash.display::LoaderInfo/get content()
   at MethodInfo-2024()[/Users/paul/Desktop/Technology/Development/Stencyl-full/plaf/haxe/lib/stencyl/1,00/com/stencyl/behavior/Script.hx:2307]

When I publish the swf file and upload it on funkydoo.co.uk, it runs but doesn't load the image or give any errors (just a blank screen) so I guess it's the same error?  I published to android and it works fine, so i'm loading the image correctly - just want to try and get it working in flash if possible!.

Flash swfs often get hosted on lots of external sites and blogs though, so I obviously can't put crossdomain.xml on all of those sites..

Thanks in advance!

captaincomic

  • *
  • Posts: 6108
When testing locally, you can trust the SWF: http://www.stencyl.com/help/view/web-flash-security/

I don't think there's another way than using crossdomain.xml (except for having the SWF and image on the same server), but note that the crossdomain.xml is need on the server where you have the image, not on the ones that host the SWF.

maharadjah

  • Posts: 26
thanks for today !

i have some answers, but not 100% understand....

i work, think it and come back ....

(Flash can show images just fine if they are from the same server and you have even ways of getting things to work if you own the server you publish your flash game on. But standard Flash will give you problems.)  :-[ :'(
sorry for my bad english, i am French ;-)