Skip to main content
Participant
August 1, 2007
Question

Tweening Font Size

  • August 1, 2007
  • 4 replies
  • 343 views
I have a text field that is created by ActionScript, and it brings in its content through an external html file. The content is then styled by an external css file.

Later in the swf, this textField goes through an alpha tween using the Tween package, and it disappears. If possible, I'd like to cause this textField to tween in size as it tweens in alpha; so that it gets larger and fainter, and finally disappears. I know this is very easy without scripting, but my goal is to be able to stay as close to the existing code as possible.

Code that I'm using is as follows:

function writeMiddleHeader() {
var cssStyles:TextField.StyleSheet = new TextField.StyleSheet();
// text field
headerMovieOne.createTextField("middleHeadingText", headerMovieOne.getNextHighestDepth(), 250, 75, 500, 184);
headerMovieOne.middleHeadingText.selectable = true;
headerMovieOne.middleHeadingText.html = true;
headerMovieOne.middleHeadingText.multiline = true;
headerMovieOne.middleHeadingText.wordWrap = true;
headerMovieOne.middleHeadingText.condenseWhite = true;
// glow filter
var myGlowFilter = new GlowFilter (0xffffff, 0, 0, 0, 0, 0, false,false);
// Applies the filter to the object
headerMovieOne.middleHeadingText.filters = [myGlowFilter];
// html file
var loadTheHTML:LoadVars = new LoadVars();
loadTheHTML.onData = function(stringData:String):Void {
headerMovieOne.middleHeadingText.htmlText = stringData;
};
cssStyles.onLoad = function(bSuccess:Boolean):Void {
if(bSuccess) {
headerMovieOne.middleHeadingText.styleSheet = this;
loadTheHTML.load("packages-middleheading.html");
}
};
// css file
cssStyles.load("/packages-styles.css");
};

I've used textFormatting in the past, but it's been a while. I'm assuming that I might have to remove the CSS styling from this text field, and style everything with textFormat instead. When I tried this, though, none of the formatting displayed in the movie. Is there a way, using as much of the current code as possible, that I can accomplish this tween?

Thanks!
Jon
This topic has been closed for replies.

4 replies

Participant
August 2, 2007
Thanks so much for your help!
Damon Edwards
Inspiring
August 1, 2007
I'm assuming your text field is inside a movie clip, being headerMovieOne?
Participant
August 1, 2007
I should have posted that before. Apologies. There's this at the top of all the actions:

import mx.transitions.Tween;
import mx.transitions.easing.*;
import flash.filters.GlowFilter;

Then, where the Tween occurs, there's this:

hideCalloutHeaderTimer = setInterval(hideCalloutHeader, 11000); // hides the callout header
function hideCalloutHeader() {
var tweenMiddleHeader:Tween = new Tween (headerMovieOne.middleHeadingText,"_alpha",Strong.easeOut,100,0,3,true);
clearInterval(hideCalloutHeaderTimer);
};

Ideally, I'd like to add another Tween there, with the alpha tween inside that interval, that was able to increase the size of the text as the Tween that's there fades it out.

Thank you!
Damon Edwards
Inspiring
August 1, 2007
lets see your Tween script