dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Camera Simulation | Listbox troubles

  1. #1
    Member ghost_flash's Avatar
    Join Date
    Apr 2003
    Location
    United States
    Posts
    98

    Camera Simulation | Listbox troubles

    Hi everyone:

    I'm creating a camera simulator, very basic to illustrate the dependency between f-stop (Amount of light allowed in) and the shutter speed (The amount of time the shutter allows light to enter).

    My problem is, I have two listboxes and am not finding a way to make the selections communicate with each other.

    I will set up all the combinations of photos for each allowed setting but how do I commuicate this and load the proper swf file to the corresponding selections?

    Here is a mockup of my simulator.

    Camera Simulation | f-stop / shutter speed

    Thanks in advance!

  2. #2
    Senior Member
    Join Date
    Aug 2003
    Posts
    163
    Those are combo boxes right? Well one way is to give both of your combo boxes unique instance names. then give each label a different data value in the combo box. Through action script you can find which value are selected in both of the combo boxes. For example:

    2 combo boxes named combo1 and combo2

    fstop = combo1.getValue()
    speed = combo2.getValue()

    if(fstop == 1){
    if(speed ==1){
    load whatever movie you want.
    }
    if(speed == 2){
    load a different movie
    }
    .
    .
    .
    .
    }
    if(stop ==2 ){
    if( speed ==1){
    load whatever.
    }
    }
    etc.

    You are going to have a lot of if statements for each option, but it should get the job done.

    good luck

  3. #3
    Member
    Join Date
    Aug 2003
    Location
    Portland, OR
    Posts
    42
    Another way to do this is to name the SWFs in such a way that you can create the file name by concatenating the values from the list boxes. For example name a SWF 28_100.swf and build the name using openPicture = eval(combo1.getValue() + "_" + combo2.getValue()+".swf"); etc. Then use loadMovie(openPicture) to open the SWF. Of course the variable names can be what you want. I use a similar technique quite often to dynamically load SWFs into a host movie. I hope this helps. I plan on adding a similar device to my site in the not too distant future and will use this technique.

    Originally posted by Treylok
    Those are combo boxes right? Well one way is to give both of your combo boxes unique instance names. then give each label a different data value in the combo box. Through action script you can find which value are selected in both of the combo boxes. For example:

    2 combo boxes named combo1 and combo2

    fstop = combo1.getValue()
    speed = combo2.getValue()

    if(fstop == 1){
    if(speed ==1){
    load whatever movie you want.
    }
    if(speed == 2){
    load a different movie
    }
    .
    .
    .
    .
    }
    if(stop ==2 ){
    if( speed ==1){
    load whatever.
    }
    }
    etc.

    You are going to have a lot of if statements for each option, but it should get the job done.

    good luck

  4. #4
    Member ghost_flash's Avatar
    Join Date
    Apr 2003
    Location
    United States
    Posts
    98
    Originally posted by Treylok
    Those are combo boxes right? Well one way is to give both of your combo boxes unique instance names. then give each label a different data value in the combo box. Through action script you can find which value are selected in both of the combo boxes. For example:

    2 combo boxes named combo1 and combo2

    fstop = combo1.getValue()
    speed = combo2.getValue()

    if(fstop == 1){
    if(speed ==1){
    load whatever movie you want.
    }
    if(speed == 2){
    load a different movie
    }
    .
    .
    .
    .
    }
    if(stop ==2 ){
    if( speed ==1){
    load whatever.
    }
    }
    etc.

    You are going to have a lot of if statements for each option, but it should get the job done.

    good luck
    Thank you very much!
    I tried looking up how to do just this on Macromedia's site... ack.

    Regards,
    Mark

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