Question

I have a Movie Clip which consists of a text-box with some text in it.

I am trying to tween this movie clip so it either moves randomly throughout the animation or have the movie clip bounce off the edges similar to a standard screen saver you might see. While slowly changing it's text through many different font families

Is it possible to have a movie clip tween randomly through an animation and is it possible to change the text to many different families in a slow transition.

I hope that makes sense :)

Was it helpful?

Solution

Check out this link for some pointers on scripting animation. Since you want to apply this to a MovieClip (in the Flash IDE I take it?), you'll have to make your class extend MovieClip and assign it to the movie clip in the library.

Bouncing it off the edge etc. are behaviors you'll have to code yourself. I'd recommend having a current movement vector, like

private var movement:Point;

Initialize it to a random direction and value:

movement = new Point(Math.random(), Math.random());
movement.normalize(INITIAL_VELOCITY);

And each frame, adding it to the movie clip's current position:

public function update():void {
    x += movement.x;
    y ++ movement.y;
    doBounce();
}

Bounce:

public function doBounce():void {
    // something like:
    if (x + width + MARGIN) >= stage.width) movement.x *= -1; // bounce off right side
    if (x + MARGIN <= 0) movement.x *= -1; // bounce off left side
    // similar for y and height
}

This is untested code, but should get you started.

On the topic of transitioning between fonts: It depends on the transition you want. You could fade 1 TextField out (reducing its alpha property to 0 over time) while fading a second one in, with a different font. If you want to morph between font shapes - I don't think that's possible with dynamic text, because I don't think you can "render" font outlines/glyphs to Graphics in the API, but not 100% sure.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top