Using switch when changing button URL - problem

  • Hi all, and of course our master, Klaus. :)

    I have a problem with one of my buttons. The code below doesn't change the button like it should..?

    To be precise:

    Code
    onclick="switch(plugin[rotate].url,buttons/btn_stop.png,buttons/btn_rotate.png);"

    It stops the autorotate as it should but the button url changing doesn't work. Have I done something wrong? :)

    Here's the pano url: http://panoraamakuvat.fi/kuvat/turku/ko…rtuaaliesittely

    And the XML:
    http://panoraamakuvat.fi/asiakkaat/Jyrk…ly_20090625.xml

    Note: The plugin rotate is in this file:
    http://panoraamakuvat.fi/asiakkaat/panoraamakuvatfi.xml

    I'm using the latest beta, build 15.6.2009, 1.0.8b8

    EDIT 29.06.2009:
    the URLs above has got currenlty an alternative solution. The problem URLs are here:

    http://panoraamakuvat.fi/kuvat/krpano/button-switch-problem

    http://www.panoraamakuvat.fi/asiakkaat/J…ton_problem.xml

    http://www.panoraamakuvat.fi/asiakkaat/p…ton_problem.xml

  • Hi Joekki,

    It seems that there is a new line on your xml code that make the switch(plugin[rotate].url,buttons/btn_stop.png,buttons/btn_rotate.png); to not work....like this:

    Code
    switch(plugin
    [rotate].url,buttons/btn_stop.png,buttons/btn_rotate.png);


    changing this, makes your code works as expected.

    Hope this can help. *wink*

    Salut.

    Edited: the new line was because I copy/paste the plugin and this copy has a new line after plugin (like show above) and this cause the switch(plugin[rotate] .... not working !!!

    Edited 2 times, last by michel (June 28, 2009 at 9:03 PM).

  • Hi joekki,

    You are right...
    Your plugin[rotate] must work well as is !!!
    I think, it must be a malformed xml format...
    If you open your xml file directly on the url , you can see an error alert ... *confused*
    http://panoraamakuvat.fi/asiakkaat/panoraamakuvatfi.xml

    I do not understand what it is exactly (I'm not a Pro)... if somebody knows please explain us why *rolleyes*

    Try to put a <krpano> tag at the beginning of your xml and a </krpano> tag a the end.
    Doing so, the error alert disappear *attention*

    Hope this can help.

    Salut.

  • hi joekki,

    I am really sorry to not be of help... *cry*

    I try and try again to understand but i can't see what it would be.

    Your plugin[rotate] works as expected ... I think it is not the cause...
    I have tried the following:

    I use the krpano-1.0.8-beta8\examples\littleplanet example as a base...
    I put on the xml file littleplanet.xml your plugin[rotate] with no change...
    I have added a folder buttons into the littleplanet folder with a copy of your to buttons btn_stop.png and btn_rotate.png

    AND IT WORK... *whistling*

    Then I do not understand what it can be..SORRY... *wacko*

    I noticed that the panoraamakuvatfi.xml it is included many times... perhaps this can be the cause... *whistling*

    Edited: I noticed this to -- INFO: krpano 1.0.8 beta 8 (build 2009-06-04) - Try with the last version (build 2009-06-15)

    If I see something more , I will tell you.

    Salut.

    Edited 4 times, last by michel (June 28, 2009 at 7:51 PM).

  • Hi Joekki,

    Try this URL:http://panoraamakuvat.fi/asiakkaat/krpa…y_20090625.xml&
    It is a direct access to your page and this way it WORKS *attention*
    Then there is no problem on the files you use with Krpano. They all works like you expect. *attention*

    It must be an other thing But I do not know what it is. *cursing* *wacko*

    His there anybody out there?
    Graydon where are you... you always have the good words to explain things. *g*

    Hope this can help.

    Salut.

  • Hi joekki,

    You know what ??? With the direct link acces above all is working ELSE the switch(fullscreen) action *attention* *attention* *attention*
    I have tried the plugin[fullscreen] itself and ... it works normally *attention* so what it is happening here *question*
    The only thing I see is there is no ; after the onclick="switch(fullscreen);" but locally it is working without this, so.

    Really confused *wacko* I am going to sleep *wink* perhaps tomorrow *smile*

    Salut.

  • *thumbsup* WOW, you have really put effort on solving this issue!! huh.. Thank you for that!! *rolleyes*

    A very strange thing was that http://panoraamakuvat.fi/asiakkaat/krpa…ly_20090625.xml works, but the fullscreen doesn't work now. I have no clue either of the reason what could cause this. I fixed the ';' after the fullscreen switch but no help.

    I even removed the extra includes in every scene and there were no help with that action.. (I put the includes back, I have to fix something first before doing that - I don't remember what was it but I'll check. :D )

  • Hi,

    the fullscreen mode must be enabled explicitly via a parameter ("allowFullscreen") in the HTML file,
    this is a security restriction from Flash,

    when using the a direct link to a swf this parameter can't be set,
    this is the reason why the fullscreen mode is not working in this case,

    best regards,
    Klaus

  • when using the a direct link to a swf this parameter can't be set,
    this is the reason why the fullscreen mode is not working in this case,

    best regards,
    Klaus

    Hi Klaus and thanks for solving the security issues of flash, again. :D,

    but this leads us to the first question, why the rotate button won't change to another when clicking it in URL http://panoraamakuvat.fi/kuvat/turku/ko…rtuaaliesittely

    Code
    <plugin name="rotate" url="buttons/btn_stop.png" align="bottom" edge="center" y="30" x="90" onhover="showtext(Pysäytä automaattinen pyöriminen / Jatka pyörimistä,infostyle)" blendmode="screen" onclick="switch(plugin[rotate].url,buttons/btn_stop.png,buttons/btn_rotate.png);switch(autorotate.enabled);" onover="set(plugin[rotate].blendmode,add);" onout="set(plugin[rotate].blendmode,screen);" keep="true" alpha="0.7" width="40" height="prop"/>

    It works via direct swf URLhttp://panoraamakuvat.fi/asiakkaat/krpano.swf?pano=Jyrkkalanpolku_virtuaaliesittely_20090625.xml</a> but not via original url with html?

  • Hi Joekki,

    I am thinking on some kind of path issue...
    So perhaps you can try to put the entire path to the btn_rotate.png like this:

    Code
    onclick="switch(plugin[rotate].url,buttons/btn_stop.png,http://panoraamakuvat.fi/asiakkaat/buttons/btn_rotate.png);switch(autorotate.enabled);"


    Try it to see what's append. *whistling*

    Hope this can help. *wink*

    Salut.

  • Hi Joekki,

    I am thinking on some kind of path issue...
    So perhaps you can try to put the entire path to the btn_rotate.png like this:

    Code
    onclick="switch(plugin[rotate].url,buttons/btn_stop.png,http://panoraamakuvat.fi/asiakkaat/buttons/btn_rotate.png);switch(autorotate.enabled);"


    Try it to see what's append. *whistling*

    Hope this can help. *wink*

    Salut.

    Hi Michel!

    Sorry, no help. *wacko*

    <plugin name="rotate" url="buttons/btn_stop.png" align="bottom" edge="center" y="30" x="90" onhover="showtext(Pysäytä automaattinen pyöriminen / Jatka pyörimistä,infostyle)" blendmode="screen" onclick="switch(plugin[rotate].url,buttons/btn_stop.png,http://panoraamakuvat.fi/asiakkaat/buttons/btn_rotate.png);switch(autorotate.enabled);" onover="set(plugin[rotate].blendmode,add);" onout="set(plugin[rotate].blendmode,screen);" keep="true" alpha="0.7" width="40" height="prop"/>

    ... I'm out of ideas. i'm thinking that it has something to do with the html because it worked dicrectly with the swf & xml combination.

  • Hi Joekki,

    I have tried locally with a modified html based on your one:

    And.......... IT WORKS *attention* *confused*

    Then, like you said before it seems to be something in the HTML....

    So, I'm speculating that the problem perhaps have some relation to a path issue... *huh*
    Perhaps it comes because of the <base href="http://panoraamakuvat.fi/" /> ...
    Perhaps it is your URL http://panoraamakuvat.fi/kuvat/turku/ko…rtuaaliesittely
    and the path to yours xml files that are 3 step below the URL,
    http://panoraamakuvat.fi/asiakkaat/Jyrk…ly_20090625.xml
    and http://panoraamakuvat.fi/asiakkaat/panoraamakuvatfi.xml

    I really don't know, I'm not en expert, but something make me fill that the problem it is around this... *huh*

    Try with full path to your files, like this:

    Code
    if (typeof(deconcept) !== 'undefined' && deconcept.SWFObjectUtil.getPlayerVersion().major >= 6)
    	{
    		var so = new SWFObject("http://panoraamakuvat.fi/asiakkaat/krpano.swf", "krpanoSWFObject", "100%", "100%", "9.0.28","#000000");
    		so.addParam("allowFullScreen","true");
    		so.addVariable("pano", "http://panoraamakuvat.fi/asiakkaat/Jyrkkalanpolku_virtuaaliesittely_20090625.xml");
    		so.useExpressInstall("http://panoraamakuvat.fi/asiakkaat/swfobject/expressinstall.swf");
    		so.setAttribute("xiRedirectUrl", window.location);
    		if ( so.write("krpano") ) { var mousewheelfixes = new SWFkrpanoMouseWheel(so); }
    	}


    if it those not work, try to erase the <base href="http://panoraamakuvat.fi/" /> to see what's append...

    Step by step we are going to catch it... *wink*

    Salut.


  • Try with full path to your files, like this:

    Code
    if (typeof(deconcept) !== 'undefined' && deconcept.SWFObjectUtil.getPlayerVersion().major >= 6)
    	{
    		var so = new SWFObject("http://panoraamakuvat.fi/asiakkaat/krpano.swf", "krpanoSWFObject", "100%", "100%", "9.0.28","#000000");
    		so.addParam("allowFullScreen","true");
    		so.addVariable("pano", "http://panoraamakuvat.fi/asiakkaat/Jyrkkalanpolku_virtuaaliesittely_20090625.xml");
    		so.useExpressInstall("http://panoraamakuvat.fi/asiakkaat/swfobject/expressinstall.swf");
    		so.setAttribute("xiRedirectUrl", window.location);
    		if ( so.write("krpano") ) { var mousewheelfixes = new SWFkrpanoMouseWheel(so); }
    	}


    if it those not work, try to erase the <base href="http://panoraamakuvat.fi/" /> to see what's append...

    Step by step we are going to catch it... *wink*

    Salut.

    Hi Michel again :)

    I have tried everything, with full paths (domain + folder + file), with and without the base href without any luck. I found another solution for this from Any way to swap one button for another on an event other than fullscreen?

    So this at least works if everything else fails:

    I have made extra URL for the non working version of the buttons here:

    http://panoraamakuvat.fi/kuvat/krpano/button-switch-problem
    http://www.panoraamakuvat.fi/asiakkaat/Jyrk…ton_problem.xml
    http://www.panoraamakuvat.fi/asiakkaat/pano…ton_problem.xml

  • I have tried locally with a modified html based on your one:

    And.......... IT WORKS *attention* *confused*

    Huh,
    I tried the same myself, and like you said, it worked...??? What's going one? Is it a security thing of the Flash again or what? I just copied the source code to index.html to my desktop with all the files and renamed those, and it worked.. I guess I have to double check the paths, like you said earlier.

    NOTE: if you guys are testing with locally, and with external XML URLs, you have to notice that I changed the URLs to the ones I mentioned one post above.

  • Hi Joekki,

    Good job. *thumbup* At least you got a way to solve your problem. *attention*

    Sorry not to have found why the switch action does not work on your original. *thumbdown*
    It is really strange. I would like to really know the reason. *w00t*
    The question Using switch when changing button URL - problem is not solved... *cry*

    Perhaps somebody out there can tell us the solution
    *question* *smile*

    At least we got some good time in grating the head. *thumbsup*

    Salut.

  • Hi,

    yes, it was a path problem,

    normally the BASE path is the path where the html is located,
    but when there is no html file then the location of the swf is the BASE path,

    now the problem - the "url" attributes in the xml are automatically made
    relative to the xml itself! this is the reason why the normal buttons/images work in both cases,

    BUT - the dynamically changed "url" attributes are NOT automatically made relative to any XML file (because the dynamic code could be locatted in a other XML), they are relative to the BASE path (the path of the HTML or the SWF in your example),

    a way to make also the dynamic "url" paths relative is to use the "placerholders",
    e.g.

    Code
    set(plugin[name].url, %SWFPATH%/buttons/image.jpg);

    %SWFPATH% is always the path of the krpano.swf file,
    this can be used to have always the full correct url, regardless of the BASE path,

    I hope I could clear that a little bit

    best regards,
    Klaus

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!