get the size of the screen

  • hello,
    I want to use scrolling thumbnails which opens a textfield that has a photo and some text which if the photo is clicked opens a panorama.
    everything is working but I do not know the size of the screen and the thumbnail size is in pixels. I think the textfield can be a percentage but cannot be sure.
    If I knew the size of the display then I could use maths presumably to get the sizes so the bottom of the text field just touches the thumbs.Probably it is simple. how can I find the size of the screen ?

    cheers
    mick

  • Hi,

    yes, the pixelsize of the current full window can be readed via the "stagewidth" and "stageheight" variables,
    and the pixelsize of the current pano area can be readed via "area.pixelwidth" and "area.pixelheight",

    to size elements individually based on these values the "onresize" event can be used,

    e.g.

    best regards,
    Klaus

  • I can't understand *cry* the image goes bigger than the screen whatever size I make it. or if I use a calculation in the plugin
    latest fumble

  • can anyone see why the test works ok locally but not when I upload it ?
    http://www.mickiwiki.com/pages/GraganEast2.xml
    http://www.mickiwiki.com/pages/GraganEast2.html
    cheers
    mick

    [edit] I think it might be something with the plugin, only the leftmost thumbnail seems to start to do something (show the textfield) then nothing works.
    [edit] it's not the thumbnail plugin http://www.mickiwiki.com/pages/GraganEast3.html

    has a hotspot which does the same thing and that doesn't work either *unsure* must be something simple but I can't see it.

  • Hi mick,

    On your code you have this:

    Code
    <events onresize="customresize();"/>
    
    
    <action name="customresize">
      trace('xxxxxxxxxxxxxx','areasize = ', area.pixelwidth, 'x', area.pixelheight);
    </action>

    The trace action returns this:

    Code
    INFO: krpano 1.0.8 beta 8 (build 2009-06-15)
    INFO: Flashplayer WIN 10,0,42,34 PlugIn
    INFO: registered to: michael crane
    INFO: xxxxxxxxxxxxxxareasize = area.pixelwidthxarea.pixelheight


    note: INFO: xxxxxxxxxxxxxxareasize = area.pixelwidthxarea.pixelheight
    It seems that area.pixelwidth and area.pixelheight are not defined... I supose that is because no area is defined...

    So, I think the problem is on your show_html_field() action... in lines 10 and 11:


    At the end of the tween (line 9) you try to set the height and width of the plugin with values that are strings instead of numbers... Tha's why the plugin disappear...

    Try using stageheight instead of area.pixelheight in line 10...

    SAlut.

  • Hi mick,

    your data code:

    Code
    <data name="htmldata1">
    <a href="event:action(hidewindow);">
    <img src="../images/burren/0001b.jpg" width="plugin[htmltext].width" height="plugin[htmltext].height"/>
    </a>
    <p/>
    </data>

    Try using get():

    Code
    <data name="htmldata1">
     <a href="event:action(hidewindow);">
     <img src="../images/burren/0001b.jpg" width="get(plugin[htmltext].width)" height="get(plugin[htmltext].height)"/>
     </a>
     <p/>
     </data>

    SAlut.

  • Hi mick,

    Then, it seems that variables inside a <data> node are not resolved....
    So, I think you have to set the content of your <data> node dinamicaly to be able to include the value of a variable...
    Try to call this action inside <krpano onstart=>:



    edited: wrong code... see next post...

    SAlut.

    Edited once, last by michel (March 6, 2010 at 11:50 PM).

  • I will try what you suggest yet I am concerned that I am easily going to loose understanding and not be able to carry on myself.
    at present for testing just the size I load the same image each time into the textfield. but looking at the next step I think I need a way to just load another image into the textfield ?
    and then that image is a link to load a new panorama in the background.
    and the scrolling thumbnails should be constant.
    probably that is done with scenes ? and can I declare a variable in the <action name="load1"> in the .xml and conditionally load a different image in the textfield ?
    I can as in previous tests write down every option but a smarter understanding would be good.

  • Hi mick,

    The code above is wrong... malformed and missing values for plugin[htmltext].height and width...
    here is corrected:

    Code
    <action name="build_htmldata1">
    	sub(plugin[htmltext].height,stageheight,150);
    	mul(plugin[htmltext].width, plugin[htmltext].height,0.666667);
    	txtadd(data[htmldata1].content,,'<a href="event:action(hidewindow);"> <img src="../images/burren/0001b.jpg" width="',get(plugin[htmltext].width),'" height="',get(plugin[htmltext].height),'" /></a><p/>');
    	trace('data[htmldata1].content = ', get(data[htmldata1].content));
    </action>


    I have tried and it works...

    One question about what you are looking to do: did you need to use the textfield.swf plugin to display your images for some reason???

    Anyway, I like your idea of a show of flora inside your pano. *thumbup*

    SAlut.

  • Hi mick,

    You can just use a plugin with, in the url , your image to be displayed instead of the textfield.swf plugin...
    This would be more easy to implement for what you are looking to do...
    In each action to load the next image, you just have to set the correct image to the url...

    Code
    set(plugin[image].url,path_to_your_image)

    SAlut.

  • Hi mick,

    Here your code modified the way explained above:

    Some notes:
    line 76-83 - The plugin[htmltext] becomes a simple plugin without url value...
    line 82 - onloaded (when loading of the plugin is done) the action set_plugin_width_height() is called...
    line 85-88 - action set_plugin_width_height(), to set the needed values for width and height of the plugin[htmltext]...
    line 35-74 - actions called from each Thumbs. Each action sets the plugin[htmltext].url value with the path to the needed image...
    line 33 - an onresize event that calls the action set_plugin_width_height() on a resizing of the window....

    I Hopes this is clear... *smile*

    SAlut.

  • Hi,

    Quote

    krpano 1.0.8 beta 8 (build 2009-06-15)

    Quote

    note: INFO: xxxxxxxxxxxxxxareasize = area.pixelwidthxarea.pixelheight
    It seems that area.pixelwidth and area.pixelheight are not defined... I supose that is because no area is defined...


    right, the <area> tag is new since beta 9, but the older beta 8 version was used


    Quote

    width="plugin[htmltext].width"
    width="get(plugin[htmltext].width)"

    Quote

    it seems that variables inside a <data> node are not resolved....


    static definitions in the xml like above are never resolved/parsed,
    dynamic code can be only used in events and actions,


    for a bit more complex image gallery maybe have a look at the
    "image gallery" example (included in the download package)

    https://krpano.com/examples/108b9…agegallery.html


    xml-files:
    https://krpano.com/examples/108b9…magegallery.xml
    https://krpano.com/examples/108b9…ry/thumbbar.xml

    it checks for the current screen size when showing the images, and if an image is
    larger it will be scaled down to fit inside the screen,

    best regards,
    Klaus

  • right, the <area> tag is new since beta 9, but the older beta 8 version was used

    hmmm, I seem to have put beta 8 swf into beta 9 foder.
    your imagegallery is certainly smarter( I 'll use that )
    a tiny refinement would be to close the image if clicking again where the thumbnail was.
    [edit]
    where can I change the end position of the image ?
    tween(plugin[%1].x,0);
    tween(plugin[%1].y,0);
    doesn't seem to


    cheers

    mick

Participate now!

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