[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Swftools-common] help with a counting loader
From: |
Chris Pugh |
Subject: |
Re: [Swftools-common] help with a counting loader |
Date: |
Thu, 26 Feb 2009 09:32:23 +0000 |
>2009/2/25 Pablo Rodríguez <address@hidden>:
> Hi there,
>
> modifying a script sent to the list by Chris Pugh sent (thanks for that,
> Chris), I have been able to get a loader that loads for an external
> presentation.
>
> http://www.archive.org/download/Lessig-Free_Culture/lessig-freeculture-loader.swf
> is the loader and here is the source:
>
> .flash filename="lessig-freeculture-loader.swf" bbox=800x600 version=8
> fps=12
> .font roman "/usr/share/fonts/TTF/FreeSansBold.ttf" glyphs="
> %()MB0123456789/:,."
> .edittext newloader font=roman color=#ffff00 size=30% width=300 height=30
> border=none align="right" noselect variable=load_text
> .box placeholder height=800 width=600
>
> .swf first_slide "orphanworks-first.swf"
>
> .frame 1
> .put first_slide
> .stop first_slide
> .put newloader
> .stop newloader
>
> .action:
> slide_height=Stage.height;
> slide_width=Stage.width;
> counter_percent=(slide_width/800)*100;
> newloader._x = slide_width-(loader._width*(counter_percent/100)*1.5);
> newloader._y = slide_height-(loader._height*2.5);
> newloader._xscale=counter_percent;
> newloader._yscale=counter_percent;
> .end
>
> .sprite images
> .put placeholder alpha=0%
> .action:
> first_loading = new Object();
> first_loading.onMouseDown = function () {
> if (gettimer()-firstclick<300) {
> load_swf = new MovieClipLoader();
> load_swf.loadClip("lessig-freeculture.swf", placeholder);
> } else {
> firstclick = gettimer();
> }
> };
> Mouse.addListener(first_loading);
> .end
> .end
>
> .action:
> this.attachMovie("images","i",1);
> .end
>
> .end
>
> I would like to get a functioning loading counter for the external SWF that
> might look like the code bellow. I don't know how to add it to the code
> above, since adding a new frame breaks the loading of the external file.
>
> .action:
> load_text = (String (Math.round ((_root.loader.getBytesLoaded() /
> (1024*1024)) * 100) / 100) + " MB / " + String (Math.round
> ((_root.loader.getBytesTotal() / (1024*1024)) * 100) / 100) + " MB " + " ("
> + String (Math.round ((_root.load_swf.getBytesLoaded() * 100) /
> _root.load_swf.getBytesTotal())) + "%)" );
>
> if (_root.getBytesLoaded() < _root.getBytesTotal()) {
> gotoAndPlay(1);
> }
> .end
>
> Any ideas?
>
> Thanks for your help,
>
>
> Pablo
Try loading it as a separate movie ( sprite ), then use the 'Interval'
event timer to check the
load progress of the other movie. It may well be worth doing the
calculation and the conversion
to a text string for display separately too, since..
load_text = (String (Math.round ...
looks a tad ( albeit aesthetically ) complicated!
HTH.
Regards,
Chris.