AS3 - Refresh FLVPlayBack component!

Hey Guys,
I am working on AS3 project using Flash CS3. I have to display some videos using FLVPlayBack component. I am using the same component instance to display videos but when a new video is loaded the max duration property does not updates and hence the onComplete event is never fired.
I somehow wanted to refresh the component when a new video is to be played. Please let me know various ways to do so.
Thanks in advance for your kind consideration.

what code are you using to detect flv play completion?

Similar Messages

  • A better way to determine the current state of the FLVPlayback component?

    Below is the AS3 code I have used to display images (MCs) over an instance of the FLVPlayback component.  These images (one for loading, one for the title) are to appear – or disappear – according to the current state of the FLVPlayback component. 
    It “works,” but when testing, I have noticed that it can be rather finicky.  The most common issue that arises is that many times the loadPoster movieclip will still be visible even though the video has entered the playing state.
    Also, I wanted a title placeholder image to appear whenever the user stops the video or if the video completes.  However, I had to add the conditional statement to the “stoppedStateEntered” case to make everything appear when expected.  When the video is first viewed (and has completed buffering), it seems that the FLVPlayback component enters the stopped state before entering the playing state.  Thus, the titlePoster would flash on the screen right before it and the loadPoster “should” disappear when the video begins playing.
    Even in my limited testing, these issues were very easily re-created.  I am definitely looking for a more reliable solution.  Is there a better (or more correct) way to go about all this?  If possible, I would like to stick with the FLVPlayback component, just for the simple fact of not having to code my own.
    Where am I going wrong?
    function updateMoviePoster(event:VideoEvent):void
                    switch (event.type)
                                    case "playingStateEntered":
                                                    loadPoster.visible = false;
                                                    titlePoster.visible = false;
                                    break;
                                    case "stoppedStateEntered":
                                                    if (loadPoster.visible == false)
                                                                    titlePoster.visible = true;
                                    break;
                                    case "complete":
                                                    titlePoster.visible = true;
                                    break;
    myFLVPlayback.addEventListener(VideoEvent.PLAYING_STATE_ENTERED, updateMoviePoster);
    myFLVPlayback.addEventListener(VideoEvent.STOPPED_STATE_ENTERED, updateMoviePoster);
    myFLVPlayback.addEventListener(VideoEvent.COMPLETE, updateMoviePoster);

    Any suggestions?  I would truly appreciate the help.

  • Adding time to the FLVplayback component

    Hi everyone, Im using the FLVplayback component for a project im doing. I want to add the time elapsed and time left on the controls. I dont really want to create my own controls, as im happy with the flv playback component. The FLVs playing in the component are external and are loaded into it via as3
    Is there a quick and easy way of doing this?
    Cheers
    Dan

    I have managed to find some code for this component, but im getting some errors which im having trouble to de-bug;
    1118: Implicit coercion of a value with static type Object to a possibly unrelated type Function. vidPlayer.addEventListener("metadataReceived", listenerObject);
    1118: Implicit coercion of a value with static type Object to a possibly unrelated type Function. vidPlayer.addEventListener("playheadUpdate", listenerObject);
    Please would someone take a look and let me know what im doing wrong?
    Thanks
    code:
    var listenerObject:Object = new Object();
    var fullDuration = null;
    listenerObject.metadataReceived = function(eventObject:Object):void {
        fullDuration = prettyTime(vidPlayer.metadata.duration);
    listenerObject.playheadUpdate = function(eventObject:Object):void {
        var paTime = vidPlayer.playheadTime;
        if(fullDuration != null){
    //updates the text box with the instance name timeCode_txt on the root timeline.
    //best to use a monospace typeface like calibri for the textbox font.
            time_txt.text = prettyTime(vidPlayer.playheadTime) + " / " + fullDuration;
    vidPlayer.addEventListener("metadataReceived", listenerObject);
    vidPlayer.addEventListener("playheadUpdate", listenerObject);
    function prettyTime(timeinSeconds):String{
        var seconds:Number = Math.floor(timeinSeconds);
        var minutes:Number = Math.floor(seconds / 60);
        var hours:Number = Math.floor(minutes / 60);
        //Storing the remainder of this division problem
        seconds %= 60;
        minutes %= 60;
        hours %= 24;
        //Converting numerical values into strings so that
        //we string all of these numbers together for the display
        var sec:String = seconds.toString();
        var min:String = minutes.toString();
        var hrs:String = hours.toString();
        //Setting up a few restrictions for when the current time reaches a single digit
        if (sec.length < 2) {
            sec = "0" + sec;
        if (min.length < 2) {
            min = "0" + min;
        if (hrs.length < 2) {
            hrs = "0" + hrs;
        //Stringing all of the numbers together for the display
        var time:String = hrs + ":" + min + ":" + sec;
        //Setting the string to the display
        return time;

  • Switching between FLVPlayback component at their playheadTime

    Hi There,
    I hope someone can save me with this.
    I am currently on a project (AS3), where I have 2 frames, with videos (using the FLVPlayback component).
    and I want to switch from one video to the next video, however the catch is when i switch to the next video I want the new video to play at the previous video time.
    example:
    Video 1 plays,  10 sec later, you click a button to go and see the next video (in another frame) and that new Video starts 10 sec into it.
    This is the codes I been using so far:
    import fl.video.VideoEvent;
    import fl.video.MetadataEvent;
    video1.addEventListener(VideoEvent.PLAYHEAD_UPDATE, timer);
    function timer(e:VideoEvent):void {
        var newTime = video1.playheadTime;
    nextFrame_btn.addEventListener( MouseEvent.MOUSE_UP, nextFrame);
    function nextFrame (MouseEvent):void
                gotoAndStop(2);
          video2.playheadTime = newTime;
    This doesn't work and I do not know what I am doing wrong.
    many thanks if you can help.

    yes there is another layer with codes but that is for the buttons.. that can work throughout the flash (in all frames). Sorry I forgot about that. Those buttons are just basic home, end buttons. In the other layer is the switch code for the button I am trying to make.
    This button/code for some reason does not like being in the main code layer. So I added it in another layer, which seem to make it work. (The part where I want it to gotoAndStop in another frame.)
    var newTime:int;
    switch_btn.addEventListener(MouseEvent.MOUSE_UP, switch1);
    function switch1 (MouseEvent):void // Function to turn on 3D mode
                        newTime = video1.playheadTime;     
                        this.addEventListener(Event.RENDER,renderF);
    trace("stage:",stage);
                        stage.invalidate();     <= that use to be line 15 before the trace was added.
            gotoAndStop(2);  
                        trace (newTime);
    function renderF(e:Event):void{
      video1.seek(newTime);
    the other layer has this code:
    cha1_btn.addEventListener(MouseEvent.MOUSE_UP, cha1);
    chan2_btn.addEventListener(MouseEvent.MOUSE_UP, chan2);
    function cha1 (MouseEvent):void
              gotoAndStop(10);
    function chan2 (MouseEvent):void
              gotoAndStop(11);
    They are on seperate layers because the switch function is used in all the frames, but to gotoAndStop in different frames.
    aka this one: is in frame 10, which goes to frame 2
    and there will be another one in frame 2 to go to frame 10.
    then there is another in frame 11, which goes to frame 3
    and then the same for frame 3 to goto frame 11.
    so thats why there were in seperate layers, to be able to change that. (sorry if this is getting confusing)

  • Unable to drag FLVPlayback Component onto stage

    Just wondering if anyone could shed some light on why I can't
    drag the FLVPlayback Component (AS3 version) onto the stage? I open
    Component Inspector, and see the component, yet when I try and drag
    it onto the stage, or into the Library, nothing happens. Each of
    the individual controls, I don't have an issue with, they appear as
    soon as I drag them, however the FLVPlayBack component won't have a
    bar of it.

    One or more of the files in the iPhoto Library are corrupted.
    You can right click on the iPhoto Library and "Show Package Contents" inside is a folder called Originals.
    You can mess around and copy files in small batches until you hit the snag.

  • Need to stop playback of an FLVPlayback component when navigate away from page!

    I have an movieclip playing as auto start on the first page of my website.  The component continues to play when I navigate away from the page.  How can I stop the playback of the movie if it has not completed when navigation away from the page is invoked.  I have search and am unable to find such an event using an FLVPlayback component.  Presently there is no code in actionscript to display here.
    thanks

    Hi, this is the entire code that is placed on the timeline in frame 1 of the AS line.  There is now an error and the FLVPlayer component, which is also begin in frame 1. At this point there is one method that I thought should work when the vTinesDayBtn is clicked.  However, is not.
    The error is:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at ewddSite_fla::MainTimeline/vTines()
    ArgumentError: Error #1063: Argument count mismatch on ewddSite_fla::MainTimeline/stoppedVid(). Expected 0, got 1.
    The code is:
    stop();
    import flash.events.*;
    import flash.display.*;
    import fl.video.*;
    import fl.video.FLVPlayback;
    function stoppedVid() {
      vidPlay.stop();
    vTinesDayBtn.addEventListener(MouseEvent.CLICK, stoppedVid)
    function vTines(evt:MouseEvent):void {
    gotoAndStop(20);
    vidPlay.stop();
    function engagements(evt:MouseEvent):void {
    gotoAndStop(25);
    function weddings(evt:MouseEvent):void {
    gotoAndStop(30);
    function births(evt:MouseEvent):void {
    gotoAndStop(35);
    function birthdays(evt:MouseEvent):void {
    gotoAndStop(40);
    function graduations(evt:MouseEvent):void {
    gotoAndStop(45);
    function anniversaries(evt:MouseEvent):void {
    gotoAndStop(50);
    function specEvents(evt:MouseEvent):void {
    gotoAndStop(55);
    function memorials(evt:MouseEvent):void {
    gotoAndStop(60);
    //main.addEventListener(MouseEvent.MOUSE_DOWN, mainPg);
    vTinesDayBtn.addEventListener(MouseEvent.MOUSE_DOWN, vTines);
    engageBtn.addEventListener(MouseEvent.MOUSE_DOWN, engagements);
    weddingsBtn.addEventListener(MouseEvent.MOUSE_DOWN, weddings);
    birthsBtn.addEventListener(MouseEvent.MOUSE_DOWN, births);
    bDaysBtn.addEventListener(MouseEvent.MOUSE_DOWN, birthdays);
    graduBtn.addEventListener(MouseEvent.MOUSE_DOWN, graduations);
    annivBtn.addEventListener(MouseEvent.MOUSE_DOWN, anniversaries);
    spEventsBtn.addEventListener(MouseEvent.MOUSE_DOWN, specEvents);
    memorialsBtn.addEventListener(MouseEvent.MOUSE_DOWN, memorials);

  • Is it possible to import YouTube videos into a flash FLVPlayback component...?

    Hi all,
    I'm now working on a flash website, i need to play a youtube video inside my flash movie.
    In this Flash file i have a FLVPlayback component and i tried to link the youtube video into this but did'nt work.
    Please help me...

    You should find what you need here: http://code.google.com/apis/youtube/flash_api_reference.html

  • FLVPlayback component skinAutoHide problem

    Hi guys!
    I have a problem with FLVPlayback component's skinAutohide
    property which works poorly when FLVPlayback component is the same
    size as your stage. The skin only hides when I move my mouse very
    slowly outside the FLVPlayback component.
    Also making the FLVPlayback component smaller isn't an option
    so what more options are there left?
    Is there anyway to hide the skin by yourself?
    I allready tried the following code, but I think this is very
    unreliable (I get some errors when I move my mouse very quickly
    over and outside the FLVPlayback component):
    video.addEventListener(Event.MOUSE_LEAVE, mouseLeaveHandler);
    video.addEventListener(MouseEvent.MOUSE_MOVE,
    mouseMoveHandler);
    function mouseLeaveHandler(event:Event):void {
    video.skin = "";
    function mouseMoveHandler(event:Event):void {
    video.skin = "SkinOverPlayStopSeekFullVol.swf";

    I am having the exact same problem. Thanks for info that this
    is caused by movie being the same size as the stage. I am also
    working on a solution and will let you know if I find one.

  • FLVplayback component problem

    my flash movie contains FLVPlayback component to play videos.
    In the begining of the movie( frame 1) I have a simple pre-loader.
    When I test my swf on a browser the pre-loader appear only after
    few second, not immediately. (my pre-loader start from 40%). I
    think the reason is that flash load the FLVPlayback component on
    the first frame although my component appears only on the second
    frame . Is there any work around this issue?
    Thanks

    I am having the exact same problem. Thanks for info that this
    is caused by movie being the same size as the stage. I am also
    working on a solution and will let you know if I find one.

  • Need Preloader for FLVplayback Component

    Hi,
    I'm playing external .flv videos using the 'FLVplayback'
    component. My client's complaining that they stall and stutter a
    bit when they start to stream, and wants to know if I can create a
    preloader for them.
    Can anyone help or point me in the right direction to create
    preloaders for this component? Since the .flv is not on the
    timeline, I don't know where to begin. I found some info on this in
    the Flash Help files, but it's a little over my head.
    Thanks very much

    Hey metrov,
    ActionScripting is the way to go for this situation. Try this
    link (hope it helps)...
    http://www.actionscript.org/forums/showthread.php3?t=105158
    Jaythan

  • Remove sound in FLVplayback component?

    How do you remove the sound from "specifically" from FLVplayback component? Since the sound wont stop playing when I'm on different page(assume that if the person didnt click the pause button and navigate to other pages)....Normally I would add SoundMixer.stopAll(); for every button in my main and loaded swf but this will stop my background music as well....
    The flvplayback component is located in another swf file and the code was added on the second frame of the movieclip call "scrollGroup"
    import fl.video.FLVPlayback;
    import flash.events.Event;
    var flvPlayback:FLVPlayback = new FLVPlayback();
    flvPlayback.fullScreenTakeOver = false;
    flvPlayback.autoPlay = false;
    flvPlayback.source = "video/Listening_to_Community_Voices.f4v";
    flvPlayback.skin = "MinimaFlatCustomColorPlayBackSeekCounterVolMuteFull.swf";
    flvPlayback.x = 31;
    flvPlayback.y = 123.8;
    addChild(flvPlayback);

    http://forums.adobe.com/message/2587415?tstart=0

  • FLVPlayback Component video and skin as one swf

    Is it possible when publishing a Flash CS4 file to have the Video swf and the Skin swf be in one swf file?
    I have a Flash CS4 (AS2) file that has a FLVPlayback Component. When I publish or test movie 2 swfs are output. I need only 1 swf as I am then going to insert this 1 swf into a Captivate 4 project.
    When I insert the video swf by itself into Captivate 4, I do not have a play bar/skin.
    If it is not possible to publish as one swf, can someone please tell me how I can insert the 2 swfs into a Captivate file and get them to work?
    Thanks in advance.

    My project is called JumpVideo.
    The only 2 items in my library are the FLVPlaybackComponent and a Combo box.
    I have imported a video using the FLVPlaybackComponent and have selected the SteelExternalPlaySeekMute skin to go with the playback.
    The video has defined cue points. The combo box has two values. When the first is selected it jumps to the start of the video. When the second is selected it jumps to the cue point.
    When I publish there are two swfs that are produced; the project swf itself (JumpVideo.swf) and the skin (SteelExternalPlaySeekMute.swf).
    I would like there to be only one swf published (i.e. the skin is within the JumpVideo.swf).
    Is this possible?
    The swfs will then need to be inserted into Captivate 4 as animation.
    If 1 swf cannot be published, then can you perhaps help with how I can insert the JumpVideo.swf and the skin swf into Captivate and have it work as it does in Flash CS4?

  • Load FLV into FLVPlayback component?

    I have an array of videos coming from an XML doc. I am getting the name of my video in the trace statement okay, but am not sure how to go about loading the FLV video into the player. I have an FLVPlayback component on the interface named "video". The video I'm going to load will be ("videos/" + videoArray[0])). What is the proper way in AS 3 to load this video?

    var start:Number = 0;
    var videoConnection:NetConnection = new NetConnection();
    videoConnection.connect(null);
    var aStream:NetStream = new NetStream(videoConnection);
    aStream.play("myvideo.flv");
    aStream.pause();
    I hope this will help you

  • Is Action Script for netStreaming and FLVPlayback component radically different, not interchangeabl?

    Hi.
    I am using NetConnection and NetStream to play back flv in Flash Pro CS5.5, and trying to add cue point to trigger events using Action Script, and to automatically rewind to the start at the end. There is no problem to trigger events via AS when the cue points are embedded, but i am unable to add cue points using AS.
    When i use an FLVPlayback component, there is no problem to add cue points (http://help.adobe.com/en_US/ActionScript/3.0_UsingComponentsAS3/WS5b3ccc516d4fbf351e63e3d1 18a9c65586-7feb.html) and to loop the playback using autoRewind (and fl.video.VideoEvent.AUTO_REWOUND which i got from Nafem at http://forums.adobe.com/thread/857036).
    However, i am failing to use this same code w/a netConnection and netStream, and would appreciate any help.
    thanks.

    Hello,
    Well, I've got some help from another helpful fellow at macscripter.net and I have a working script - albeit a bit more specific (ie, hardcoded extensions to look for) and a different approach.
    Here's the script:
    on adding folder items to thisFolder after receiving addedItems
    repeat with movieFile in addedItems
    set {Nm, Ex} to getName_andExtension(movieFile)
    set movieFilePath to (thisFolder as text) & Nm & ".avi"
    set subtitleFile to (thisFolder as text) & Nm & ".srt"
    if Ex is ".srt" then
    try
    tell application "iFlicks"
    import (movieFilePath as alias) with gui
    end tell
    end try
    else if Ex is ".avi" then
    if my FinderItemExists(subtitleFile) then
    try
    tell application "iFlicks"
    import (movieFilePath as alias) with gui
    end tell
    end try
    end if
    end if
    end repeat
    end adding folder items to
    on getName_andExtension(F)
    set F to F as Unicode text
    set {name:Nm, name extension:Ex} to info for file F without size
    if Ex is missing value then set Ex to ""
    if Ex is not "" then
    set Nm to text 1 thru ((count Nm) - (count Ex) - 1) of Nm
    set Ex to "." & Ex
    end if
    return {Nm, Ex}
    end getName_andExtension
    on FinderItemExists(thePath)
    try
    set thePath to thePath as alias
    on error
    return false
    end try
    return true
    end FinderItemExists

  • Dynamically refresh jspx component(i.e af:outputText) based on Java

    Scenario : To update my marquee OutputText value based on Table value change
    I have a requirement like, based on db table value change one of my component has to be refreshed from my server program(i.e java).
    I got the event using DataUpdateEventListener from DB that some changed has been occurred on my table, and the value is set to true on my java class...
    Problem
    Using that true value i have to get the component(i.e af:outputText) from jspx (note: which is not in the region) and refresh the component so that my output value will be updated.
    Any one of you have any idea abut this problem please suggest
    Thanks in advance
    Karthik

    Check my blog http://tompeez.wordpress.com/2013/03/24/jdeveloper-11-1-1-6-0-self-closing-popup/ which shows how to use a poll component on a page. As the use case is to only call hte bean methos once you have to change the implementation in a way that you don't reset the timeout, but leave is as is so that the poll listener is called periodically.
    Timo
    Edited by: Timo Hahn on 13.05.2013 09:23
    I found this video from Shay Shmeltzer showing how to use the poll component: https://blogs.oracle.com/shay/entry/using_the_afpoll_to_refresh_pa

Maybe you are looking for

  • MD04 - no release button available when clicking on purchase requisition

    Hi experts, A purchase requisition has been created that needs to be released. This can be done via ME54 which works fine. Another possibility is via MD04 - click on the purchase req. number. A pop-up occurs and there should be a release-button (gree

  • Need help in saving data

    i have created an midp application whihc has a user profile form which consists of name ->> textfield choice of radio buttons and submenus how can i save these user inputs from such element i mean radiobuttons,checkboxs, textfields help

  • Rule-based reducing of target groups

    Hi, When you use the reduction rule; 'percentage-based, first entries' on a target group in the Segment Builder, what will 'first entries' mean? First, I thought that it depend on the layout sorting, but now I am unsure. Can anybody help me?? Thanks,

  • Photoshop CS6 Serial Number Ineffective

    My Photoshop CS6 serial number won't work.  When entered I get a message telling me that two machines are in use and I must disconnect one of them.  If I can find a way to get around this fine, otherwise i will need another "workable" serial number a

  • ITunes.msi (What is it And Where Is It?)

    I just started having problems with iTunes on my compy. I've tried uninstalling iTunes, so there's nothing there. Yet, when I go into Add/Remove programs, iTunes is still there. What's left of it is about 109 MB in size. If I click remove, the comput