/**
*
* This class was created with the 'Create Classes' command.
*
* You can edit this class by editing the symbol in the library of the corresponding FLA.
*
**/
package com.view.swfassets
{
import com.view.fonts.Futura;
import com.view.fonts.MinionPro;
import flash.display.MovieClip;
import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
public class TightTextClip extends MovieClip
{
/**
* <p>A movieclip that exists on the stage of TightTextClip.
* It moves back and forth across to demonstrate that the
* font is really embedded and can be alphad.<p>
*
* <p>Any clip that exists on the stage must be made public
* or it is not successfully declared<p>
*
* <p>Any clip that has clips on stage that are named must
* also have the declare stage instances automatically property
* turned off, or it will not work correctly<p>
*/
public var motionClip : MovieClip;
/**
* TextField to be inserted into the motionClip MovieClip
*/
private var motionTextField : TextField;
private var motionTextFieldFormat : TextFormat;
/**
* <p>A movieclip that exists on the stage of TightTextClip.
* It alphas alpha from 0 to 1 and back again to demonstrate that the
* font is really embedded and can be alphad.<p>
*
* <p>Any clip that exists on the stage must be made public
* or it is not successfully declared<p>
*
* <p>Any clip that has clips on stage that are named must
* also have the declare stage instances automatically property
* turned off, or it will not work correctly<p>
*/
public var alphaClip : MovieClip;
/**
* TextField to be inserted into the alphaClip MovieClip
*/
private var alphaTextField : TextField;
private var alphaTextFieldFormat : TextFormat;
/**
* This is called when this class is instantiated, because
* this class overwrites the default class inside the swf
*
*/
public function TightTextClip()
{
motionTextFieldFormat = new TextFormat();
motionTextFieldFormat.align = TextFormatAlign.CENTER;
motionTextFieldFormat.bold = true;
motionTextFieldFormat.font = Futura.FUTURA;
motionTextFieldFormat.size = 12;
motionTextField = new TextField();
motionTextField.embedFonts = true;
motionTextField.selectable = false;
motionTextField.defaultTextFormat = motionTextFieldFormat;
motionTextField.width = 200;
motionTextField.text = "Paperversion Two > j00!";
motionClip.addChild( motionTextField );
alphaTextFieldFormat = new TextFormat();
alphaTextFieldFormat.align = TextFormatAlign.CENTER;
alphaTextFieldFormat.bold = true;
alphaTextFieldFormat.font = MinionPro.MINION_PRO;
alphaTextFieldFormat.size = 12;
alphaTextField = new TextField();
alphaTextField.embedFonts = true;
alphaTextField.selectable = false;
alphaTextField.defaultTextFormat = alphaTextFieldFormat;
alphaTextField.width = 200;
alphaTextField.text = "make font love, not war";
alphaClip.addChild( alphaTextField );
addEventListener( Event.ENTER_FRAME, loopLastFrame );
}
/**
* <p>Checks to see if this is the last frame, the movie
* clip is looped back to frame 0 if it is.<p>
*
* @param evt
*
*/
public function loopLastFrame( evt : Event ) : void
{
if( currentFrame == totalFrames -1 )
gotoAndPlay( 0 );
}
}
}