swftools-common
[Top][All Lists]
Advanced

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

[Swftools-common] a question on Mouse.addListener


From: Pablo Rodríguez
Subject: [Swftools-common] a question on Mouse.addListener
Date: Sat, 14 Nov 2009 21:04:09 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Hi there,

I have written a loader (that I have been mailing about recently
[http://www.ousia.tk/fculture.php] ;-)) that does exactly what I want,
except for a minor undesired feature :-(.

My idea is to lead the user to fullscreen the presentation and then to
load it. So, if the button is pressed, everything works fine. But it can
happen that one double-clicks outside the button and

The code for the loader can be found at http://www.ousia.tk/loader.txt
(and pasted below).

Chris, I know is a real mess, but all I need is how do I need to rewrite
the first Mouse.addListener in order to be able to delete the second one
(that right now is that enables the presentation downloading). Believe
me, everything else works fine.

Thanks for your help,


Pablo




.flash filename="loader.swf" version=7 fps=12
.font roman "/usr/share/fonts/truetype/FreeSansBold.ttf" glyphs="
%()KB0123456789/:,.PDuk[]resntiocanbld!"
.edittext newloader font=roman color=#ffff00 size=30% width=300
height=30 border=none align="center" noselect variable=load_text
.box placeholder width=720 height=540
.outline fscreen_outline: M 62.78125 18.703125 L 43.367188 23.734375 L
38.390625 43.09375 L 42.109375 39.375 L 48.671875 45.9375 L 65.625
29.039062 L 59.0625 22.421875 L 62.78125 18.703125 z M 199.71875
18.703125 L 203.4375 22.421875 L 196.875 29.039062 L 213.773438 45.9375
L 220.390625 39.375 L 224.109375 43.09375 L 219.132812 23.734375 L
199.71875 18.703125 z M 83.125 45.9375 C 73.429688 45.9375 65.625
53.742188 65.625 63.4375 L 65.625 133.4375 C 65.625 143.132812 73.429688
150.9375 83.125 150.9375 L 179.375 150.9375 C 189.070312 150.9375
196.875 143.132812 196.875 133.4375 L 196.875 63.4375 C 196.875
53.742188 189.070312 45.9375 179.375 45.9375 L 83.125 45.9375 z M
48.726562 150.9375 L 42.109375 157.5 L 38.390625 153.78125 L 43.367188
173.140625 L 62.78125 178.171875 L 59.0625 174.453125 L 65.625
167.835938 L 48.726562 150.9375 z M 213.773438 150.9375 L 196.875
167.835938 L 203.4375 174.453125 L 199.71875 178.171875 L 219.132812
173.140625 L 224.109375 153.78125 L 220.390625 157.5 L 213.773438
150.9375 z .end
.outline fulls_outline: M 17.5 0 L 245 0 C 254.695312 0 262.5 7.804688
262.5 17.5 L 262.5 179.375 C 262.5 189.070312 254.695312 196.875 245
196.875 L 17.5 196.875 C 7.804688 196.875 0 189.070312 0 179.375 L 0
17.5 C 0 7.804688 7.804688 0 17.5 0 z .end
.filled fscreen outline=fscreen_outline fill=#969696ff color=#969696ff
.filled fulls outline=fulls_outline fill=#64646496 color=#64646496

.button fscr_button
    .show fscreen as=idle
    .show fscreen as=area
    .show fscreen as=hover
    .show fscreen as=pressed
.end

.button fs_button
    .show fulls as=idle
    .show fulls as=area
    .show fulls as=hover
    .show fulls as=pressed
    .on_release:
        fscr_button._visible = 0;
        fs_button._visible = 0;
        Stage["displayState"] = "fullScreen";
        _root.load_text = "[Double click to start]";
        _root.dlprogress_mvclip._visible = true;
        Mouse.addListener(images.first_loading);
    .end
.end

.sprite fullscreen_button
    .put fscr_button
    .put fs_button
.end

.swf first_slide "orphanworks-first.swf"

.frame 1
    .put first_slide
    .stop first_slide
    .put newloader
    .stop newloader
    .put fullscreen_button
    .stop fullscreen_button

    .action:
        slide_height=Stage.height;
        slide_width=Stage.width;

        counter_percent=(slide_width/800)*100;
        newloader._xscale=counter_percent;
        newloader._yscale=counter_percent;
        newloader._x = (slide_width-(newloader._width))/2;
        newloader._y = (slide_height-newloader._height)/2;

        fullscreen_button._x = (slide_width-(fullscreen_button._width))/2;
        fullscreen_button._y = (slide_height-fullscreen_button._height)/2;

        _root.createEmptyMovieClip("dlprogress_mvclip", 0);
        dlprogress_mvclip.createEmptyMovieClip("bar", 1);
        dlprogress_mvclip.createEmptyMovieClip("stroke", 2);

        with (dlprogress_mvclip.stroke) {
           lineStyle(0, 0xFF0000, 30);
           moveTo(0, 0);
           lineTo(300, 0);
           lineTo(300, 40);
           lineTo(0, 40);
           lineTo(0, 0);
        }
        with (dlprogress_mvclip.bar) {
           beginFill(0xFF0000, 30);
           moveTo(0, 0);
           lineTo(300, 0);
           lineTo(300, 40);
           lineTo(0, 40);
           lineTo(0, 0);
           endFill();
           _xscale = 0;
        }
        dlprogress_mvclip._x = (slide_width-dlprogress_mvclip._width)/2;
        dlprogress_mvclip._y = (slide_height-dlprogress_mvclip._height)/2;

        dlprogress_mvclip._visible = false;
    .end

    .sprite images
        .put placeholder alpha=0%
        .action:
            the_presentation = "lessig-freeculture.swf";
            first_loading = new Object();
            first_loading.onMouseDown = function () {
                if (gettimer() - firstclick < 400) {
                    load_swf = new MovieClipLoader();
                    load_swf.loadClip(the_presentation, placeholder);
                    listen_loading = new Object();
        listen_loading.onLoadStart = function(target) {
            _root.dlprogress_mvclip.bar._xscale = 0;
            _starttime = gettimer();
        };
        listen_loading.onLoadProgress = function(target, bytesLoaded,
bytesTotal) {
           downldtime = (gettimer() - _starttime) / 1000;
           _root.load_text = (String (Math.round ((bytesLoaded * 100) /
bytesTotal)) + "% (" + Math.round((bytesLoaded / 1024) / downldtime) + "
KB/s)");
           _root.dlprogress_mvclip.bar._xscale =
Math.round(bytesLoaded/bytesTotal*100);
           keeping_awake = setInterval(function(){}, 1000);
        };
        listen_loading.onLoadComplete = function(target) {
           clearInterval(keeping_awake);
           _root.load_text = "";
           _root.dlprogress_mvclip._visible = 0;
           _root.dlprogress_mvclip.bar._visible = 0;
           _root.first_slide._visible = 0;
        };
                    load_swf.addListener(listen_loading);
                } else {
                    firstclick = gettimer();
                }
            };
            Mouse.addListener(first_loading);
        .end
    .end

    .action:
        this.attachMovie("images","presentation_sprite",1);
    .end

.end




reply via email to

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