So you have a FLV file embedded into your flash, but you have no idea how to get some kind of time code on it. Well look no more. Here is a code that can save your life. I will break it down as we go along.

1. Create a layer in your project called "Actions" (not required, but very useful)

2. In a blank frame, put this script in.

**** NOTE OF SOME BASIC COMMANDS *******

; <-- this means END LINE. without this it will combine command and give you an error

FLASH IS CASE SENSETIVE when it is dealing with scripting. "Name","name","NAME","naMe" are all different entities.

******************************************

onEnterFrame = function(){;

/////////// TOTAL TIME SCRIPT ////////////////

timecode = Math.round(YOUR_MOVIECLIP_Name.totalTime);

tmins = Math.floor(timecode/60);

tsecs = Math.floor(timecode%60);

tmins = (tmins <10) ? "0"+tmins : tmins;

tsecs = (tsecs<10) ? "0"+tsecs : tsecs;

vidTime = tmins+":"+tsecs;

/////////// CURRENT TIME SCRIPT //////////////////

htimecode = Math.round(YOUR_MOVIECLIP_Name.playheadTime);

hmins = Math.floor(htimecode/60);

hsecs = Math.floor(htimecode%60);

hmins = (hmins<10) ? "0"+hmins : hmins;

hsecs = (hsecs<10) ? "0"+hsecs : hsecs;

headTime=hmins+":"+hsecs;

////////// Lets show the results in this variable ///////////

displayTime=headTime+"/"+vidTime;

};

ok, let me break this down starting from the top.

1. onEnterFrame = function(){;

- Invoked repeatedly at the frame rate of the SWF file.

This command will repeat this function we created over and over again(only whats in the {};. Usage in this example onEnterFrame = function(){};

2. timecode = Math.round(Your_Movieclip_name.totalTime);

- timecode is a variable that we just made up. it could basically be anything you want but you will have to reference this name thoughout the script. Math.round() - this command produces a number. This number is Rounded up to the nearest integer(up or down). Usage Math.round( x ); In this script we are asking for Flash to give us a number of (our movie clips.totalTime). totalTime is a property of flash, which in this command, will return a value for your movieClip.

3. tmins = Math.floor(timecode/60);

- tmins is a variable that we made up. again, a variable could be anything you name, but it needs to follow thoughout your script. This command we are finding the number of minutes in the clip and assigning it to the variable tmins. Math.floor = this is the closet integer that is less than or equal to the specific number or expression. Usage Math.floor (x). if x = 12.5 then the return a number of 12. In this script we are getting the Math.floor of (timecode divided by 60);

4. tsecs = Math.floor(timecode%60);

- tsecs is a variable we made up. We are getting the Math.floor of (remainder of timecode divided by 60); % = calcuates remainder for example (12 % 5) = 2 the remaining amount is 2.

5. tmins = (tmins <10) ? "0"+mins : tmins;

- wow what does this mean. this is nutty. Well hold on. tmins is a predefined variable that we created before. to explain the rest of this, i must explain the ? mark. ? is used as the following.

expression1 ? expression2 : expression 3. expression1 is evaluted to a Boolean value (true of false). if value is found true, then it will do expression 2, otherwises it will do expression 3. lets say tmins = 5. lets plug it into the equation. tmins = (5 < 10)[true] ? "0"+tmins : tmins; the result would be 05. we are saying by "0"+tmin - if the value is less then 10, but a 0 infront of the number, otherwise, leave the number whole. tmins = 20 tmins. timins = (20 < 10)[false] ? "0"+mins : tmins; the result would be 20.

6. tsecs = (tsecs <10) ? "0"+tsecs : tsecs;

- ok, this should be easier to understand now. if tsecs < 10 is true then add a 0 infront of tsecs, if its false, then just display tsec.

7. vidTime = tmins+":"+tsecs;

- vidTime is a new variable that we just created. in the variable we now placed a the values tmins and this string : and tsecs;.

///// now we created the same process for the current time script. the only difference is the first part of the script.

8. htimecode = Math.round(YOUR_MOVICLIP_NAME).playheadTime);

- this does Math.round on your clip's current playheadTime. the rest of the script is the same as the above script.

9. headTime=hmins+":"+hsecs;

- this is a new variable named headTime that stores the new varibles we created. hmins and hsec. check #7 for more detal.

Now we display the results.

10. displayTime = headTime+"/"+vidTime;

- this variable should be attached to a dynamic text box you created named displayTime [in the Var box].

11. }; this closes off the function that we left open in #1.

I hope this helps everyone to understand what was written. Good luck and thats all for now.