Groups | Blog | Home
all groups > flash data integration > january 2005 >

flash data integration : Need XML conponent to change variables


rabblerouser
1/27/2005 1:39:06 AM
I have an application that reads XML data to populate a List Component and a
Text Area Component. (This is based on a tutorial at Macromedia DevNet
(http://www.macromedia.com/devnet/mx/flash/articles/xmlconnector.html) When an
item in the list component is selected, it populates the text area component
with a the contents of a 'description' node in the XML file. This works fine...
But I would also like it to set two variables at the root level of the main
movie. The variables are defined as nodes ('linkID' and 'rootvar') in the XML
file. I'm unsure of how to make this happen but I know it must be a simple
solution. I've attached the files for reference... I'm just trying to add some
functionality. The files are located here:
http://www.rabblerouser.com/clients/listVarTest.zip Any ideas? Thanks in
advance.
rabblerouser
1/27/2005 3:58:54 PM
Let me eloborate a bit more what I want this to do: Basically, when the user
selects one of the items in the list, I want the dot to the left to blink. The
dot is a movieClip with a ClipEvent (onEnterframe) that when the variable at
the root level is set to 'blink' it goes to the next frame where the dot
blinks. The variable 'blink' is defined as a node in the XML (called
'rootvar'). Eventually, I'm going to have multiple dots on the stage and each
list item is going to make it's coordinating dot blink in the application.
It's kind of a simple problem, select an item on the list, it's dot to the left
blinks.... I think I'm on the right path, I'm just new to using the XML
connector with the list component, so could use any advice. Thanks again...
Pilipo
1/29/2005 7:43:33 PM
Hey Rabblerouser,

Here is a sample of how you could do this. There are many ways to go about it.
I chose this one...

http://www.kalalau.org/MMForums/linktest_6_phil.zip

It basically creates 2 event listeners. The first gets the xml from the xml
connector and creates a circle_mc for each tour.
The second traps a user's selection and tells the circles whether to blink or
not. Not sure what you wanted to do with linkID but you don't need rootvar
anymore... the ActionScript takes care of telling the circles to blink or not.
Hope it gets you on your way...
rabblerouser
1/30/2005 11:35:36 PM
Thanks so much for your help, Philipo, I really appreciate it. The way this is
going to be applied is as such: the dots will be placed (manually) over cities
on the state of Ohio. When a user clicks the city name in the list, the dot
above the city is supposed to blink. It will unfortunately not work to
dynamically place the dots on the stage. There will be buttons on top of the
dots that when clicked, will take users to an ASP page that is determined by
the linkID variable, also at the root level. Therefore, the value of the
'linkID' variable has to be changed by the list component as well as the
'blink' variable. So really, all I need is the ability to have the list
component items change the variables, not have the event listener create MCs on
the stage. Is this more complicated or not? BTW, I posted a newer version to
illustrate how this is supposed to apply:
http://www.rabblerouser.com/clients/listtest_7_phil.fla.zip
Pilipo
1/31/2005 8:09:52 PM
Actually, I still think you could do all this dynamically. Much cleaner! You
don't need rootvar and you don't need to place buttons on the circles. The
circle_mc can be its own button. In fact, I would simply replace rootvar in the
xml with two more parameters, an x and y that represent the map location of the
circle for that city.

Here is a link to it:

http://www.kalalau.org/MMForums/listtest_8_phil.zip

The buttons are smart and when rolled over, they automatically select the
right tour in the listbox and textarea as well as begin blinking, and a click
will simulate a call to HTML using the Output window showing the LinkID of that
tour. I changed the XML to remove rootvar and put in coordinates of the tour.

To find the position in pixels of any new tour, just drag a circle_mc to the
stage, place it and look at the x/y. Put those values in the XML and delete the
circle_mc from the stage.

Great job getting all the components bound and working! This kind of setup
lets you do all the work in the XML instead of the FLA. When you add a tour,
just change the XML, no need to recompile the FLA.
rabblerouser
2/1/2005 2:03:04 AM
Phil: This is brilliant... thank you again for your help. One final question:
On the circle_MC, there is an MC on the 3rd layer, second frame. This is
supposed to be a label that gives the location of the place on the map where it
is. It's currently controlled with a clip event that was supposed to read the
variable on the root level. Now that it is gone, I'm wondering how we could
have the label pop up on the map as well. I now know how to place an MC on the
map based on the coordinates in the XML file, but how would I get the MC to go
to the correct frame so it displays the correct info? I uploaded the latest
file. If you have time to look at it... if not, I greatly appreciate your help.
I have a much better understanding of binding XML thanks to you!
http://www.rabblerouser.com/clients/listtest_9_phil.zip
Pilipo
2/1/2005 3:39:35 AM
OK, there is now a movieclip in the circle_mc called caption_mc that has a
label and a background for the label. When you roll over, the caption fades in.
When others rollover, the old caption fades out as the new caption fades in.
Feel free to mess - I'm not a designer!!!!

http://www.kalalau.org/mmforums/listtest_10_phil.zip

Thanks for the kind words - take care...

rabblerouser
2/1/2005 12:25:06 PM
Great... I can go from here. Just wondering... when I look in the Components
Inspector, all of the bindings and schema are wiped out. Did you remove that
info and hand code everything in the first frame? Thanks again...
Pilipo
2/1/2005 5:05:14 PM
rabblerouser
2/1/2005 7:39:13 PM
AddThis Social Bookmark Button