文字打印效果

BY JOSH TYNJALA
name="google_ads_frame" width="125" height="125" frameborder="0" src="http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-0554953785959163&dt=1229513576375&output=html&slotname=5345713304&correlator=1229513576375&url=http%3A%2F%2Fwww.zeuslabs.us%2F2008%2F01%2F17%2Fsource-code-for-custom-textfields-with-cool-effects%2F&ea=0&frm=0&ff=Verdana&biw=1440&bih=747&adx=991&ady=260&ga_vid=59431211.1229046025&ga_sid=1229513576&ga_hid=2049770145&ga_fc=true&flash=10.0.12&u_h=900&u_w=1440&u_ah=840&u_aw=1440&u_cd=32&u_tz=480&u_his=7&u_java=true&u_nplug=22&u_nmime=85&dtd=88" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no">

Recently, I decided to throw something up onjoshtynjala.com. Nothing fancy or special. Just thought I’d mention that I’m a Flash developer and put a couple links pointing to the blog here. A simple SWF displays the recent postings from the various blogs to which I contribute. Part of the project’s goal was to display the posts in an interesting way, so I created a couple of custom TextField subclasses that manipulate the text as they display it.

EFFECT #1: TYPINGTEXTFIELD

This one is obvious. When the text property changes, the TextField clears and adds one letter at a time to simulate typing. A simple blinking cursor may be displayed to give it a command line sort of appearance.

Source Code

EFFECT #2: DECRYPTINGTEXTFIELD

Hollywood doesn’t understand computers. That said, it’s always cool to see the combination for a safe with an electronic lock get cracked character by character. The DecryptingTextField displays a set of random letters that cover the full length of the text property. One by one, the proper characters are displayed.

Source Code

A couple things to note on this one. If you’re going turn on word-wrapping for a DecryptingTextField, you should set the keepSpaces property to true. This will minimize ugly changing line breaks by always displaying spaces when the randomizer encounters a space in the original text. Additionally, to further improve the aesthetics, you might want to consider using a mono-spaced font like Courier or Consolas so that the characters stay in the same location every time a new random character is displayed. It doesn’t look bad on a single line, but it’s more noticeable when you have multiple lines.

Interested in how I combined my RSS feeds? I didn’t do it directly in ActionScript. Instead, I took advantage of Yahoo! Pipes to create a combined feed for this blog and any posts that are specifically authored by me at theYahoo! Flash Blog.

Source code is linked above under each demo. They’re under the terms of anMIT-style license so you may include them in both open source and commercial projects.


原文:http://www.zeuslabs.us/2008/01/17/source-code-for-custom-textfields-with-cool-effects/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值