Forum Moderators: open

Message Too Old, No Replies

Dynamic text

Text not appearing within dynamic movie clips

         

catcherintherye51

6:07 pm on Jun 29, 2006 (gmt 0)

10+ Year Member



I've created a small Flash file that places dots on a map using coordinates from an XML file. The actual dots are created from a button called "Dot" with ActionScript linkage.

The dots have rollover action so that when you rollover one of the dots a small box appears above it with the location name. Everything works great, except when you rollover a dot the box appears but no text (box is on one layer of the button, dynamic text layer is above the box layer.)

Here's the XML that creates the dots:

myVilla = new XML();
myVilla.ignoreWhite = true;
myVilla.onLoad = function(success) {
numimages = this.firstChild.childNodes[0].childNodes.length;
for (i=0; i<numimages; i++) {
this.picHolder = this.firstChild.childNodes[0].childNodes[i];
this.thumbHolder = image_tn.createEmptyMovieClip("villa"+i, i);
this.thumbHolder._x = this.picHolder.attributes.cx;
this.thumbHolder._y = this.picHolder.attributes.cy;
this.thumbHolder.picNo=i;
this.thumbLoader = this.thumbHolder.createEmptyMovieClip("villa_image", 0);
this.thumbLoader.attachMovie("Dot", "Dot"+i, this.getNextHighestDepth());
};
};
myVilla.load("villa.xml");

And here's the "villa.xml" file:

<?xml version="1.0" encoding="UTF-8"?>
<gallery>
<album title="Villa Taz" description="Description of Villa " cost="Cost of Villa">
<img cx="50" cy="50" villaname="Villa 1"/>
<img cx="100" cy="100" villaname="Villa 2"/>
<img cx="250" cy="200" villaname="Villa 3"/>
<img cx="300" cy="300" villaname="Villa 4"/>
<img cx="200" cy="300" villaname="Villa 5"/>
</album>
</gallery>

I've tried sticking this in, but it didn't work:
this.thumbholder.villaname_dt.text = this.picHolder.attributes.villaname;

Where "villaname_dt" is the name of the dynamic text box.

Any help would be deeply appreciated. Thanks!

alce

6:21 pm on Jun 29, 2006 (gmt 0)

10+ Year Member



I don't know if this was just typo in your post, but if you copied your code, the problem is in your instance names:

this.thumbholder.villaname_dt.text = this.picHolder.attributes.villaname;

should be

this.thumbHolder.villaname_dt.text = this.picHolder.attributes.villaname;

<edit>
I read your post again and if I understand correctly, the dynamic text box is not in the thumbHolder MC is it?

From what I understand, the path to your dynamic text box should be something like:

this.thumbLoader.Dot.villaname_dt.text
</edit>

[edited by: alce at 6:30 pm (utc) on June 29, 2006]

catcherintherye51

6:24 pm on Jun 29, 2006 (gmt 0)

10+ Year Member



Thanks! I made the change, but still no luck.

Does anythiing else look off?

alce

6:32 pm on Jun 29, 2006 (gmt 0)

10+ Year Member



Double check the path to your dynamic text field. **Have a look at my previous post**

<edit>
ha! scratch that again! I re-read your post and that is not the path either. It is hard for me to keep track of them. Anyway, I believe the text is not appearing because you are not referencing the text field properly.

How's good'ol phoebe? ;)
</edit>

catcherintherye51

7:14 pm on Jun 29, 2006 (gmt 0)

10+ Year Member



Thanks again.

When I reference the text field, since I'm creating a movieclip on the fly (using the "Dot" clip to create a new clip called "Dot1", "Dot2", etc.) should I put the new movieclip name in the script that tells where the XML text should go?

For example, something like:
this.thumbLoader.Dot+i.villaname_dt.text = this.picHolder.attributes.villaname;

I have no clue... The jist is that I need the text in the XML file to appear in the villaname_dt dynamic text field that appears within the Dot movie clip.