A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: How to loop flv video in first keyframe in CS3?

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    4

    How to loop flv video in first keyframe in CS3?

    In my fla file I imported the flv file I created in the flash video encoder. I added skins when I did the import. I need help with the action script to get the first keyframe to replay the video after it finishes. In other words a continuous play loop.

  2. #2
    Dignitary rynoe's Avatar
    Join Date
    Jan 2003
    Location
    Earth
    Posts
    760
    Code:
    myVideo.addEventListener(VideoEvent.COMPLETE, replay); 
    
    function replay(e:VideoEvent):void {
      myVideo.seek(0);
      myVideo.play();
    }
    [SIGPIC][/SIGPIC]

  3. #3
    Junior Member
    Join Date
    Apr 2012
    Posts
    4

    questions on the code

    Pardon my for being a novice at this.
    This code should go in the keyframe containing the flv?
    I need help with naming:
    My files are as follows:
    print.fla
    print.flv
    print.swf
    can you redo the code to take this into account?
    Many thanks

  4. #4
    Junior Member
    Join Date
    Apr 2012
    Posts
    4
    Thanks for your post. I called the instance of the FLV file "miles".
    So here is the code now:
    miles.addEventListener(VideoEvent.COMPLETE, replay);

    function replay(e:VideoEvent):void {
    miles.seek(0);
    miles.play();
    }

    It is not working. The code error is:
    1046: Type was not found or was not a compile-time constant: VideoEvent.
    Source:
    function replay(e:VideoEvent):void {

    Please help and thanks.

  5. #5
    Senior Member
    Join Date
    Apr 2003
    Location
    Seattle
    Posts
    177

    missing video class

    Hello,

    I stumbled upon this post after searching for hours on the web with no success. Low and behold, this works like a charm! Well, after the following code is added in order to import in the video class so that the rest of the code will work:

    Actionscript Code:
    import fl.video.*;

    All in all, you should have a layer on top of the layer with your flv on frame one that is called actions. Then, go clicking on frame one of the actions layer, go to the actions window and paste in this code:

    Actionscript Code:
    import fl.video.*;

    miles.addEventListener(VideoEvent.COMPLETE, replay);

    function replay(e:VideoEvent):void {
    miles.seek(0);
    miles.play();
    }

    You should be good to go! Thanks rynoe for the great solution.

    Cheers!
    -Llyfre

  6. #6
    Junior Member
    Join Date
    Apr 2012
    Posts
    4
    Thanks Llyfre and rynoe this works perfectly!!!! Yea!!!!

  7. #7
    Senior Member
    Join Date
    Apr 2003
    Location
    Seattle
    Posts
    177
    Oh blast! I had this working fine, walked away and came back a week later and now I'm running into trouble. I have an FLV instance on frame one named miles and I'm using the following code to make it loop:

    import fl.video.*;

    miles.addEventListener(VideoEvent.COMPLETE, replay);

    function replay(e:VideoEvent):void {
    miles.seek(0);
    miles.play();
    }

    I pointed to the video file in the properties inspector so I'm sure it's linking properly, however I'm getting an error back about the videoEvent.COMPLETE and I can't figure out what I'm doing wrong, especially as the previous file I had this working in still works fine and when I copy it exactly into a new project it spits out the error.


    1119: Access of possibly undefined property COMPLETE through a reference with static type Class.

    Looking forward to getting this working again.....

  8. #8
    Senior Member
    Join Date
    Apr 2003
    Location
    Seattle
    Posts
    177

    CS 5.5 bug

    So, I've read more and found others having this problem when moving from CS5 to CS5.5, which is my case exactly (despite the thread being about CS3!).

    Anyway, I thought I'd post my workaround:

    instead of
    Actionscript Code:
    VideoEvent.COMPLETE
    use
    Actionscript Code:
    Event.COMPLETE

    Not sure why this works, but there you have it.

    (Changing flashplayer from 10.2 to 10.1 also has been reported to solve the problem)

    -Llyfre

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