Skip to content

Commit

Permalink
Added misc plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
fieldOfView committed Apr 29, 2011
1 parent 3a81ea1 commit 77fce73
Show file tree
Hide file tree
Showing 11 changed files with 479 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ <h2><a name="plugins" href="#plugins" class="selflink">Plugins</a></h2>
<dd>A plugin that uses the gyroscope in devices such as the iPhone 4 and iPad2 to control the view.</dd>
<dt><a name="imageadjust" href="imageadjust/plugin.html">imageadjust</a><span class="flashhtml5">for Flash</span></dt>
<dd>A plugin that lets you adjust the brightness/contrast, hue/saturation and blur of the view.</dt>
<dt><a name="misc" href="misc/plugin.html">misc</a><span class="flashhtml5">for Flash & HTML5</span></dt>
<dd>A plugin that adds miscelaneous functionalities to krpano which do not fit in with any of the other plugins in the package.</dd>
<dt><a name="orientation" href="orientation/plugin.html">orientation</a><span class="flashhtml5">for HTML5</span></dt>
<dd>A plugin that detects changes in the device orientation so the tour can, for example, adjust its interface to either landscape or portrait displays.</dd>
<dt><a name="string" href="string/plugin.html">string</a><span class="flashhtml5">for Flash & HTML5</span></dt>
Expand Down
11 changes: 11 additions & 0 deletions misc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
misc plugin for KRPanoJS
by Aldo Hoeben / fieldOfView.com
http://fieldofview.github.com/krpano_fovplugins/misc/plugin.html
This software can be used free of charge and the source code is available under a Creative Commons Attribution license:
http://creativecommons.org/licenses/by/3.0/
*/

var krpanoplugin=function(){var b=this,d=null,c=null;b.registerplugin=function(g,f,h){d=g;c=h;if(d.version<"1.0.8.14"||d.build<"2011-03-30"){d.trace(3,"misc plugin - too old krpano version (min. 1.0.8.14)");return}c.forloop=a;c.abs=e};b.unloadplugin=function(){c=null;d=null};function e(g,f){d.set(g,Math.abs(f))}function a(k,i,g,f,h){i=parseFloat(i);g=parseFloat(g);f=parseFloat(f);if(h==""||f==0){return}var j=i;d.set(k,j);while((f>0&&j<=g)||(f<0&&j>=g)){d.call(h);j+=f;d.set(k,j)}d.set(k,g)}};

Binary file added misc.swf
Binary file not shown.
30 changes: 30 additions & 0 deletions misc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
krpano misc plugin
=======================

A krpano plugin that provides some miscelaneous scripting
functionalities that do not fit in with any of the other plugins
in the package.

* `for(varName, startValue, endValue, stepValue, iterate)`
Iterates the actions/function specified by 'iterate' while setting the variable 'varName' from 'startValue'
until it reaches 'endValue' in steps set by 'stepValue'.
* `abs(destVar, value)`
Sets destVar to the absolute value of 'value'.

How to build
------------

To build the plugins from the supplied source files, you need the
[open source Flex SDK](http://opensource.adobe.com/wiki/display/flexsdk/Flex+SDK), version 3.2 or newer.

To compile misc.swf, use the following commandline options
(in a single line):
mxmlc -target-player=10.0.0 -use-network=false -static-link-runtime-shared-libraries=true misc.as


License
-------

The plugins can be used free of charge and the source code is
available under a [Creative Commons Attribution](http://creativecommons.org/licenses/by/3.0/) license.

30 changes: 30 additions & 0 deletions misc/examples/misc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<html>
<head>
<title>fieldofview krpano plugins - misc plugin example</title>
<style>
body{ font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#FFFFFF; background-color:#000000; margin:0; padding:0; }
* html, * html body{ overflow: hidden; }
a{ color:#AAAAAA; text-decoration:underline; }
a:hover{ color:#FFFFFF; text-decoration:underline; }
</style>
</head>
<body>

<div id="krpanoDIV">
<noscript><table width="100%" height="100%"><tr valign="middle"><td><center>ERROR:<br><br>Javascript not activated<br><br></center></td></tr></table></noscript>
</div>

<script type="text/javascript" src="../../../swfkrpano.js"></script>

<script type="text/javascript">
// <![CDATA[

var swf = createswf("../../../krpano.swf", "krpanoSWFObject", "100%", "100%");
swf.addVariable("xml", "misc.xml");
swf.embed("krpanoDIV");

// ]]>
</script>

</body>
</html>
14 changes: 14 additions & 0 deletions misc/examples/misc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<krpano version="1.0.8" onstart="test-misc">
<preview type="grid(cube,16,16,512,0xCCCCCC,0xFFFFFF,0x999999);" details="16" />

<plugin name="misc" url="../../misc.swf" alturl="../../misc.js" preload="true" />

<action name="test-misc">
showlog();
plugin[misc].forloop(i, -3, 2, 0.8,
plugin[misc].abs(j,get(i));
roundval(j,1);
trace(j);
);
</action>
</krpano>
2 changes: 2 additions & 0 deletions misc/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mxmlc -target-player=10.0.0 -use-network=false -static-link-runtime-shared-libraries=true -output=..\misc.swf source\misc.as
pause
145 changes: 145 additions & 0 deletions misc/plugin.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<!-- krpano plugin page template -->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="format-detection" content="telephone=no" />
<title>krpano.com - Plugins - fieldOfView Plugins - misc</title>
<link rel="stylesheet" type="text/css" media="screen" href="http://krpano.com/design/design.css"/>
<link rel="stylesheet" type="text/css" media="print" href="http://krpano.com/design/print.css"/>
<link rel="SHORTCUT ICON" href="http://krpano.com/design/shortcut.ico"/>
</head>
<body>
<div id="krpano_root">
<div id="krpano_headerwrapper">
<div id="krpano_header">
<div id="krpano_langsel">&nbsp;</div>
<div id="krpano_mainmenu">&nbsp;</div>
</div>
</div>
<div>
<div id="krpano_imagebar"></div>
<div id="krpano_logo"></div>
</div>
<div id="krpano_imagebar_space"></div>
<div id="krpano_contentwrapper">
<div id="krpano_content">
<div id="krpano_contentnav">
<h2><a href="/krpano_fovplugins" class="selflink">fovplugins</a></h2>
<p>This is the staging area for the fieldOfView plugins for krpano. A copy of these pages is included on krpano.com. The pages in this staging area may be newer than the respective pages on krpano.com.</p>
<ul>
<li><a href="http://krpano.com/plugins/userplugins/fieldofview">offical krpano.com pages</a></li>
<li><a href="https://github.com/fieldofview/krpano_fovplugins">source repository</a></li>
</ul>
</div>
<a name="top"></a>
<div id="krpano_contenttext">
<!-- USER CONTENT STARTS HERE -->

<h1>Misc Plugin <span class="pluginfilename">misc.swf</span>
<span class="flashhtml5">for Flash &amp; HTML5</span>
<div class="pluginautor">by Aldo Hoeben - <a href="http://fieldofview.com">fieldofview.com</a></div>
</h1>
<div class="paragraph">
<h2><a name="description" href="#description" class="selflink">Description</a></h2>
<p>This plugin provides some miscelaneous scripting
functionalities that do not fit in with any of the other plugins
in the package. The plugin is intended to go obsolete if and when krpano itself implements these functionalities.</p>
</div>
<div class="paragraph">
<h2><a name="download" href="#download" class="selflink">Download</a></h2>
<div class="dlitem"> <a href="http://fieldofview.github.com/krpano_fovplugins/misc.swf">misc.swf</a>&nbsp; <small>(plugin only)</small></div>
<div class="dlitem"> <a href="http://fieldofview.github.com/krpano_fovplugins/misc.js">misc.js</a>&nbsp; <small>(plugin only)</small></div>
<p>The misc plugin <a href="https://github.com/fieldOfView/krpano_fovplugins/tree/master/misc">sources and examples</a> are available as part of the fovplugins package</p>
<div class="dlitem"> <a href="https://github.com/fieldOfView/krpano_fovplugins/zipball/master">fovplugins.zip</a>&nbsp; <small>(plugin, source code &amp; examples)</small><br/>
</div>
</div>
<div class="paragraph">
<h2><a name="forum" href="#forum" class="selflink">krpano Forum Discussion Thread</a></h2>
<a href="http://krpano.com/forum/wbb/index.php?page=Thread&threadID=4972">Misc Plugin Thread</a> </div>
<div class="paragraph">
<h2><a name="syntax" href="#syntax" class="selflink">Syntax / XML Usage Example</a></h2>
<pre class="xmlpre">&lt;<a href="http://krpano.com/docu/xml/#plugin">plugin</a> <a href="http://krpano.com/docu/xml/#plugin.name">name</a>="misc"
<a href="http://krpano.com/docu/xml/#plugin.url">url</a>="misc.swf" <a href="http://krpano.com/docu/xml/#plugin.alturl">alturl</a>="misc.js"
<a href="http://krpano.com/docu/xml/#plugin.keep">keep</a>="true" <a href="http://krpano.com/docu/xml/#plugin.preload">preload</a>="true"
/&gt;

&lt;<a href="http://krpano.com/docu/xml/#action">action</a> <a href="http://krpano.com/docu/xml/#action.name">name</a>="use_misc" &gt;
plugin[misc].<a href="#text" class="pluginattrib">forloop</a>(i, 0, 10, 1,
plugin[misc].<a href="#text" class="pluginattrib">abs</a>(j,get(i));
roundval(j,1);
trace(j);
);
&lt;/<a href="http://krpano.com/docu/xml/#action">action</a>&gt;</pre>
</div>
<div class="paragraph">
<h2><a name="methods" href="#methods" class="selflink">Plugin Methods</a></h2>
<dl>
<dt><a name="forloop" href="#forloop" class="selflink">forloop</a>(varName, startValue, endValue, stepValue, iterate)</dt>
<dd>Iterates the actions/function specified by 'iterate' while setting the variable
'varName' from 'startValue' until it reaches 'endValue' in steps set by 'stepValue'.</dd>
<dt><a name="abs" href="#abs" class="selflink">abs</a>(destVar, value)</dt>
<dd>Sets destVar to the absolute value of 'text'.</dd>
</dl>
</div>
<div class="paragraph">
<h2><a name="example" href="#example" class="selflink">Example</a></h2>
<script>
function showexample()
{
var iframe = '<iframe id="ccexample" name="ccframe" src="examples/misc.html" width="100%" height="300" scrolling="no" marginheight="0" marginwidth="0" frameborder="0"></iframe>';
document.getElementById("example").innerHTML = iframe;
}
</script>
<div id="example" onclick="showexample();" style="width:100%;height:300px;color:white;background-color:black;border:1px solid gray;cursor:pointer;">
<table width="100%" height="100%" style="color:white;">
<tr valign="middle">
<td><center>
<b>CLICK TO VIEW EXAMPLE</b>
</center></td>
</tr>
</table>
</div>
</div>
<div class="paragraph">
<h2><a name="license" href="#license" class="selflink">License</a></h2>
<p><a href="http://creativecommons.org/licenses/by/3.0/"><img src="http://i.creativecommons.org/l/by/3.0/88x31.png" alt="CC-BY-3.0" width="88px" height="31px" hspace="8" border="0" align="right"></a> The plugin can be used free of charge, in commercial or non-commercial applications. The source code is available under a <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution</a> license.</p>
<p>In a nutshell, this means you are free to use the software and its source code in your projects. If you use the source code in another software project, you are required to add attribution to the author(s). You are encouraged to share the your source code under a similar fashion, but it is not a requirement.</p>
<p><form action="https://www.paypal.com/cgi-bin/webscr" method="post" style="float:right;margin:0 8px;">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="KZEYXA3FSY6PQ">
<input type="image" src="http://files.fieldofview.com/paypal-donate-button.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/i/scr/pixel.gif" width="1" height="1">
</form> If you use the plugins regularly, you may consider making a donation so I can afford to continue making these plugins and making them available.</p>
</div>
<!-- USER CONTENT ENDS HERE -->
</div>
</div>
</div>
<div id="krpano_footerwrapper">
<div id="krpano_footer">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td align="right">Copyright &copy; 2011 krpano.com</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://logs.fieldofview.com/" : "http://logs.fieldofview.com/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 4);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://logs.fieldofview.com/piwik.php?idsite=4" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->
</body>
</html>
57 changes: 57 additions & 0 deletions misc/source/krpano_as3_interface.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
AS3 Interface for krpano
1.0.7
--
krpano.com
*/

package
{
public class krpano_as3_interface
{
public static var instance:krpano_as3_interface = null;


public function krpano_as3_interface()
{
}


public static function getInstance():krpano_as3_interface
{
if (instance == null)
{
instance = new krpano_as3_interface();
}

return instance;
}



// krpano interface
public var set : Function = null;
public var get : Function = null;
public var call : Function = null;
public var trace : Function = null;


// trace constants
static public const STARTDEBUGMODE : int = 0xFF;
static public const DEBUG : int = 0; // DEBUG messages are only shown when DEBUGMODE is on
static public const INFO : int = 1;
static public const WARNING : int = 2;
static public const ERROR : int = 3;


// plugin interface constants
static public const PLUGINEVENT_REGISTER : String = "krpano.registerplugin";
static public const PLUGINEVENT_RESIZE : String = "krpano.resizeplugin";
static public const PLUGINEVENT_UPDATE : String = "krpano.updateplugin";


// add/remove plugin event listeners
public var addPluginEventListener : Function = null;
public var removePluginEventListener : Function = null;
}
}
Loading

0 comments on commit 77fce73

Please sign in to comment.