Groups | Blog | Home
all groups > flash actionscript > october 2004 >

flash actionscript : Attach movie, best pactice


thoand
10/17/2004 3:56:10 PM
Hi,
Can anyone here explain why my attached movie won't show

I am loading an XML file with city data, and this data I want to present in
dynamic text fields using a loop
after each city I need a line (from my library with linkage name
"cityDivider").
But I can't see my line anywhere, do I do something wrong?
please see attached code

hope anyone have som answers,
Thanks in advance.

best regards T


// Create textfield, and insert data

cityMC = resultHolder.createEmptyMovieClip("cityMC", 1);

// Store some variables
cityMC.x = cityX;
cityMC.y = cityY;
cityMC.city = city;
cityMC.cityMap = cityMap;

cityMC.createTextField("_city",1,0,0,scWidth,textFieldHeight);
cityMC._city.text = city.toUpperCase();
cityMC._city.setTextFormat(boldFieldFormat);
cityMC.onRelease = function() {
// Some action
}

// Attach my line after the city
var div = cityMC.attachMovie("cityDivider", "cityDivider2", 5);
div._width = 100;
div._height = 100;
kglad
10/17/2004 4:28:09 PM
thoand
10/17/2004 4:40:15 PM
It is not the text with city that disapears

What I need to to is:
Create a movieclip, inside this moviclip create a textfield

resultHolder[0].cityMC._city.text = "SF";
resultHolder[1].cityMC._city.text = "NY";
resultHolder[2].cityMC._city.text = "LA";

since the text field depth is 1, I should be able to attach my movie at depth
5?
I've tried that, and nothing disapears, and if I say that my div(line) MC
should be height = 100
It is 100px between each city textfield, but I can't see the line, tried with
squares to:)

I find creating textfields dynamicly quite difficult in Flash, especially when
I need a lot of them

Maybe I should create som templates, eg. MC with my textfields and attach them
in my loop
and put the data in those predefined textfields, woud'nt that be much cleaner?

Or are there some pitfalls here:)

best regards Thomas






kglad
10/17/2004 5:15:26 PM
it probably doesn't matter which depths you use for your movieclip and your
textfield as long as they are different.

if you want to create a horizontal line through your textfield you'll need to
assign a string of dashes to your textfield or make your textfield html-enabled
and use an jpg image of a horizontal line in your textfield.
AddThis Social Bookmark Button