Sie sind nicht angemeldet.

Shanti

Fortgeschrittener

  • »Shanti« ist der Autor dieses Themas

Beiträge: 301

Wohnort: Puerto Vallarta

Beruf: Web Developer

  • Nachricht senden

1

Freitag, 6. März 2009, 02:02

Scaling a plugin automatically

Ok, I am working (modifiying) on a plug-in but when i resize the browser window, everything scales EXCEPT this plugin... does anyone know why?

I tried adding:

stage.scaleMode = StageScaleMode.SHOW_ALL;

to the AS3 and also removing it.

this will make Krpano not work correctly (for some odd reason)

the plugin scales when used alone, but once inside krpano it does not work, if I re size the window the plugion stays the same.

btw, I also tried the scale in the xml, but it will scale it, just not autoscale it :P
any ideas?

EDIT: Actually no plugins autoscale, is this not possible?

Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »Shanti« (6. März 2009, 02:28)


2

Freitag, 6. März 2009, 13:06

Hi,

the Flash stage scaleMode shouldn't be changed! - this could give very bad results

to scale a plugin with the screensize use percent (%) values for the "width" or "height" attributes,
width="100%" is the full screenwidth and height="100%" the full screenheight,
for proportional scaling set one value to "PROP",

e.g.

Quellcode

1
<plugin .... width="10%" height="PROP" />


if you want to notice this resizes in the plugin add a RESIZE EVENT in the as3 code,

best regards,
Klaus

Shanti

Fortgeschrittener

  • »Shanti« ist der Autor dieses Themas

Beiträge: 301

Wohnort: Puerto Vallarta

Beruf: Web Developer

  • Nachricht senden

3

Freitag, 6. März 2009, 19:05

Thanks Klaus, that worked!

except when I use height="PROP" the plugin dissapears :(

EDIT: Nevermind, its "prop" lowercase :)

Thanks!

4

Samstag, 7. März 2009, 11:09

ohhh
right! only lowercase works at the moment
in the next version the case will be ignored

5

Mittwoch, 11. Mai 2011, 10:27

I need help

this attributes
<plugin .... width="10%" height="PROP" />
i need as3 code plz

6

Mittwoch, 11. Mai 2011, 15:10

Hi,
this attributes
<plugin .... width="10%" height="PROP" />
i need as3 code plz
what do you mean or what do you want to do?

best regards,
Klaus

7

Samstag, 2. November 2013, 14:03

Resize with max-size 100% of stage?

Hi,
I have an intro image that is about 500px tall. I want it to be scale="1.0" however with a maximum size of 100% of stage/window.
Because when viewing it in the facebook feed which makes the "window" pretty small, the intro image is bigger than the window.

Is this possible? In a CSS world it would probably be max-size:100%; but I guess this isn't compatible with krpano's xml.

Anyone?

Beiträge: 1 857

Beruf: Virtual Tours - Photography - Krpano developer

  • Nachricht senden

8

Samstag, 2. November 2013, 15:43

height="100%" width="prop"
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

9

Samstag, 2. November 2013, 15:51

height="100%" width="prop"

But doesn't that make the image's height 100% of the window even when in fullscreen?
I want it to to be 500px tall (height) when it fits, but when the window is resized smaller than 500px I want it to start to resize to 100% height. Maybe I suck at explaining:P

Beiträge: 770

Wohnort: Russian Federation

Beruf: Interpreting, Building virtual tours

  • Nachricht senden

10

Samstag, 2. November 2013, 18:59

Hi!

What if apply an event:

Quellcode

1
2
<events name="scale_plugin" onresize="if(plugin[your_image].imageheight GT stageheight, set(plugin[your_image].height, 95%); set(plugin[your_image].width, prop);  );"
/>
Regards,

Alexey

11

Samstag, 2. November 2013, 19:23

Hi!

What if apply an event:

Quellcode

1
2
<events name="scale_plugin" onresize="if(plugin[your_image].imageheight GT stageheight, set(plugin[your_image].height, 95%); set(plugin[your_image].width, prop);  );"
/>


Works like a charm, Thanks Alexey!
This easy function could be a feature request for a new max-height="100%" property.

12

Donnerstag, 7. November 2013, 19:57

any ideas on how to GET the computed value of "prop" ?
I use

Quellcode

1
2
3
<layer name="T_MONUMENT" url="" align="topleft" edge="topleft" x="0%" width="50%" height="prop"  />
set(buttonH, get(layer[T_MONUMENT].height));
trace(buttonH);


and get just "prop" when tracing the vaule of buttonH...

(I want the actual computed prop value to use it in other actions)

13

Donnerstag, 7. November 2013, 21:54

My idea is to calculate this value. You can use original image dimensions and current known width or height to calculate:
In general proportions is kept, so: originalW : original H = ScaledW : ScaledH

If scaledW is prop and can't be read than: ScaledW = originalW * ScaledH / originalH

Tested code:

Quellcode

1
2
3
4
5
6
set(scaledH,  get(plugin[your_plugin].height));   <!-- trace('scaledH:',get(scaledH));-->
set(originalH,get(plugin[your_plugin].imageheight)); <!-- trace('originalH:',originalH);-->   
set(originalW,get(plugin[your_plugin].imagewidth));  <!-- trace('originalW:',originalW); -->   
   
mul(calculatedH,originalW,scaledH); div(calculatedH,originalH);
trace('calculatedH:',get(calculatedH));

14

Freitag, 8. November 2013, 00:03

this works just fine !

i only had to transform my % values to pixel using stagewidth before using your approach. ( i like to design using percent values to keep the interface responsive...)

Now i can place responsive buttons in both directions when designing my interface

*smile*

thanx Umalo

danimorgo

Anfänger

Beiträge: 42

Wohnort: argentina

Beruf: diseñador

  • Nachricht senden

15

Freitag, 21. März 2014, 10:07

not working

someone could post an example,
I try to resize the image, and keep the proportions to scale the window.
regards

16

Samstag, 29. März 2014, 22:19

This will be enough for landscape oriented images to add to your event list:
<events name="scale_plugin" onresize="if(plugin[your_image].imageheight GT stageheight, set(plugin[your_image].height, 95%); set(plugin[your_image].width, prop); );"/>

17

Montag, 1. Dezember 2014, 01:00

Hi,
I have the same problem where my intro image is bigger than the scene area when viewing the pano on the facebook feed.

This is my code for my intro image:

Quellcode

1
2
3
4
5
6
7
8
9
<!--  INTRO IMAGE  -->
<plugin name="introimage" HasBeenPlayed="false" keep="true" url="skin/Click-N-Drag_icon.png" align="center" onclick="hideintroimage();" onloaded="autohideintroimage();" scale="1"/>
<action name="hideintroimage">
if(plugin[introimage].enabled,	set(plugin[introimage].enabled,false);tween(plugin[introimage].alpha, 0.0, 0.5, default, removeplugin(introimage)););
</action>
<action name="autohideintroimage">
if(plugin[introimage].HasBeenPlayed == false, set(plugin[introimage].alpha,0); tween(plugin[introimage].alpha,1.0,WAIT); delayedcall(5, hideintroimage()); set(plugin[introimage].HasBeenPlayed,true);	);
</action>
<!--  END INTRO IMAGE  -->


And I tried to insert the following and some modifications to it, both before and after the above code, but without any success:

Quellcode

1
<events name="scale_plugin" onresize="if(plugin[introimage].imageheight GT stageheight, set(plugin[introimage].height, 95%); set(plugin[introimage].width, prop);  );" />


The attached image is what it looks like in the facebook feed, and the red circle is to illustrate how big the image is to see that it's bigger than the stage.

Anyone got any idea how to solve it?
Thanks guys! :)
»pear« hat folgendes Bild angehängt:
  • krpano_problem_maxsize100procent.jpg

18

Montag, 1. Dezember 2014, 10:31

Try something like

Quellcode

1
<events name="scale_plugin" onresize="if(plugin[introimage].imageheight GT stageheight, set(plugin[introimage].height, 95%); set(plugin[introimage].width, prop); , set(plugin[introimage].width, 95%); set(plugin[introimage].height, prop); );" />

19

Montag, 1. Dezember 2014, 17:42

Or investigate and adapt your code based on this solution:
http://krpano.com/forum/wbb/index.php?pa…52835#post52835
regards
Umalo

Ähnliche Themen