A Flash Developer Resource Site

Results 1 to 16 of 16

Thread: Listbox and images

Hybrid View

  1. #1
    Hi. Is there a way to have an "example image".For instance, i want to have a list of people in a listbox and when a person is selected their picture appears, and when i select a different person, the picture changes to that person's picture. any ideas?

  2. #2
    NerdInside's Avatar
    Join Date
    May 2001
    Location
    Penguin Island
    Posts
    3,439
    Make the image a MC and goto different frames based on the data value of each selected item.

    function changeImage() {
    myMC.gotoAndPlay(myCombo.getValue());
    }
    myCombo.addItem("Goto Frame 2", "2");
    myCombo.addItem("Goto Frame 10", "10");
    myCombo.addItem("Goto Frame 5", "5");
    myCombo.addItem("Goto Frame 32", "32");
    myCombo.addItem("Goto Frame 66", "66");

    changeImage is the Change Handler for the listBox. Set the instance of the comboBox to myCombo. myMC is the instance of the MC you are changing the frames of.

    Not test but should work. (doesn't matter if its a combo or list)
    [Edited by NerdInside on 08-11-2002 at 02:40 AM]

  3. #3
    NerdInside's Avatar
    Join Date
    May 2001
    Location
    Penguin Island
    Posts
    3,439
    http://nerdinside.d2g.com/list-MC.fla

    That is a working example IF that is what you are asking for. Once again, slow server

  4. #4
    Thanks, it helped.

  5. #5
    NerdInside's Avatar
    Join Date
    May 2001
    Location
    Penguin Island
    Posts
    3,439
    Or did you mean something like this http://www.macromedia.com/desdev/mx/...omponents.html ?

  6. #6
    no, your first assumption was correct. But I have since encountered a problem. the listbox i applied the text to and everything is already involved in other functions and has a separate changeHandler. when i try to modify the code to fit into the existing function, it doesnt work. It may have something to do w/ the fact that I am putting the code w/in an if statement that is inside the function(which is the listbox's changeHandler).

  7. #7
    NerdInside's Avatar
    Join Date
    May 2001
    Location
    Penguin Island
    Posts
    3,439
    Mine posting your code?

  8. #8
    NerdInside's Avatar
    Join Date
    May 2001
    Location
    Penguin Island
    Posts
    3,439
    Maybe it is a level problem. Maybe _root.myCombo.getValue());

  9. #9
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Are you saying that you have items in your listbox and when you click on it you want many different things activated like load a pic, text in several textboxes, filling a button with a url?

  10. #10
    that is exactly what im tryin to do. Is it possible?

  11. #11
    This is my code. I have a listbox, a combobox, a dynamic textbox and would like to incorporate the image "thingy" mentioned above.:

    //Code to get the link
    function getLink() {
    link = mylistBox.getSelectedItem().data
    if(link == "tweak"){
    getURL("http://tweaktown.com","_blank")}}

    //Code to display the link description
    function displayDescription() {
    link = mylistBox.getSelectedItem().data
    if (link == "tweak") {
    textbox2.text = "This description is being used as a test and is supposed to describe TweakTown.";}}

    //Code to link the listbox and the combobox
    onChange = function () {
    if (mycomboBox.getValue() == "null") {
    mylistBox.removeAll();
    mylistBox.addItem("Please Selected One");
    }

    // The if statement for the mods value
    if (mycomboBox.getValue() == "mods") {
    mylistBox.removeAll();
    mylistBox.addItem("TweakTown", new Object("tweak"));
    }

    // The if statement for the parts value
    if (mycomboBox.getValue() == "parts") {
    mylistBox.removeAll();
    mylistBox.addItem("TigerDirect", new Object("tiger"));
    }

    // The if statement for the year value, showing the data variable is not needed
    if (mycomboBox.getValue() == "flash") {
    mylistBox.removeAll();
    mylistBox.addItem("Flashkit", new Object("fkit"));
    }
    }
    //etc.

  12. #12
    Moderator enpstudios's Avatar
    Join Date
    Jun 2001
    Location
    Tampa, Fl.
    Posts
    11,282
    Download this:

    http://www.flashkit.com/movies/Compo...7605/index.php


    If you have any problems email me:

    flashed@tampabay.rr.com

  13. #13
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    It is possible but you have to use a trick. Have a look here. I can explain later.

    http://www.stormpages.com/cancerinfo.../list_xml.html

  14. #14
    i can already get those components to work, all i have to get working now is the image preview type thing.

  15. #15
    Moderator enpstudios's Avatar
    Join Date
    Jun 2001
    Location
    Tampa, Fl.
    Posts
    11,282

  16. #16
    Thank you. I think that that will help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center