Sie sind nicht angemeldet.

1

Sonntag, 10. Mai 2009, 16:00

Building a swf interface

I'm OK with Flash - building buttons etc, so I'm thinking of just having a single swf as my main control panel instead of a row of graphics.

But I'm confused about where to put the relevant xml code. For example, in the "move left" button all I need to put on the flash button is this:

ondown="set(movevectorx,-0.20);"
onup="set(movevectorx,0);"

But how do I actually include that ? And what about toggle actions ?

Perhaps if someone has already been down this road they might like to share some knowledge ?

Thanks

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

2

Sonntag, 10. Mai 2009, 19:19

well flash is a little more complicater but alot stronger when you choose to use it.

first you have to register the krpano class, this allows you to communicate with krpano. Copy the file in the root of your fla file. then in the actions panel:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import krpano_as3_interface
krpano = krpano_as3_interface.getInstance();

if (krpano.get == null)
{
	// run plugin swf standalone - add dummy functions
	function dummy_get(v:String):String 
	{ 
		//trace("get(" + v + ");");
		return("");
	}
	function dummy_set(v:String,val:String):void 
	{
		//trace("set("+v+","+val+");");
	}
	
	function dummy_call(action:String):void 
	{
		//trace("call("+action+");");
	}
	function dummy_trace(Mode:Number, str:String):void 
	{
		trace("trace("+Mode+", "+ str + ");");
	}
	krpano.get  = dummy_get;
	krpano.set  = dummy_set;
	krpano.call = dummy_call;
	krpano.trace = dummy_trace;
}


then you add a Eventlistener to your buttons, this allows you to listen to certain user inputs. Like a Mouseclick.

Quellcode

1
2
3
4
5
6
7
8
9
10
nameofyourbutton.addEventListener(MouseEvent.CLICK, ClickFunction)
otherbutton.addEventListener(MouseEvent.CLICK, ClickFunction2)
function ClickFunction(evt:Event):void
{
krpano.set("movevectorx",0) //your click action
}
function ClickFunction2(evt:Event):void
{
krpano.set("movevectorx",0) //your click action
}

3

Montag, 11. Mai 2009, 16:20

Thanks... it's way more complex than I imagined. I'll have to put aside a couple of days for this.

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

4

Montag, 11. Mai 2009, 16:30

Don't be scared of the code. 90% is reusable and copypaste, with a few alterations you can make completely different interfaces based on the same code. Look at the flash cs3 plugin example: http://www.krpano.com/download/download.…pluginexample11

5

Dienstag, 12. Mai 2009, 01:05

It's a shame there isn't an example that's a bit more useful. That fla file may have all sorts of example code, but it isn't even remotely close to a usable control panel.

I was hoping there may have been something like a Flash control panel example in the same way there is a plain graphic xml control panel. Much, much easier just to modify that way.

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

6

Dienstag, 12. Mai 2009, 08:49

What exactly do you mean with control panel? Something like the interface from signature? or w w w[dot] ring zuid gro nin g en[dot]nl/virtual/

7

Mittwoch, 13. Mai 2009, 01:35

Those interfaces are very good, but I mean just a simple panel of controls: up, down, left, right, fullscreen toggle, sound toggle, rotate toggle etc. A row of buttons, but all done in Flash as a single swf. I'm really just trying to make my standard "panorama starter" file as basic as possible. I think having all standard controls in one simple swf would be good.

( By the way Zephyr, I love your photography. It's very crisp and sharp, but has a slightly unusual look. Not HDR but perhaps some sort of extra processing ? )

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

8

Mittwoch, 13. Mai 2009, 09:46

Well, most surroundings are from a real photographs. But the trees and the houses you see are 3dmodels. I combine them both with photoshop, and try to match the colors of the renders with the colors of the photograph. The tour located at w w w[dot] ring zuid gro nin g en[dot]nl/virtual/ shows this better, at the top you have a row of buttons that switch between the different type of infrastructure options.

Next to that I use the HIGHSHARP filter, and combined with 3d models it sometimes gives a bit "oversharpened" look because, photos are alot softer irl then renders.

9

Mittwoch, 13. Mai 2009, 17:01

Hi,

just use in as3 the same action calls like in the xml,
the interface to control krpano is always the same (xml, as3, js)

e.g. - for a simple zoom in button: (it only changes the value of the "movevectorz" variable)

xml:

Quellcode

1
<plugin name="in" .. ondown="set(movevectorz,-1);"  onup="set(movevectorz,0);" />


as3:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
zoominbutton.addEventListener(MouseEvent.MOUSE_DOWN, zoom_in);

function zoom_in (evt:MouseEvent):void
{
   stage.addEventListener(MouseEvent.MOUSE_UP, stop_zoom);
   krpano.set("movevectorz", -1);
}

function zoom_out (evt:MouseEvent):void
{
   stage.removeEventListener(MouseEvent.MOUSE_UP, stop_zoom);
   krpano.set("movevectorz", 0);
}


have also a look in the included plugin example source files (.as)

best regards,
Klaus

10

Donnerstag, 14. Mai 2009, 18:02

Thanks. I'll give it a go with the extra info in this thread.

But it would sure help if the example files actually had some useful interface buttons as starters (like the xml demo files).

*unsure*