swftools-common
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Swftools-common] help with a counting loader


From: Pablo Rodríguez
Subject: [Swftools-common] help with a counting loader
Date: Wed, 25 Feb 2009 22:15:14 +0100
User-agent: Thunderbird 2.0.0.19 (X11/20090114)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]