Combobox - selected item value?

  • Hi!
    I am trying to costruct mediaplayer for my panos. Would like to allow changing background music. Used combobox for music selection, and direct sellection works.

    Code
    <action name="setupitems">
            removeall();
            additem(Subirana - Point of no return, playsound(s1,pnr.mp3, 0,0); );
            additem(Silence - Realite, playsound(s1,02.mp3, 0,0); );
        </action>

    But now my mute/play button started to be a problem.

    Disabling sound is not a problem, but reenabling it is...

    Here is my play button action:

    Code
    <plugin name="soundon"  url="btn_audioon.png"  visible="false" align="bottom" edge="center" y="40" x="+120" blendmode="screen" onhover="showtext(Włącz dźwięk);"      onover="set(blendmode,add);"  onout="set(blendmode,screen);" onclick="playsound(s1,pnr.mp3, 0,0); set(plugin[soundoff].visible,true); set(plugin[soundon].visible,false);" />

    It plays arbitrary file, but I would like to play what is selected in combobox.
    Is it possible to access/execute actions assigned to actually selected combobox from within xml?

    Whole project you can see here: http://www.fototv.pl/newsy/wydarzen…lektrownia.html

    Hmmm, will think about using stack.

    Regards

  • I think the problem is here...

    Code
    ...playsound(s1,pnr.mp3, 0,0);
    ...playsound(s1,02.mp3, 0,0);

    ... in that you've used the same ID for both mp3 files... perhaps it's causing some confusion?

    (reference info: http://www.krpano.com/forum/wbb/inde…ad&threadID=374 )

    Also, I don't think you need to include the last 0 in the sequence (ID, file, looping, oncomplete) as both looping and oncomplete are optional.

    ------------

    If that doesn't fix it... then you may have to look at setting up the combobox to assign a value to a variable based upon which selection is made... and then use a sequence of if's to determine which actual mp3 to play.

    There's a similar example on the forum showing how to load different images / panos based upon a sequence of if's to check the variable... but I'm not finding it right now.

  • hello radioerawan... bro.. your resolution setting at the minimal? lower than 16? the image rendering not that smooth.. im also use sphere, but the image size for my pano is about lower than 2Mb and bigger than 1.5Mb with the image dimension 6324 x 3162...

    so certain zoom are not that worst..

  • As I understand ID is for "track/channel". I need one channel/track at a time, and need one ID (to be able to control its loudness and play/stop). In such way, will not disable environmental sound - which would like to use in future (without using stopallsounds). Music plays without problems now. Just would like to have little more advanced music on/off option. Now every time music is stopped, it has to start from first track. Would like to start from what was selected in combobox.
    So - once again - would like to read selected state of combobox to be able to palysound (anyid, combobox-selectedstate).
    Loop is set to 0 (to do looping).

    Regards

  • hello radioerawan... bro.. your resolution setting at the minimal? lower than 16? the image rendering not that smooth.. im also use sphere, but the image size for my pano is about lower than 2Mb and bigger than 1.5Mb with the image dimension 6324 x 3162...

    so certain zoom are not that worst..


    It is offtopic, but 30 panos x 6000x3000 px in good quality would kill my server. Now I am using 4500x2250 sources px with quality set to 70 in PS - Save for web. It is still 70 megabytes of data for 30 panos. Count it against 10.000+ visits to this project only I had last week. It is 700 GB of transfer to handle. In 6000 px version it should be doubled. User experience would fail and I am not sure, it would be good for Lost power plant.

    Regards

  • http://www.krpano.com/forum/wbb/inde…D=2075#post2075

    that post that might help.


    If you setup your combobox...

    Code
    <action name="setupitems">
    removeall();
    additem(Subirana - Point of no return, set(var_sound,1); );
    additem(Silence - Realite, set(var_sound,2); );
        </action>

    and then do something like...

    Code
    <action name="startsong">
      <!-- depending on the "var_sound" variable play a song -->
      if(var_sound == 1, playsound(s1,first.mp3, 0,0) );
      if(var_sound== 2, playsound(s1,sec.mp3, 0,0) );
      if(var_sound== 3, playsound(s1,thrd.mp3, 0,0) );
      if(var_sound== 4, playsound(s1,etc.mp3, 0,0) );
    </action>

    ... for your play sound button.

    Good luck.

  • Hmm, have seen also "switch" in 1.0.8 teaser, but it is beta version. Have been trying to run panos in 1.0.8 but context menu works at random order.
    So, is "if" statement available for stable 1.0.7?
    Can I define variable this way: set(var_my_foo,anything_here)?

    Sorry for my newbie questions, just purchased krpano and I am learning how can use it.

    Code
    <action name="setupitems">
    removeall();
    additem(Subirana - Point of no return, set(var_sound,music1.mp3); );
    additem(Silence - Realite, set(var_sound,music2.mp3); );
        </action>
    <action name="startsong">
      <!-- depending on the "var_sound" variable play a song -->
       playsound(s1,var_sound, 0,0) );
    </action>


    Should work then, but have seen in documentation that variables are only predefined with plugins...

    Regards

  • Have managed it all. Now have player with playlist and sound on/off option
    If you find any better solution, would be nice to hear. Had to use currentpano variable - var_sound returned errors.
    Here goes code:

    Not nice, but works! Just one glitch - had to use 1.0.8 beta.

    Regards

  • glad you got something that works.

    sorry about "var_sound" not working... maybe the underscore _ isn't a good thing to use ?

    If having "currentpano" is confusing due to it's implied reference to an image... maybe "currentsound" in it's place would work?

    There's bound to be some way to clean the code up some... I'll try to take a look over the next couple of days and let you know if I have any flashes of brilliance *g*

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!