Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Extensions and Plugins > Components

Reply
 
Thread Tools Rate Thread Display Modes
Old 04-30-2001, 09:11 PM   #1
20 Ton Squirrel
Risu Oyabun!
 
20 Ton Squirrel's Avatar
 
Join Date: Apr 2001
Location: Houston, Texas
Posts: 1,460
Question

I'm trying to create a menu bar that dynamically creates content based on data found in an array declared on the root. The object that does this is a movie clip called listbox that contains another movie clip called item. Still with me? Okay, the item contains a dynamic text field and a button. The text field is tied to a variable called txt. It looks a bit like this:

root -> listbox -> item -> text field & button

When the menu needs to be populated, it runs the following function that's written in the listbox movieclip:

function populate(list) {
var i;
for (i = 1; i <= list.length; i++) {
duplicateMovieClip("itm", "itm_" + i, i + 1);
setProperty("itm_" + i, _x, 0);
setProperty("itm_" + i, _y, 18.5 * i);
set ("itm_" + i + ".txt", list[a-1]);
}
}

The function runs through and dupes the movie clips, positioning them properly with setProperty. It does not set the txt variable, though... and it's drivin' me crazy trying to figure out WHY!!! I've tried changing the set statement to:
["itm_" + i].txt = list[a-1];
Alas, it was to no avail! Any thoughts, curses, comments on the matter would be _greatly_ appreciated.

THANKS!!!

[Edited by 20 Ton Squirrel on 04-30-2001 at 04:43 PM]
20 Ton Squirrel is offline   Reply With Quote
Old 04-30-2001, 10:13 PM   #2
mgb
New Member
 
Join Date: Jan 2001
Posts: 245
Default

If your array is on the root you need;

set ("itm_" + i + ".txt", _root.list[a-1]);

or;

eval("itm_"+i+"txt")=_root.list[a-1];

~mgb
mgb is offline   Reply With Quote
Old 04-30-2001, 10:22 PM   #3
20 Ton Squirrel
Risu Oyabun!
 
20 Ton Squirrel's Avatar
 
Join Date: Apr 2001
Location: Houston, Texas
Posts: 1,460
Default

The script is actually a function that accepts an array as an argument. So the "populate" function is actually called from the root using the array as the argument. Should I really be referencing the variable back to the root? It's called like this...

who = new Array("Jay", "Silent Bob", "Dante Hicks");
listbox.populate(who);

I know it gets the array correctly because it actually dupes the movie clips and places them correctly. Am I totally off base on this?

Dazed and confused,
Squirrel

20 Ton Squirrel is offline   Reply With Quote
Old 04-30-2001, 11:57 PM   #4
mgb
New Member
 
Join Date: Jan 2001
Posts: 245
Default

Ok I see what you are doing now. If your array is on the root you might be better to just use;

set ("_root.listbox.itm_" + i + ".txt"... = _root.who[a-1];

without sending the argument to it.

N.B. should itm not be item?

~mgb

[Edited by mgb on 04-30-2001 at 08:26 PM]
mgb is offline   Reply With Quote
Old 05-02-2001, 03:56 PM   #5
20 Ton Squirrel
Risu Oyabun!
 
20 Ton Squirrel's Avatar
 
Join Date: Apr 2001
Location: Houston, Texas
Posts: 1,460
Default

The spelling on itm is correct. I'm weird like that! I tried your recommendation and still no dice.

I suppose the best way of explaining my goal here is to site example. Check out
http://www.were-here.com/forum/tutor...enu/index.html
There is a tutorial I found that is basically what I'm trying to do... except that it was written in Flash4 and I'm trying to just dupe movie clips and change the text based on an array.
20 Ton Squirrel is offline   Reply With Quote
Old 05-03-2001, 05:18 PM   #6
mgb
New Member
 
Join Date: Jan 2001
Posts: 245
Default

Try;

_root["listbox.itm_" + i ].txt= _root.who[a-1];

~mgb
mgb is offline   Reply With Quote
Old 05-31-2001, 12:51 PM   #7
Tilly
Registered User
 
Join Date: May 2001
Location: Groningen, Netherlands
Posts: 65
Lightbulb Are you using a mask?

Quote:
Originally posted by 20 Ton Squirrel
The spelling on itm is correct. I'm weird like that! I tried your recommendation and still no dice.

Are you using a mask to partly cover your textfields? That will explain why your textfields aren't visible, because masking dynamic text will not work :-(
You can check in the 'List Variables' screen if your textfields are filled correctly (so a least you can check if your code is ok).

Hope this helps,

Tilly
Tilly 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 03:45 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.