Skip to main content
February 4, 2012
Answered

Access textField on timeline from an external as file?

  • February 4, 2012
  • 1 reply
  • 1493 views

Hi

I have an external as file. 

I was wondering what I put in it to update a textField I have manually drawn on the stage?

so what I'd normally put in the timeline is:

myField.text = 'tester';

what would you put in an exteranl as file, and do I need to include:

import flash.display.MovieClip;

import flash.display.Stage;

...in the as file too?

Thanks

Shaun

This topic has been closed for replies.
Correct answer kglad

put the same thing if you "include" the as file.  otherwise, if your as file is a class file, the answer depends on how you use your class file.

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
February 4, 2012

put the same thing if you "include" the as file.  otherwise, if your as file is a class file, the answer depends on how you use your class file.

February 4, 2012

Ahh - rookie response coming up...

the as file is called cti.as

in my timeline is

import com.cti;

var cti= new cti();

Does this mean it's a class?

cti.as is doing some text file parsing, initiated with:

csv.load( new URLRequest('test.txt') );

I've set up some pseudo-threading in cti.as, but I'd like to update a text field on the stage with the percentage it's up to.  It seems to all be working, just not the updating of the textField

kglad
Community Expert
Community Expert
February 4, 2012

yes, it's a class.

if your textfield on the same timeline as your import statement and does it exist when you create your cti instance?

p.s.  you shouldn't use the same name for your variable as your class name.