especially as pcent0 is a rounded out number so 99.6% would come out as 100%

On Mon, Feb 1, 2010 at 10:49 AM, allandt bik-elliott (thefieldcomic.com) <
[email protected]> wrote:

> don't know if it helps but instead of
>        if (pcent0==100) {
>
>                gotoAndStop("setup");
>        }
>
> i would add a listener for Event.COMPLETE
>
> a
>
> On Mon, Feb 1, 2010 at 10:46 AM, Paul Steven 
> <[email protected]>wrote:
>
>> I am getting the following error in my browser when I load my flash game
>> and
>> would like to know if anyone can identify the problem with my preloader
>> code?
>>
>> TypeError: Error #1009: Cannot access a property or method of a null
>> object
>> reference.
>>        at liverGame_fla::MainTimeline/PL_LOADING0()
>>
>> My preloader code (which I adapted from some code I found online is as
>> follows):
>>
>> import flash.display.*;
>>
>> var pcent0:Number;
>>
>> function PL_LOADING0(event:ProgressEvent):void {
>>
>>        pcent0=event.bytesLoaded/event.bytesTotal*100;
>>        pcent0=Math.round(pcent0);
>>
>>        lpc.loadingMC.percent.text=int(pcent0)+"%";
>>
>>        if (pcent0==100) {
>>
>>                gotoAndStop("setup");
>>        }
>> }
>>
>>
>> function checkLoaded0(e:Event) {
>>
>>        gotoAndStop("setup");
>>
>> }
>>
>> this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, PL_LOADING0);
>>
>> this.loaderInfo.addEventListener(Event.INIT, checkLoaded0);
>> this.loaderInfo.addEventListener(Event.COMPLETE, checkLoaded0);
>>
>>
>> Thanks
>>
>> Paul
>>
>> _______________________________________________
>> Flashcoders mailing list
>> [email protected]
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to