![]() |
|
||||||||||
|
|
|
|||||
|
Регистрация: Aug 2010
Сообщений: 13
|
подскажите как оформить функцию ??
нужно из вне задать параметр count . например 10 , и чтобы отсчет шел именно с 10 . вот код... package { import flash.display.*; import flash.events.*; import flash.text.*; import flash.utils.*; public class ZZZZ extends Sprite { public var secMsg:TextField; public var timer:Timer; public var count = 0; public function ZZZZ(count=0) { this.count = count; var timer:Timer = new Timer(1000,0); timer.addEventListener(TimerEvent.TIMER, timerListener); timer.start(); secMsg = new TextField(); secMsg.autoSize = TextFieldAutoSize.LEFT; secMsg.text = count; secMsg.x = 140; addChild(secMsg); } public function timerListener(e:TimerEvent):void { if (count <= 60) { secMsg.text = count; count++; } } } } |
|
|||||
|
Регистрация: Jun 2008
Адрес: пока еще здесь
Сообщений: 198
|
Цитата:
http://flash-world.ru/flash_tutorial...nscript_3.html http://www.flasher.ru/forum/archive/.../t-117544.html
__________________
флэшь проела плешь |
|
|||||
|
Регистрация: Aug 2010
Сообщений: 13
|
оформил вот так :
но теперь зависает в чем может быть проблема ? mylib.as package { import flash.display.*; import flash.text.*; public class mylib extends Sprite { public var secMsg:TextField; public var player:Number = myFun(7); public function mylib() { stage.frameRate = 30; secMsg = new TextField(); secMsg.autoSize = TextFieldAutoSize.LEFT; secMsg.text = String(player); secMsg.x = 140; addChild(secMsg); } } } package { import flash.utils.*; import flash.events.*; import flash.text.*; public function myFun(count:Number):Number { var secMsg:TextField; var count:Number; var timer:Timer = new Timer(1000,0); timer.addEventListener(TimerEvent.TIMER, timerListener); timer.start(); function timerListener(e:TimerEvent):void { if (count <= 60) { secMsg.text = String(count); count++; } } return count; } } Последний раз редактировалось TIЕSTO; 17.08.2010 в 17:20. |
![]() |
![]() |
Часовой пояс GMT +4, время: 00:35. |
|
|
« Предыдущая тема | Следующая тема » |
|
|