View Full Version : Grid over the entire panorama?
popunonkok
04-25-2009, 10:39 AM
Does anyone have a "Quick fix" for adding a Grid over the entire panorama.
A grid that can be turned on and off.
The reason that I want this is that my custumers might want to talk about a panorama over the telephone and I vant a grid so that they can explain where they are looking.
I havent really given it a try yet Im just in the "thinking" phase now.
So any input would be appreciated.
//Peter
popunonkok
04-27-2009, 07:02 AM
I thought that a transparent grid as a box would work, one for each cubeface that is. But no. The grid getts relly messed up and "twisted".
I thought that something like this would work.
<box id="grid" url="pano/files/grid_0.png" pan="0.00" tilt="0.00" orientation="front" depth="100" />
Any suggestions?
// Peter
jordi
04-27-2009, 09:06 AM
maibe you can try inserting segments to this box, then it's gonna work more properly :
<box id="grid" url="pano/files/grid_0.png" pan="0.00" tilt="0.00" orientation="front" depth="100" segmentsX="4" segmentsY="4" />
try different numbers for segments until you don't see it "twisted"
hope it works
LepLep
04-27-2009, 10:18 AM
panorama already have a pan/tilt grid
load this (http://virtualtromso.no/FPP/reader.zip) as a layer (you must have also hotspots layer to make it work)
enjoy
(im not resposible for any human / bank account details loss caused by using this tiny plugin. use at your own risk ;)
jordi
04-27-2009, 10:35 AM
Hi Lep Lep,
why is this plugin for ??
LepLep
04-27-2009, 10:38 AM
its for popunonkok,
to read pan/tilt
edit:
here is screenshot
http://virtualtromso.no/FPP/reader.jpg
popunonkok
04-27-2009, 11:59 AM
LepLep: That was a beautiful solution! Have you written that plugin? Is it OpenSource? Im quite good at Actionscript 2.0 but havent "converted" to 3.0 but this really gives me a reason to learn some 3.0 basics.
I really like this but would like to modify it so it fits my "style".
Jordi: Yours worked fine aswell, I will look into that more later, but for now I will try to work with LepLeps solution.
Thanks your answers..
//Peter F
allSaints
04-27-2009, 12:05 PM
And if you complement it with a haircross in the center it would be perfect!
Tommy
birdseye
04-27-2009, 12:23 PM
And if you complement it with a haircross in the center it would be perfect!
That would be great !
popunonkok
04-27-2009, 01:11 PM
Yes I already tested it with a Crosshair that one can turn on and off. Now Im just hoping that I can modify this Plugin, otherwise I'll have to try and write one myselfe.
popunonkok
04-29-2009, 10:43 AM
Does anyone know if its a hard thing to code a plugin that shows the direction that one is viewing.
Where shold I start to look for info on programming a plugin like that?
//Peter F
allSaints
04-29-2009, 11:21 AM
Hi Peter,
no, I wouldn't say it's very difficult.
Take a look at my radar/compass plugin on my plugin page (http://wirestam.com/panos/Flash/plugins/).
Regards,
Tommy
LepLep
04-29-2009, 11:24 AM
my plugin was just kind of five minutes work,
if you know basics of AS3 its VERY easy
simple tutorial:
you create plugin .fla from zephyr basic plugin architecture (you can just copy/paste it)
what you are looking for is
panorma.pano.pan
and
panorma.pano.tilt
you create two dynamic text fields on stage of you plugin
you add enterframe event to update you text fields value with new pan/tilt
i dont paste my complete plugin code here (which you can actually rip off with any swf decompiler) because it will not get you any further with your own plugin/coding skills
popunonkok
04-29-2009, 11:34 AM
I was on the right trac then.
Iv goten this to work
function newPano (link:Object) {
pano = link;
_txt.text="Bla Bla Bla Bla";
}
That sets my dynamic textfield to "Bla Bla..." on load.
But I cant get this to work.
function newPano (link:Object) {
pano = link;
_txt.text=panorma.pano.pan;
}
I know Im just getting this on "load pano" now so it won't change as I move but I will gett to that later. The "understanding Basic Flash Panorama Player Plugin Architecture" didnt have a "function enterFrameHandler" so I will look into that later. BUT the "understanding Basic Flash Panorama Player Plugin Architecture" was GREAT!
So the question is why wont I get the starting pan value with the second code?
Thanx for all your answers
popunonkok
04-29-2009, 12:35 PM
New Question! :)
After looking at AllSaints Kompass I saw that he only used pano.pan/pano.tilt. Not Panorama.pano.pan/panorama.pano.tilt.
So, with pano.pan and pano.tilt I got it to work. Yeay!:)
I allso got it to work onEnterFrame.
Thanx for all your help. BUT!
Now It wont show negative numbers. I could understand that I would need som "If" commands to get it to show 0-360 insted of 180 to -180 but if im satisfyed with the "raw" numbers i didnt think I would need that.
Now It shows 0-180 pan and 0-90tilt correct but both the pan and the tilt negativenumbers only show as a "-" minus.
http://www.differentview.se/develop/swfplugin/ <-- The test panorama
Any suggestions?
//Peter F
EDIT: Added a link to the panorama
allSaints
04-29-2009, 12:56 PM
The values you get from FPP are definitely correct, so it must be your way of displaying them that is at fault.
I would suggest integer values (not uint) - the decimals are probably not of interest to anyone
Tommy
panomaster
04-30-2009, 01:28 PM
A few months ago I wrote my own plugin to display such params as pan, tilt and zoom. It's very simple but quite usefull. You can position params window using the same way of positioning as spot object (eg. LT, CM etc.). You can also use x and y offset params for more accurate positioning.
You can watch it at http://itamar.pl/vt/params/.
popunonkok
05-04-2009, 09:57 AM
Now im back! :)
AllSaints: You are probably right about the decimals but I will look inte to that later.
This is the code from EnterFrame handler
function enterFrameHandler (e:Event=null) {
_txt1.text=pano.pan;
_txt2.text=pano.tilt;
}
I can't understand Why it dos'nt show negative numbers, any suggestions?
This is the entire code.
///////////// REQUIRED VARIABLES
var id:String="test";
var version:String="1.0";
var panoController:Object=null;
var pano:Object=null;
var hotspots:Object;
var waitTimer:Timer;
var siffra:String="0";
///////////// FUNCTIONS CALLED BY FPP
// this function executes when FPP loads the plug-in we use it to set up a timer to wait for everything else to load and be ready for interactivity:
function init (panoMain:Object) {
if (panoMain.addExternal(this)) {
panoController = panoMain;
waitTimer = new Timer(50);
waitTimer.addEventListener(TimerEvent.TIMER, waitHotspots, false, 0, true);
waitTimer.start();
}
}
// this function is called whenever a new panorama is loaded
function newPano (link:Object) {
pano = link;
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
function enterFrameHandler (e:Event=null) {
_txt1.text=pano.pan;
_txt2.text=pano.tilt;
}
// this function handles XML parameters. It is called when FPP is first started and passed the parameters from the plugin's node in the XML if it exists:
function newParams (str:String) {
// a little RegExp pattern matching is good for you:
var lines:Array = str.match(/[^\s\n\r]+[^\n\r]+/g);
for (var i:int=0;i<lines.length;i++) {
var pair:Array = lines[i].split(/[\s]*=[\s]*/);
if (pair[2] != null){
for (var j:Number=2; j<pair.length; j++){
pair[1] = pair[1].concat("=",pair[j]);
}
}
setAttribute(pair[0], pair[1], null, null, null, null, 0 );
}
}
var params:Object = new Object();
// this function receives calls commands in the XML that start with external, e.g. "external.descriptionbox.mode=...":
function setAttribute (name:String, value:String, time:String=null, type:String=null, onDoneFunction:String=null, onInterruptFunction:String=null, relative:int=0 ) {
params[name] = value;
}
// this function is called by the timer when hotspots.swf is loaded and defines the hotspots variable:
function waitHotspots (event:Event) {
if (panoController.externals.hotspots!=null) {
// wait for XML parsing
if (panoController.externals.hotspots.ready) {
waitTimer.stop();
waitTimer = null
hotspots = panoController.externals.hotspots;
}
}
}
// this function is called by FPP when the plugin is unloaded (which is not often, and generally only when you ask it to be):
function remove () {
}
/////////////////END
Edit: Added the entire code if someone wanted to take a look.
//Peter F
allSaints
05-04-2009, 05:00 PM
Hi again punk,
I copied your code and made some small changes, and it works OK when I run it here (http://wirestam.com/panos/Flash/test/coordinates.html)
This is the code:
///////////// REQUIRED VARIABLES
var id:String="coordinates";
var version:String="1.0";
var panoController:Object=null;
var pano:Object=null;
var hotspots:Object;
var waitTimer:Timer;
var coordTimer:Timer;
///////////// FUNCTIONS CALLED BY FPP
// this function executes when FPP loads the plug-in we use it to set up a timer to wait for everything else to load and be ready for interactivity:
function init (panoMain:Object) {
if (panoMain.addExternal(this)) {
panoController = panoMain;
waitTimer = new Timer(50);
waitTimer.addEventListener(TimerEvent.TIMER, waitHotspots, false, 0, true);
waitTimer.start();
}
}
// this function is called whenever a new panorama is loaded
function newPano (link:Object) {
pano = link;
}
// this function handles XML parameters. It is called when FPP is first started and passed the parameters from the plugin's node in the XML if it exists:
function newParams (str:String) {
var lines:Array = str.match(/[^\s\n\r;]+[^;\n\r]+/g);
var parms:Array;
for (var i:int=0; i<lines.length; i++) {
var pair:Array = lines[i].split(/[\s]*=[\s]*/);
switch (pair[0].toLowerCase()) {
case "pos" :
parms = pair[1].split(":");
x = Number(parms[0]);
y = Number(parms[1]);
break;
}
}
}
var params:Object = new Object();
// this function receives calls commands in the XML that start with external, e.g. "external.descriptionbox.mode=...":
function setAttribute (name:String, value:String, time:String=null, type:String=null, onDoneFunction:String=null, onInterruptFunction:String=null, relative:int=0 ) {
params[name] = value;
}
// this function is called by FPP when the plugin is unloaded (which is not often, and generally only when you ask it to be):
function remove () {
}
// this function is called by the timer when hotspots.swf is loaded and defines the hotspots variable:
function waitHotspots (event:Event) {
if (panoController.externals.hotspots!=null) {
// wait for XML parsing
if (panoController.externals.hotspots.ready) {
waitTimer.stop();
waitTimer = null
hotspots = panoController.externals.hotspots;
// start coord timer
coordTimer = new Timer(50);
coordTimer.addEventListener(TimerEvent.TIMER, getCoords, false, 0, true);
coordTimer.start();
}
}
}
function getCoords (e:Event=null) {
_txt1.text=int(pano.pan).toString();
_txt2.text=int(pano.tilt).toString();
}
Good luck,
Tommy
popunonkok
05-04-2009, 05:55 PM
That looks great. Thanx.
Is this the the code that you have edited?
// start coord timer
coordTimer = new Timer(50);
coordTimer.addEventListener(TimerEvent.TIMER, getCoords, false, 0, true);
coordTimer.start();
function getCoords (e:Event=null) {
_txt1.text=int(pano.pan).toString();
_txt2.text=int(pano.tilt).toString();
}
Man that differs sooo much from ActionScript 2. :confused:
Is it OK if i Use that code?
Next I would like to se if I can inplement XML so that I turn the cordinates on and off.
Thanx again
allSaints
05-04-2009, 06:15 PM
Yes, you are welcome to use the code. In fact, it was your code from the beginning... :)
And, well... your code worked from start - the changes are merely cosmetic. And I also changed from the frame driven event to a timer of my own.
I am not sure why your original code didn't show the negative numbers - strange!
Tommy
vBulletin® v3.7.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.