Variable in Path

  • vinid3
  • Novice
  • Novice
  • No Avatar
  • Joined: Sep 17, 2009
  • Posts: 17
  • Status: Offline

Post March 31st, 2010, 2:05 pm

Hi everybody!

Im having trouble with a path to create a textfield

here is the scene:

In my level0, I have a movie clip with as instance name 'blablou'

I have it's adress transmitted to a function blablabla...

basically: this is the content of the 'destination' variable: "_level0.blablou" (verified with a trace)

wath i try to do is:

Code: [ Select ]
_level0.blablou.createTextField(instance,100+i,coordX,coordY,boxwidth,boxheight);

this works...
but _level0.blablou must be dynamic of course... so I thaught I would write:

Code: [ Select ]
[destination]createTextField(instance,100+i,coordX,coordY,boxwidth,boxheight);
_root[destination][instance].text = contenttext;
  1. [destination]createTextField(instance,100+i,coordX,coordY,boxwidth,boxheight);
  2. _root[destination][instance].text = contenttext;


first line creates the textfield, second one fills it in..
strangely enough, this looks to work, BUT the textfields are created in the root, not in the destination movieclip :(

how can I get this to work?
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post March 31st, 2010, 2:05 pm

  • vinid3
  • Novice
  • Novice
  • No Avatar
  • Joined: Sep 17, 2009
  • Posts: 17
  • Status: Offline

Post April 1st, 2010, 1:55 pm

Yes! got it to work..

for records: this is the solution:

eval([destination]).createTextField(instance,100+i,coordX,coordY,boxwidth,boxheight);
eval([destination+"."+instance]).text = contenttext;
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Joined: Jul 11, 2005
  • Posts: 1828
  • Loc: In the Great White North
  • Status: Offline

Post April 5th, 2010, 3:14 pm

Glad you got it working. Dynamic instance names are a pretty big mess in Flash so thank you for posting your solution. I'm sure may other people will find it useful.
If at first you don't succeed F1... If that doesn't work try Google!
//// Designer, Developer & Teacher - Interactive, Motion and 3D \\\\
Portfolio at WhenImNotSleeping.com

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 50 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.