![]() |
|
||||||||||
|
|||||
|
[+4 07.10.08]
|
Начал изучать AS3, и никак не пойму почему не работает...
файл fla: файл examp.as, размещенный в той же папке: package { import flash.text.*; import flash.display.*; public class examp extends Sprite { public function examp() { var f:TextFormat=new TextFormat(); f.font="Tahoma"; var a:TextField=new TextField (); a.type="dynamic"; a.text="Привет"; a.textColor=0xff0000; a.border=true; a.background=true; a.backgroundColor=0x00ff00; a.setTextFormat(f); a.autoSize="left"; addChild(a); var nameText:String; function setNames(nameText) { a.text=nameText; } setNames("Hellow"); } } } 1061: Call to a possibly undefined method setNames through a reference with static type examp. С AS2 знаком... |
|
|||||
|
Регистрация: Apr 2009
Сообщений: 78
|
Эм, а где у вас setNames функция то? В классе что вы привели ее как бы и нет
|
|
|||||
|
...
модератор форума
Регистрация: Sep 2006
Адрес: Minsk
Сообщений: 4,286
|
package { import flash.text.*; import flash.display.*; public class Examp extends Sprite { public function Examp() { super(); var f:TextFormat = new TextFormat(); f.font = "Tahoma"; a = new TextField(); a.type = "dynamic"; a.text = "Привет"; a.textColor = 0xff0000; a.border = true; a.background = true; a.backgroundColor = 0x00ff00; a.setTextFormat(f); a.defaultTextFormat = f; a.autoSize = TextFieldAutoSize.LEFT; addChild(a); setNames("Hellow"); } private var a:TextField; public function setNames(nameText:String):void { a.text = nameText; } } } Цитата:
|
![]() |
![]() |
Часовой пояс GMT +4, время: 01:37. |
|
|
« Предыдущая тема | Следующая тема » |
|
|