Denk jij nog een leuk of nuttig flash script te hebben, post het dan in de scriptbase !

vinTagesworld/flash scripts/images/Images inladen in flash actionscript3 met preloader.


Images inladen in flash actionscript3 met preloader.

Toegevoegd door: vinTage op 28-09-2008




Beschrijving

Externe images of swf bestanden via actionscript3 inladen in flash en ondertussen een preloader tonen.


Code

actionscript code

var lader:Loader = new Loader();
lader.load(new URLRequest("http://www.vintagesworld.be/afbeeldingen/partners/devarea.gif"));
addChild(lader);

lader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, preload);
lader.contentLoaderInfo.addEventListener(Event.COMPLETE, klaar);

function preload(event:ProgressEvent):void
{
  var geladen:Number = event.bytesLoaded/event.bytesTotal;
  trace(Math.round(geladen * 100)+"% geladen");
}

function klaar(event:Event):void
{
  //laadbalk weghalen
  trace("klaar met laden");
}       
 



Gebruik

actionscript code

/* 
....HANDIG OM TE WETEN....

-A single SWF file cannot combine ActionScript 1.0 or 2.0 code with ActionScript 3.0
code.

-ActionScript 3.0 code can load a SWF file written in ActionScript 1.0 or 2.0, but it
cannot access the SWF file’s variables and functions.

-SWF files written in ActionScript 1.0 or 2.0 cannot load SWF files written in
ActionScript 3.0. This means that SWF files authored in Flash 8 or Flex Builder 1.5 or
earlier versions cannot load ActionScript 3.0 SWF files.
The only exception to this rule is that an ActionScript 2.0 SWF file can replace itself with
an ActionScript 3.0 SWF file, as long as the ActionScript 2.0 SWF file hasn't previously
loaded anything into any of its levels. An ActionScript 2.0 SWF file can do this through a
call to loadMovieNum(), passing a value of 0 to the level parameter.

-In general, SWF files written in ActionScript 1.0 or 2.0 must be migrated if they are to
work together with SWF files written in ActionScript 3.0. For example, say you created a
media player using ActionScript 2.0. The media player loads various content that was also
created using ActionScript 2.0. You cannot create new content in ActionScript 3.0 and
load it in the media player. You must migrate the video player to ActionScript 3.0.
If, however, you create a media player in ActionScript 3.0, that media player can perform
simple loads of your ActionScript 2.0 content.
*/
       
 



Share |

Je moet aangemeld zijn om commentaar te kunnen lezen of geven.