PDA

View Full Version : What is the best way to handle these linkable items from database?


salex2
03-08-2001, 03:29 PM
In a nutshell:

I have a Database of U.S. locations with various details associated to each one; an ASP page for interfacing with the Database and sending variables back to Flash; and the Flash movie.

Process: The user clicks a particular button in the movie, which sends the ASP page parameters to pull certain data from database. The results are formatted into variables and sent to the movie.

Currently I send all location names (passed as locNames) to one large text field, one per line. However, I need to be able to click on a location name and replace the locations text field with the details for the selected location (passed as locDetails).

What is the best way to accomplish this?

Thank you in advance.
~A~

Jesse
03-09-2001, 02:16 AM
I would have a text field (with an embede font) in an MC on the main stage. Then my buttons would call up the relevant data from the database and set the variable in the text field to the value of that data, then I'd set the visibility of that text filed to true.

Then I'd make each of the locations a button inside an MC and make their MC name the equivalent location's database name. Then you could hva ecode a bit like this on each button:

on (release) {
loadVariablesNum ("page.asp?location=" + _name, 0);
}

So if I clicked the MC called 'australia' it would load
page.asp?location=australia
and page.asp formats the data and passes it back.

Cheers

Jesse

salex2
03-09-2001, 02:45 AM
Thanks for the tips - the next step is...

Now that I have location buttons on stage, they need to be clickable so that when selected, the details for that location fill a text box (also passed via ASP when state is clicked initially).

How do I attach a dynamic link to the location textfield button??

Again - THANKS!
~A~

Jesse
03-09-2001, 05:20 AM
That's why I said to label the state movie clips by name. Then if you have a state clip with an instance name 'Idaho' (I don't know anything about US geogrphy... maybe that aint a state, this code:

on (release) {
loadVariablesNum ("page.asp?location=" + _name, 0);
}

on a button within that 'idaho' clip will result in this call:
page.asp?location=idaho
See the '_name' element takes the instance name of the clip your button is in.

Cheers

Jesse

salex2
03-09-2001, 08:15 PM
Okay - I am following. The only catch is that there are multiple locations, the number of which is dynamic, in each state.

When the User clicks a state (Idaho, for example), the movie moves to the Locations frame and the list of location names are all that appear, in their own textboxes labelled "Location1", "Location 2", etc (I am using a preset number of locations - 6, don't know how to create the text fields on the fly, in position yet...can u help on that?). The next step is to have each location be clickable, as a button, and when the user clicks that location, the movie goes to a "details" frame with that locations details inserted into a textfield named "details"...or something.

I can't figure out the way to dynamically set the "hyperlink" for each of the Location buttons...what code do I need to pass each textfield-button to make it populate the "details" item in the details frame?

Jesse - you have been a great help. I apologize if some of this is rudimentary...I'm doing my best.

Thanks in advance.
~A~

Jesse
03-10-2001, 03:40 AM
Umm OK I'm assuming this is laid out like a map and maybe you have red dots in each state to signify the locations that can be clicked or something... what you're going to need to do is soemthing like this.

Each state is an MC.
Each red dot is a button inside and MC and the MC's name is the name of the location.

The code on each red dot button should be that code I mentioned before:

on (release) {
_root.loadVariablesNum ("page.asp?location=" + _name, 0);
}

Each red dot button could also have a text field in it which shows the variable 'locatioName' or something, and you could have this code int he first frame of the MC.

this.locationName = _name;

This will make it such that each red button has a txt field showing it's name, and also has a link which, when clicked will oad up the appropriate data...

Cheers

Jesse