Skip to main content
Participant
March 24, 2010
Question

Target Dynamic Text Field in Video Skin

  • March 24, 2010
  • 1 reply
  • 500 views

Hello,

I am new to FLVPlayback and Video skins and I was hoping someone could help me out.  I have a flvPlayback instance named fpp and am using a skin I modified from those provided by Adobe.  All is working fine, the skin shows up over the video, autohides on mouse out, etc.  What is killing me is attempting to get the video time into the skin

IE.  Elapsed Video Time / Complete Video Time

I am able to get these values in my flvPlayback.fla using the following ActionScript 3 code:

var fullDuration:String = "";

function metadataReceivedF(e:MetadataEvent):void {

    fullDuration = prettyTime(fpp.metadata.duration);

};

function updateF(e:VideoEvent):void {

    var paTime = fpp.playheadTime;

    time_txt.text = prettyTime(fpp.playheadTime) + " / " + fullDuration;

};

fpp.addEventListener(MetadataEvent.METADATA_RECEIVED, metadataReceivedF);

fpp.addEventListener(VideoEvent.PLAYHEAD_UPDATE, updateF);

function prettyTime(timeinSeconds:Number):String{

    var seconds:Number = Math.floor(timeinSeconds);

    var minutes:Number = Math.floor(seconds/60);

    seconds %= 60;

    minutes %= 60;

    var sec:String = seconds.toString();

    var min:String = minutes.toString();

    while(sec.length < 2) {

        sec = "0" + sec;

    }

    while(min.length < 2) {

        min = "0" + min;

    }

   return  min + ":" + sec;

}

What I can not figure out is how to get this time information into my dynamic text field in the skin.  I have tried numerous ways to target this textfield to no avail.  The instance name of my dynamic text field on my skin is: time_txt.  Not sure if this is helpful but my skin swf name is simply videoSkin.swf.

Can anyone please help me out with targeting this text field from my root flvplayback.fla actionscript.  Thanks a lot.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
March 24, 2010

you'll need to extend the flvplayback class and add methods to handle your textfield.  and, you'll need to assign your skin to be a class member.

Participant
March 24, 2010

Hello kglad,

Thanks for your response, I really appreciate it.  So my flvplayback is extended according to the steps I found here:

http://www.communitymx.com/content/article.cfm?page=1&cid=88033

Is this the correct path to follow?  And also could you explain

Also in my skin.fla file I added the following to my actionscript:

this.TimecodeTextField = "fl.video.skin.TimecodeTextField";

In my skin library I have a MC called TimecodeTextField with an instance name of "timetxt_mc" that contains my dynamic text field "timetxt_skin". I am exporting this movieclip in the library with a class name of "fl.video.skin.TimecodeTextField".

Regarding your help:

glad wrote:

you'll need to assign your skin to be a class member.

I aopologize but my AS coding is really not all that strong and i have no idea what this means.  Currently i am calling my skin from my flvPlayBack.fla in the following manner:

fpp.skin = "videoSkin.swf";

Thanks a lot, I very much appreciate any help on this issue.