Error code in Actions Script for Animate
hello. i'm digital art teacher , have been using tutorials website create animate files. unfortunately 1 of tutorials causing error of students. following code directed use , how create actions frame.
package
{
import
flash.utils.timer;
import
flash.text.textfield;
import
flash.events.timerevent;
public
class
typefx {
private
var
timer:timer;
private
var
text:
string
;
private
var
pos:
int
=
0
;
private
var
field:textfield;
public
function
typefx(field:textfield, speed:
int
=
42
, text:
string
=
null
) {
// constructor code
this
.field = field;
if
(text !=
null
)
{
this
.text = text;
}
else
{
this
.text = field.text;
}
field.text =
''
;
timer =
new
timer(speed,
this
.text.length);
timer.addeventlistener(timerevent.timer,update);
timer.addeventlistener(timerevent.timer_complete,kill);
timer.start();
}
private
function
update(e:timerevent):
void
{
pos++;
field.text = text.substr(
0
,pos);
}
private
function
kill(e:timerevent):
void
{
timer.removeeventlistener(timerevent.timer,update);
timer.removeeventlistener(timerevent.timer_complete,kill);
timer.stop();
timer =
null
;
text =
null
;
field =
null
;
}
}
}
on actions frames instructed put following:
new
typefx(textbox_txt);
the error message received following:
scene 1, layer 'actions', frame 1, line 3, column 12 | 1120: access of undefined property textbox_txt. |
there import line may not have shown, like:
import typefx;
that import external typefx.as file showed code for.
the other thing textfield you're going add effects need dynamic textfield, instance name of textbox_txt. selecting textfield on stage, , in properties panel give name.
More discussions in Adobe Animate CC - General
adobe
Comments
Post a Comment