00:00
00:00
Newgrounds Background Image Theme

MatthieuxDancingDead just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Browse Sections

Newgrounds Wiki: getPercentLoaded

Usage

import com.newgrounds.API;
var percent_loaded:Number = API.getPercentLoaded();
This method is used to determine how much of your movie (including assets loaded from the API Gateway) has been loaded.

This method will return a number between 0 and 100.

Examples

The following examples demonstrate how you might use this command in a custom preloader loop.

Actionscript 3.0

import flash.events.Event;
import com.newgrounds.API;

function preloaderLoop(e:Event):void { var percent_loaded:Number = API.getPercentLoaded(); if (percent_loaded == 100) { play(); } }

addEventListener(Event.ENTER_FRAME, preloaderLoop);

Actionscript 2.0

import com.newgrounds.API;

onEnterFrame = function() { var percent_loaded:Number = API.getPercentLoaded(); if (percent_loaded == 100) { play(); } }