How to Create a Ticker in Flash

How to Create a Ticker in Flash thumbnail
Tickers are a great way to display stock information.

A ticker is a constantly looped, scrolling piece of text. A scrolling ticker is a great effect to have on your website or Flash application. Tickers are good for news, stock information, or just to welcome someone to your website. To create a Ticker in Flash, you do not need to use any tools whatsoever---all you need is a little bit of ActionScript.

Instructions

    • 1

      Open Flash. Go to "File," "New," and create a new document in "Flash File (ActionScript 3.0)."

    • 2

      Click the blank "Keyframe" in the "Timeline" and select "Actions" to open the Actions window.

    • 3

      Copy and paste the following code into the Actions window:

      //PLEASE CHANGE THE FOLLOWING TO WHATEVER SUITS YOU:
      var ticker_speed:int = 8; //Speed of ticker
      var ticker_text:String = "Type Whatever You Want Here";//Text of ticker
      //---------------------------------------------------
      //CUSTOMIZATION OF TEXT FIELD:
      var mTextField:TextField = new TextField();
      addChild(mTextField);
      mTextField.text = ticker_text;
      var mTextField_form:TextFormat = new TextFormat();
      mTextField_form.size = 32;//Size of text. Change this if you'd like.
      mTextField.setTextFormat(mTextField_form);
      mTextField.selectable = false;
      mTextField.autoSize = TextFieldAutoSize.LEFT;
      //-----------------------------------------------------
      //ADD SCROLLING CAPABILITIES:
      mTextField.addEventListener(Event.ENTER_FRAME,move_text);
      function move_text(myevent:Event):void {
      mTextField.x-=ticker_speed;
      if(mTextField.x<(0-mTextField.width)) mTextField.x=stage.stageWidth;
      }
      //-----------------------------------------------------

    • 4

      Change the "ticker_text" string to whatever you'd like your ticker to say and set the "ticker_speed" to determine how fast the ticker moves.

    • 5

      Go to "Control" and "Test Movie" to test your Flash ticker. You will see your text scroll across the screen. If it is moving too fast change the "ticker_speed" variable to a lower number, and if it's too slow, change it to a higher number.

Related Searches:

References

  • Photo Credit stock market analysis screenshot image by .shock from Fotolia.com

Comments

You May Also Like

Related Ads

Featured