Load media, datas file, or variables

Load a picture

We'll use Loader class in order to load a file and we'll target this one with a URLRequest.

Let's load a picture in example :

package;
import flash.Lib;
import flash.display.Loader;
import flash.net.URLRequest;
      class Main
      {
      		static function main()
      		{
      			new Main();
      		}
      		public function new()
      		{      			
      			exemple1();
      		}
      		public function exemple1()
      		{
      			/*create a new loader*/
      			var loader = new Loader();

      			/*load the file*/
      			loader.load(new URLRequest('photo.jpg'));
      			/*Add the loader on the scene*/
      			Lib.current.addChild(loader);
      			trace("Loading a file...");
      		}
      }
(75 times)