Skip navigation
gaurawerma
Currently Being Moderated

Frame Rate in AS2 ???

Nov 23, 2009 12:39 AM

Can anybody tell me how to calculate frame rate of an external movieclip in AS2 ?

 

Thanks

 
Replies
  • Currently Being Moderated
    Nov 23, 2009 12:52 AM   in reply to gaurawerma

    If you mean by calculate, to get the framerate, its simple: in as2 the loaded movieclip inherits the framerate of the loading parent (your own file).

    If you mean by calculate, to get the framerate, the original programmer intended to use, you will need a swf-decompiler.

    If you mean by calculate, to get the framerate the users browser/computer will be able to actually play your movie, ask again.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 23, 2009 2:33 AM   in reply to gaurawerma

    In as2 there is no way to set the framerate dynamically. So if you have Movieclips with different framerates you will have to go for a compromise.

    If you feel comfortably with as3, then check this out. If you go through all the trouble because you somehow fear the sound of your loaded movieclips get messed up...that would only be the case if you need a tight integration of animation and sound, like for a music video or something, even if you set the sound of soundLaver to stream, the sound will never be affected by your movies framerate. To give you a more specific advise you will have to make more clear what you are trying to achieve

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 23, 2009 7:49 AM   in reply to gaurawerma

    If you use AS2, your main swf player file defines the frame rate for any other swf files you load into it.  Regardless of what frame rate the loaded files were designed for, they will play at the frame rate of the player.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 23, 2009 7:57 AM   in reply to gaurawerma

    OK, obviously you need a workaround, my proposal.

     

    If you have the sourcecode for the loaded swf-files

     

    write down all the totalframes length (if you have multiple scenes, sum them up)

    then for the play progressbar write an enter_frame event that gets the percentage of your loaded movie

     

    for example: you have a movie with 1000 frames and a framerate of 25 (=40 seconds of animation)

    that is loaded in your 30 fps main movie.

     

    You won´t be able to influence the running time (it will only run 33 seconds) but you will be able to set the progressbar according to the percentage of the loaded movieclip, so instead of saying gotoAndPlay(framenumber),

    you must set the progressbar dimension to the _totalframes property of your loaded movie,

    then in the enter_frame function you get the position of the movie via _currentframe and set the position of the

    progressbar-knob (or whatever you`re using) to the percentage of the time the movie has played

     

    it will look similar to that

     

    _root.on(enterFrame){

         getProgress();

    }

     

    function getProgress():void{

       myPb.knob._x = myPb._width * (loadedMovie._currentframe/loadedMovie._totalframes);

    }

     

    for the ProgressKnob, that the user can drag to get to aposition within the loaded mc use a setter like

     

    dragKnob.on(MouseDrag){

       setProgress();

    }

     

    function setProgress():void{

      var position:Number =  myPb.knob;

      var totalLength = myPb._width;

      var percentage:Number = position/totalLength;

       loadedMovie.gotoAndPlay(Math.round(percentage*loadedMovie._totalframe s));

    }

     

    Problem could be, that the EnterFrame function could block the setProgress function (may be you should get the progress only every 20 frames or so)

    (Another reason to switch to AS3)

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 6, 2012 4:16 PM   in reply to Ned Murphy

    "Regardless of what frame rate the loaded files were designed for, they will play at the frame rate of the player."

     

    My main movie is doing just the opposite.  It's frame rate is temporarily slowing down to match that of a loaded swf.  Could this be because the loaded swf has embedded video and audio using the sync to stream  (rather than event) option?

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 7, 2012 7:39 AM   in reply to Triynko

    Yes, the main document will then take on the frame rate of the .swf with the video embedded into it.

    You can understand why... in order for the video to look and sound anywhere near normal, the frame rate must be that of the original video.

    But why are you using .swf files to play the videos? especially if you have multiple frame rates?

    You can use AS3 or simply play the videos as external .flv files in AS2. Then the main doc can have one frame rate and each external .flv can be played at whatever it's original frame rate is.... so you can display videos with different frame rates in AS2... provided you play them as external .flv files.

    And since you want the progress bar and timer... you'll be killing two birds with one stone.

    Best wishes,

    Adninjastrator

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points