2 Replies Latest reply on Feb 20, 2011 9:26 AM by somascope

    How to Use Actionscript to Tween Embedded Video?


      I want an flv file to gradually grow bigger on my screen while it continues to play. Regular tweening does not work on the timeline and I was told to use Actionscript but no where I've looked has made sense to me. Is there a simple, easy to describe way to do this that I can understand as a beginner to actionscript? I'm definately not seeing where you get control of the image with actionscript, I suppose I am used to some sort of wizard that graphically shows you what you are manipulating, and am unsure how to use the text to make it do what I want to do. ANy help would be greatly appreciated.



        • 1. Re: How to Use Actionscript to Tween Embedded Video?

          I dont know flash, but you can use css3 transitions and javascript to change the video size. Like:



          #video {



          -moz-transition: all 2s ease 0s;  //format is "property duration easingtype delay"//

          -o-transition: all 2s ease 0s;

          -webkit-transition: all 2s ease 0s;




          window.document.ready {

          function expandvideo() {









          <embed src="myvideo.swf" id="video" ></embed>

          <button name="play" value="play" onclick="expandvideo()" />


          • 2. Re: How to Use Actionscript to Tween Embedded Video?
            somascope Level 3

            Here is a quick way to do this with Adobe's built-in Tween class (of which I'm not a fan, there are better ones out there, such as TweenLite):

            - So up-front, I'll recommend TweenLite, at http://www.greensock.com/tweenlite/

            - Another populer Tween engie is Tweener.


            But to avoid dealing with a 3rd party AS3 library, let's use Adobe's Tween class...


            Bring an instance of the FLVPlayback component onto the stage and link that to your FLV/F4V video file.

            • You cannot use the Tween class on the video component directly (nothing will happen), so convert this into a Movieclip symbol.
            • Name this symbol "videoMC". Be sure this symbol is on the main timeline.


            On a new layer, also on the main timeline, add this code:


            import fl.transitions.Tween;

            import fl.transitions.easing.*;

            var scaleXTween:Tween = new Tween(videoMC, "scaleX", None.easeNone, 1, 2, 10, true);

            var scaleYTween:Tween = new Tween(videoMC, "scaleY", None.easeNone, 1, 2, 10, true);


            That's it!


            The Tween constructor takes the following parameters:

            Tween(obj:Object, prop:String, func:Function, begin:Number, finish:Number, duration:Number, useSeconds:Boolean = false)

            Our Tween affects the scaleX and scaleX props to go from a scale of 1 to 2 in 10 seconds.


            One of the things I don't like here is that you need mutliple lines to affect multiple properties - a big negative, in my opinion, with Adobe's Tween class. But, this shows how you can get the job done by affecting the scaleX and scaleY properties of the Movieclip symbol.



            To get familiar with this Tween class, here is the Adobe documention: