PDA

View Full Version : NoobAlert: dynamically-created object referencing


mojosmoke
06-09-2008, 03:19 PM
Long-time Flash user, new Actionscript student, so please forgive my forum invasion with what is probably a simple-answer type of question.

If I drop instances directly on the stage, I can access and modify their attributes and built-in functions just fine by referring to the instance name I specified.

However, if I use the constructor to make and position a group of objects at runtime, later attempts to reference or modify those objects by name generate an "Access of undefined property ..." error. I can modify the names in a loop within the constructor and trace their names to verify, but no luck actually accessing them. Am I missing something? (Other than a couple of months of reading, studying, implementing, and experimenting)

Thanks for any direction!

senocular
06-09-2008, 03:43 PM
When you place movie clips on the timeline, Flash secretly makes the variables based on your instance names and sets their values to reference the movie clips there. When you make movie clips through ActionScript, it's your job to manage the variables used to reference those movie clips. Your error all depends on the code you're using to do this.