A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Percent-of-%-Script

  1. #1
    Junior Member
    Join Date
    Sep 2001
    Posts
    8
    I have a Preloader-Actionscript for Flash4 to get %-Output in a Textfield.

    Did anyone knows, how to change this Script, that my movie is runnin, when 75%(for example)of the filesize-loading is finished?

    I wanna put this code in, so that the User on the Website don´t have to wait soo long to view the movie!!!

    Frame1:
    getURL ("JavaScript:getPercent()");

    Frame2:
    ifFrameLoaded ("navi", _totalframes) {
    gotoAndPlay ("intro", 1);
    }

    Frame3:
    gotoAndPlay ("preloader");

    -------------------------------------------------------

    In my HTML-Page:
    var mName = "main";
    function mObject(mName){
    if (navigator.appName.indexOf ("Microsoft") !=-1){
    return window[mName];
    }
    else{
    return document[mName];
    }
    }
    function getPercent() {
    var loaded = mObject(mName).PercentLoaded();
    mObject(mName).SetVariable("percents", loaded);
    setTimeout("getPercent()",100);
    }

  2. #2
    Senior Member
    Join Date
    Oct 2000
    Posts
    961
    Use a smart buffer they work very well. We stream movies that are 20 MB in size and broadband users dont wait more than a few seconds before playback begins.

    I will give you the equation of how to do this with actions in Flash but I'm sorry that I am in a rush and can not help you with each action right now. Perhaps I can post the fla at a later time and you can download it

    the equation to create

    Buffer Time = (File Size) - (PlayTime * Download Rate)
    ---------------------------------------
    Download Rate

    If you know action script you can creat a nice buffer with this. To get the download rate you have to initiate get timer and do a if frame is loaded loop wherein you know the file size of that frame. You set a starttime variable and an endtime variable...are you getting my drift. this will help you determine download rate.

    check out the demo if you want to see it in action. I think its the top right video the long narrow one.
    http://www.mantaproductions.com/demo.html

    If you really need the fla I will try to post it for you tommorow.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center