Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textfield using Instance & Variable names!

Status
Not open for further replies.

KiwiJor

Technical User
Oct 22, 2003
15
TH
Often wondered why it was so difficult at times to address a dynamic textField correctly, MacroMedia

have a technicial article on the subject :


1. open Flash MX - set new document properties to width=205, height=60,
background color=FFFFFF, fps=12, click "OK"

2. In layer1 frame1 Actions place the following
code:

// Create textfield instance name= "myInstText"
// Level1, x=20, y=20, width= 165, height= 20
_root.createTextField("myInstText",1,20,20,165,20);

// Make it Dynamic
myInstText.type = "dynamic";

// Give it a variable name as well
myInstText.variable = "myVarText";

// Set initial variable string
myVarText = "First I'll use the Variable Name"

// Now wander along to Frame 10

3. In layer1 frame10 insert a keyframe [F6] then in Actions place the following
code:

// Now to set the Instance string
myInstText.text = "Now I'll use the Instance Name"

4. In layer1 frame 20 insert a blank frame [F5]

note: there is no 'stop();' action, the movie loops round
and round so you can see the changing text ;-)

5. Save as "whatever.fla" and Test Movie [Ctrl Enter]

Still Baffled? write me

kiwiJor ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top