公司想要做一個巨乳時計跟現在正風行的美人時計一較高下
不過….其實就是抄襲啦 哈哈
不一樣的是主要的動態不是用JavaScript而是FLASH
而既然用FLASH就不會只是單純的淡入淡出
所以照片也要有點噗拎噗拎的效果
文字也要有一點不一樣的變化(話說回來…這些好像JavaScript也可以做到!?)
重新寫了一個打字效果的AS3 CLASS
其實就是在moviceClip裡先包了一堆命名好的TextField後
再用Timer控制其內容而已..
不過TextField的顏色用textColor控制老是怪怪的
所以只好在htmlText中用HTML標籤來補助…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | package { import flash.events.*; import flash.display.MovieClip; import caurina.transitions.Tweener; import flash.utils.Timer; import flash.text.TextField; import flash.text.TextFieldType; public class texts extends MovieClip { var mod:ModelLocator = ModelLocator.getInstance(); var _playTimer:Timer = new Timer(25); var _name:String; var _birthday:String; var _home:String; var _blood:String; var _height:String; var _size3:String; var _occupation:String; var _web1:String; var _webUrl1:String; var _web2:String; var _webUrl2:String; var _web3:String; var _webUrl3:String; var _item1:String; var _itemUrl1:String; var _item2:String; var _itemUrl2:String; var _item3:String; var _itemUrl3:String; var _texts_arr:Array; var now_text:int; var max_text:int; public function texts() { addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event) { _playTimer.addEventListener(TimerEvent.TIMER, playText); mod.addEventListener("changeText", changeText); } private function changeText(e:CustomEvent) { _texts_arr = new Array([m_name, _name], [m_birthday, _birthday], [m_home, _home], [m_blood, _blood], [m_height, _height], [m_size3, _size3], [m_occupation, _occupation], [m_web1, _web1], [m_web2, _web2], [m_web3, _web3], [m_item1, _item1], [m_item2, _item2], [m_item3, _item3]); max_text = 0; for (var i = 0; i < _texts_arr.length; i++) { var _text : TextField = _texts_arr[i][0]; if (i >= 7) _text.textColor = 0x10CAF3; _text.text = ""; if (_texts_arr[i][1]) { max_text = max_text < _texts_arr[i][1].toString().length?_texts_arr[i][1].toString().length:max_text; for (var j = 0; j < _texts_arr[i][1].toString().length; j++) { _text.appendText("_"); checkUrl() } } now_text = 0; _playTimer.start(); } } private function playText(e:TimerEvent) { for (var i = 0; i < _texts_arr.length; i++) { var _text : TextField = _texts_arr[i][0]; if (i >= 7) _text.textColor = 0x10CAF3; if (_texts_arr[i][1]) { var tmp_length = _texts_arr[i][1].toString().length; if(tmp_length >= now_text){ for (var j = 0; j < tmp_length; j++) { if (j < now_text) { _text.htmlText = ""; _text.appendText(_texts_arr[i][1].toString().substr(0, now_text)); for (var k = 0; k < tmp_length - now_text; k++) { _text.appendText("_"); } checkUrl(); } } } } } now_text < max_text?now_text++:_playTimer.stop();; } private function checkUrl() { var tmpHeader:String = '<font color="#10CAF3"><a href="'; var tmpFooder:String = '</a></font>'; m_web1.htmlText = tmpHeader + _webUrl1 + '">' + m_web1.text + tmpFooder; m_web2.htmlText = tmpHeader + _webUrl2 + '">' + m_web2.text + tmpFooder; m_web3.htmlText = tmpHeader + _webUrl3 + '">' + m_web3.text + tmpFooder; m_item1.htmlText = tmpHeader + _itemUrl1 + '">' + m_item1.text + tmpFooder; m_item1.htmlText = tmpHeader + _itemUrl2 + '">' + m_item2.text + tmpFooder; m_item1.htmlText = tmpHeader + _itemUrl3 + '">' + m_item3.text + tmpFooder; } } } |
請問as2該怎麼製作呢?
這個class沒有用到很複雜的AS3搞不好AS2可以照用~
要改應該也是一點點而已拉!