Hi all,
I got a movieclip named LoadingProgress (exported in first frame and class name LoadingProgress), inside it is a dynamic text box with instance name percentDisplay
This is the code for LoadingProgress.as
package
{
import flash.display.MovieClip;
import flash.text.TextField;
public class LoadingProgress extends Counter
{
public function LoadingProgress()
{
super();
}
override public function updateDisplay():void
{
super.updateDisplay();
percentDisplay.text = currentValue.toString();
}
}
}
code for counter.as
package
{
import flash.display.MovieClip;
public class Counter extends MovieClip
{
public var currentValue:Number;
public function Counter()
{
reset();
}
public function addToValue(amountToAdd:Number):void
{
currentValue = currentValue + amountToAdd;
updateDisplay();
}
public function reset():void
{
currentValue = 0;
updateDisplay();
}
public function updateDisplay():void
{
}
public function setValue(amount:Number):void
{
currentValue = amount;
updateDisplay();
}
}
}
and my main documentclass contains this code to display loader
public class DocumentClass extends MovieClip {
public var loadingProgress:LoadingProgress;
public function DocumentClass()
{
loadingProgress = new LoadingProgress;
loadingProgress.x = 200;
loadingProgress.y = 150;
loaderInfo.addEventListener(Event.COMPLETE, onCompletelyDownloaded);
loaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressMade);
}
public function onProgressMade(progressEvent:ProgressEvent)
{
//trace (loaderInfo.bytesLoaded," - ",loaderInfo.bytesTotal);
loadingProgress.setValue(Math.ceil(100 * loaderInfo.bytesLoaded / loaderInfo.bytesTotal));
}
public function onCompletelyDownloaded (event:Event):void
{
gotoAndStop(3);
showMenuScreen();
}
I removed other unrelated codes from document.as
When I trace it shows the % in output box, but the text is not displayed in screen.
Any help please.