PhotoDune

Preloader simulation

131 posts
  • United Kingdom
  • Sold between 1 000 and 5 000 dollars
  • Exclusive Author
  • Has been a member for 5-6 years
  • Bought between 10 and 49 items
djlaw says

Can anyone suggest the best way to simulate an animation based preloader short of putting a 2mb image on the second frame or creating the same effect as a time line based animation?

Any help would be most appreciated and repaid in kind…;)

djlaw

1277 posts
  • Bought between 50 and 99 items
  • Contributed a Tutorial to a Tuts+ Site
  • Exclusive Author
  • Has been a member for 5-6 years
  • Interviewed on the Envato Notes blog
  • Referred between 100 and 199 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+2 more
rondog says

make a timer(as3) or an interval(as2) that runs every 100ms and increment a variable that starts at 0 to represent your 1-100. 100ms will equal to 10 seconds for 1 through 100 I believe.

131 posts
  • United Kingdom
  • Sold between 1 000 and 5 000 dollars
  • Exclusive Author
  • Has been a member for 5-6 years
  • Bought between 10 and 49 items
djlaw says

Thanks for the lightning fast reply rondog,

any ideas how i would implement that in to this code?

onEnterFrame = function () { };

total = _root.getBytesTotal();
loaded = _root.getBytesLoaded();
percent = int(loaded/total*100);
preloader.textmc.txt.text = percent+"";
preloader.gotoAndStop(percent);
if (loaded == total) {
    //gotoAndStop("loaded");
    gotoAndStop(2);
    delete onEnterFrame;
}
1277 posts
  • Bought between 50 and 99 items
  • Contributed a Tutorial to a Tuts+ Site
  • Exclusive Author
  • Has been a member for 5-6 years
  • Interviewed on the Envato Notes blog
  • Referred between 100 and 199 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+2 more
rondog says
var count:Number = 0;
var inter = setInterval(showPercent, 50);

function showPercent()
{
    if (count != 100)
    {
        count++;
        trace(count);
        preloader.textmc.txt.text = percent + "";
    }
    else
    {
        trace("fully loaded");
        clearInterval(inter);
        gotoAndStop(2);
    }
}

50ms seems to be a pretty good number for a preview.

131 posts
  • United Kingdom
  • Sold between 1 000 and 5 000 dollars
  • Exclusive Author
  • Has been a member for 5-6 years
  • Bought between 10 and 49 items
djlaw says
var count:Number = 0;
var inter = setInterval(showPercent, 50);

function showPercent()
{<br />
    if (count != 100)
    {<br />
        count++;
        trace(count);
        preloader.textmc.txt.text = percent + "";
    }
    else
    {
        trace("fully loaded");
        clearInterval(inter);
        gotoAndStop(2);
    }
}
50ms seems to be a pretty good number for a preview.

Rondog your a legend!

Nice one :)

Had to make two changes but works mint…

“stop();” and “preloader.textmc.txt.text = count;”

Very much appreciated hope you like my preloader when it gets published ;)

1277 posts
  • Bought between 50 and 99 items
  • Contributed a Tutorial to a Tuts+ Site
  • Exclusive Author
  • Has been a member for 5-6 years
  • Interviewed on the Envato Notes blog
  • Referred between 100 and 199 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+2 more
rondog says

oh yea I forgot to take out the percent and replace it with count he he..glad I could help!

by
by
by
by
by