Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 09-26-2005, 02:17 PM   #1
SCook
Senior Member
 
Join Date: Nov 2004
Posts: 269
Default Accessing objects within dynamically added objects

Hi gang,

Here's what I need to do: I add an object to the stage via AS. This object has a dynamic text field in it called txt1. Now, as I add the object on the main MC, I also want to set the text for that textfield (txt1) inside. Now, this text is from an array, so I can't just set a var in the textfield itself becuase I am adding multiple instances of this one dynamic object.

I hope that wasn't too confusing. Here's some code:
ActionScript Code:
stop(); vars = new LoadVars(); vars.action = "events"; vars.sendAndLoad(_root.url + _root.directory + _root.file, vars, "post"); vars.onLoad = function() {     eventID = vars.eID.split("|");     eventName = vars.eN.split("|");     eventDate = vars.eD.split("|");     eventFlyer = vars.eF.split("|");     eventCount = eventID.length - 1;         addEventButtons(); } function addEventButtons() {     yPos = -214;         for (i = 0; i < eventCount; i++) {         this.attachMovie("evList", "e" + i, i);         this["e" + i]._x = -349;         this["e" + i]._y = yPos;         this["e" + i].txt1.text = eventDate[i] + "\n" + eventName[i];         yPos += 60;     } }

I hope this is clear, thanks guys
SCook is offline   Reply With Quote
Old 09-26-2005, 02:21 PM   #2
finchou
not working
 
finchou's Avatar
 
Join Date: May 2005
Location: Paris
Posts: 514
Default

this should work, il there is really a textfield name txt1 inside evList, and if you embedded the fonts...
finchou is offline   Reply With Quote
Old 09-26-2005, 02:25 PM   #3
SCook
Senior Member
 
Join Date: Nov 2004
Posts: 269
Default

The only thing that might be wierd about this, is that the evList object is a button object. However, this really shouldn't matter.
SCook is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:14 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.