Forums  

Go Back   Forums > Talk > General FPP Discussion

Reply
 
Thread Tools Display Modes
  #1  
Old 09-16-2007, 02:39 AM
Scott Witte's Avatar
Scott Witte Scott Witte is offline
Senior Member
 
Join Date: Sep 2007
Location: Milwaukee, WI USA
Posts: 510
Downloads: 0
Uploads: 0
Default Controller should always display current pano name. Any AS3 gurus?

In the tour I'm building you can arrive at any pano by either the controller (combobox) or hotspot links. If you jump there by controller the correct panorama name (label) is displayed. If you arrive by hotspot the controller continues to display the last pano it jumped to. It just looks amateurish to have the combobox display "Entrance" when you are actually in "Auditorium".

Additionally, lets say you are in "Auditorium" and want to return to "Entrance" directly via the controller, but controller still list "Entrance". When you click Entrance controller essentially says, "What? According to my records we are still in Entrance so sorry, I just won't do that!"

This should be easy to fix for someone with actionscript skills. I can see where controller.swf queries flashpano every half second for the current panoName. It stores that in a variable. It should be easy for controller to compare that variable to the panoName it lists and if different, change the label to the correct one.

Alas, I know nothing about actionscript so I'm at a loss how to do this. But this minor challenge could be a real coup for someone who can understand this strange language. Any takers?????

Please???
__________________
Scott
Tour de Force 360VR
Scott Witte Photography
----------------------
Auto Quality Plugin: Guarantee the best FPP experience possible for every viewer on every computer.
Motion Zoom Transition Plugin: Move from Node to Node
Reply With Quote
  #2  
Old 09-16-2007, 02:58 PM
cheathamlane cheathamlane is offline
Senior Member
 
Join Date: Mar 2007
Location: Berkeley, California, USA
Posts: 774
Downloads: 0
Uploads: 0
Send a message via AIM to cheathamlane
Default

Hi Scott:

If you're using the controller example as supplied with FPP, you should experience "normal" behavior where the correct pano name is displayed in the combo box (whether you get there via hotspot or dropdown). Denis pre-coded it so it "sniffs" the pano name, and adjusts accordingly.
__________________
Patrick
http://cheathamlane.net
--
Tutorials: Embed Pano 101, Pano auto-presentation
Reply With Quote
  #3  
Old 09-16-2007, 06:36 PM
Scott Witte's Avatar
Scott Witte Scott Witte is offline
Senior Member
 
Join Date: Sep 2007
Location: Milwaukee, WI USA
Posts: 510
Downloads: 0
Uploads: 0
Default

Quote:
Originally Posted by cheathamlane View Post
Denis pre-coded it so it "sniffs" the pano name, and adjusts accordingly.
OK. I see the problem but not a workaround. The data field in the controller property must exactly match panoName for this to work. But I add positioning instructions so the pano doesn't open to some random place. For example, "Images\Entrance&panHome=150". Obviously this isn't equal to the the value controller gets from FPP for panoName.

To work properly controller should compare only the data up to the & with panoName. Or is there another solution?

I bet Denis could fix it in a Flash, being as AS3 is his "first language"
__________________
Scott
Tour de Force 360VR
Scott Witte Photography
----------------------
Auto Quality Plugin: Guarantee the best FPP experience possible for every viewer on every computer.
Motion Zoom Transition Plugin: Move from Node to Node
Reply With Quote
  #4  
Old 09-16-2007, 07:18 PM
cheathamlane cheathamlane is offline
Senior Member
 
Join Date: Mar 2007
Location: Berkeley, California, USA
Posts: 774
Downloads: 0
Uploads: 0
Send a message via AIM to cheathamlane
Default

Hi Scott:

The controller as scripted _does_ only read in the panoName (and not other parameters past the & symbol). If you're putting images in a subfolder or other places, then the panoName might read something like "images/subfolder/coolPano/coolPano".

In the controller.fla, the data for a certain pano would then read "images/subfolder/coolPano/coolPano". You can either hardcode this pano name in the data, or use AS to parse it together for you. For small projects, I just hardcode it.

Without seeing your FLA, it's hard to say where the issue is -- but the controller.fla example _as written_ works just fine, when you feed it proper panoName info that jibes across the controller's data and what you're loading in.

If you aren't using it, I suggest you download a "debug" version of the Flash player, and then sephiroth's Flash Tracer for Firefox. This is a huge help when trying to trace out scripting issues in the browser. Search for sephiroth's Flash Tracer; it's also linked to from a post in the forums here (I forget where).
__________________
Patrick
http://cheathamlane.net
--
Tutorials: Embed Pano 101, Pano auto-presentation
Reply With Quote
  #5  
Old 09-16-2007, 09:21 PM
Gary Gary is offline
Junior Member
 
Join Date: Jul 2007
Posts: 18
Downloads: 0
Uploads: 0
Default

Hi Scott,

I believe you are on the right track in fixing this. Your problem is that the data element in the controller is not matching the panoName because you are stuffing the data element with additional parameters. I can't verify this completely, but I believe Patrick is correct in saying this should be working fine, but I believe it will work fine only if you are passing ONLY the panoname (with path info) without any additional parameters (panhome, etc). (I haven't verified it, and I may be wrong here... but this is what I see in reading the code)

I'd suggest a slightly different approach than you suggest above... You basically just want to verify whether panoName is in your data string from your controller. The indexOf() function should do the trick. Just search the data string from the controller for the existence of panoName. If panoName doesn't exist, it will return -1. Otherwise, it will return a positive integer which is the offset into the datastring where panoName is found.

It's tough to know without testing, but here are the changes I'd try:

1) at the top of the callback function, I add two string vars to be sure the compiler interprets my calls as being from two string vars:
var tempstring1:String;
var tempstring2:String;

2) Substitute the following 2 lines for the first if statement:

tempstring1=_cb.selectedItem.data;
if(tempstring.indexOf(panoName)> -1) {

3. the 2nd if statement below, should be replaced by the following 2 lines:

tempstring2=_cb.getItemAt(i).data;
if(tempstring2.indexOf(panoName)>-1) {

That's it... give it a try... can't guarantee it will work, but it should get you close...

<gary>
Reply With Quote
  #6  
Old 09-16-2007, 09:55 PM
cheathamlane cheathamlane is offline
Senior Member
 
Join Date: Mar 2007
Location: Berkeley, California, USA
Posts: 774
Downloads: 0
Uploads: 0
Send a message via AIM to cheathamlane
Default

Gary & Scott:

I really think you guys are overthinking it...

http://www.swainsart.com/flash/office.html

The example at the link above opens a page with links. Each link lets you open one of the panoramas in the tour directly, at its own Web page. When the page/pano loads, the controller goes to the appropriate choice.

If you view source, you'll see that I'm passing a whole host of information via the URL. For example:

Code:
    <script type="text/javascript">
		var thePanoFiles;
		thePanoFiles = "_files/pano.swf?panoName=Office/Office/Office&panHome=-47&tiltHome=-12&zoomHome=0.57&xml_file=Office/Office.xml&";
    </script>
<script type="text/javascript" src="_files/swfobject.js"></script>
</head>

<body>
<!--<script type="text/javascript" src="files/swfobject.js"></script>		-->
<div id="flashcontent">This content requires <a href="http://www.adobe.com/go/getflashplayer/">Adobe Flash Player</a> 9. Please, visit <a href="http://www.adobe.com/go/getflashplayer/">adobe.com</a> to install it</div> 
    <script type="text/javascript">
		var so = new SWFObject("_files/show_pano.swf", "pano", "100%", "100%", "6.0.65", "#282828"); 
		so.addVariable("movie", thePanoFiles);
		so.addVariable("redirect", window.location);	  
		so.addVariable("xml_file","_swains.xml");
		so.addParam("allowFullScreen","true");
		so.addParam("allowScriptAccess","sameDomain");
		so.write("flashcontent");
		window.document["pano"].focus();
    </script>
</body>
You can also load the rest of the panoramas by using the dropdown menu, removing the need to load different Web pages.

If you're using the Flash Tracer add-on for Firefox (or a similar debugger), you'll be able to watch the calls get made as you load the page and/or panoramas.

--
Now, if the problem is that in the controller you're putting extra parameters on the end of the data... Hmm. You need to break it up into pieces, then put it all back together. This would be my approach, anyway.

In my controller, the data for the above example looks like "Office/Office/Office". If you're appending extra parameters to the end of your data, then maybe it looks like "Office/Office/Office&panHome=247".

In this situation, I'd place a switch statement inside your loadPano call in the controller. For example:

Code:
function loadPano(name) {
	//case = panoName (data from controller)
	switch (name) {
		case "Office/Office/Office" :
			myExtraParam_pan = "-256";
			break;

		case "Paints/Paints/Paints" :
			myExtraParam_pan = "180";
			break;

		case "Pens/Pens/Pens" :
			myExtraParam_pan = "32";
			break;

		default :
			myExtraParam_pan = "0";
	}
	if (masterSlot != null) {
		_lc.send(masterSlot,"execute","pano.leash=free;loadPano(?panoName="+name+"&panHome="+myExtraParam_pan+",3000,none);");
	}
}
This lets your panoName match up every time with the data in your controller, and lets you append whatever you want to it when you make the loadPano call.

?

This is a fairly easy way to do things, but slightly more difficult to extend if you do a bunch of different tours. Another approach would be to use a second (or additional) XML file for each panorama. This is much easier to maintain and alter than it is to re-render out your SWF everytime you make a change.

In the above example, instead of passing the "panHome" parameter, you could pass the "xml_file" parameter. In this case, I'd use AS in the SWF to truncate the panoName parameter into something more filename-friendly. Then, outline all your "panHome" and "tiltHome" and etc parameters in the XML file. so your loadPano call would end up looking something like:

Code:
_lc.send(masterSlot,"execute","pano.leash=free;loadPano(?panoName="+name+"&xml_file="+truncatedName+"/"+truncatedName+".xml"+",3000,stripes);");
Where in my case the XML's filename would be "Office/Office.xml", and the hardcoded call would look like:
Code:
_lc.send(masterSlot,"execute","pano.leash=free;loadPano(?panoName=Office/Office/Office&xml_file=Office/Office.xml"+",3000,stripes);");
Easier, IMHO.
__________________
Patrick
http://cheathamlane.net
--
Tutorials: Embed Pano 101, Pano auto-presentation

Last edited by cheathamlane; 09-16-2007 at 10:05 PM. Reason: added a thought
Reply With Quote
  #7  
Old 09-16-2007, 10:14 PM
cheathamlane cheathamlane is offline
Senior Member
 
Join Date: Mar 2007
Location: Berkeley, California, USA
Posts: 774
Downloads: 0
Uploads: 0
Send a message via AIM to cheathamlane
Default

I edited the above, so it may have changed since your email notifications.
__________________
Patrick
http://cheathamlane.net
--
Tutorials: Embed Pano 101, Pano auto-presentation
Reply With Quote
  #8  
Old 09-16-2007, 10:26 PM
Scott Witte's Avatar
Scott Witte Scott Witte is offline
Senior Member
 
Join Date: Sep 2007
Location: Milwaukee, WI USA
Posts: 510
Downloads: 0
Uploads: 0
Default

Quote:
Originally Posted by Gary View Post
I can't verify this completely... but I believe it will work fine only if you are passing ONLY the panoname (with path info) without any additional parameters (panhome, etc).
Gary,

You can verify here: Entrance

Data element for Entrance is "Entrance". For Reception it is "Reception&panHome=55". (No further path needed in this test.)

Use the controller to move from Entrance to Reception. "Reception" is displayed as the label. Use the hotspot to move back to Entrance and the lable changes to "Entrance".

NOW, use the hotspot to move to Reception. The label doesn't change. Further, if you use controller to move to Entrance nothing happens. (Already there, it thinks?) But use controller and select Reception and Reception gets reloaded.

Quote:
Just search the data string from the controller for the existence of panoName. If panoName doesn't exist, it will return -1. Otherwise, it will return a positive integer which is the offset into the datastring where panoName is found.
I'm not sure. Consider if you have two panoNames, "Pano" and "Pano1". Although they are unique both return true if you just search for existence of "Pano". (Effectively it would be the first matching instance that would return true, I expect.) So, your solution would probably work 95+% of the time but maybe not 100%?

Patrick,

I'd like to followup on the debug issue in another thread.

Thanks both of you! Your knowledge and experience is very helpful.
__________________
Scott
Tour de Force 360VR
Scott Witte Photography
----------------------
Auto Quality Plugin: Guarantee the best FPP experience possible for every viewer on every computer.
Motion Zoom Transition Plugin: Move from Node to Node
Reply With Quote
  #9  
Old 09-16-2007, 10:42 PM
cheathamlane cheathamlane is offline
Senior Member
 
Join Date: Mar 2007
Location: Berkeley, California, USA
Posts: 774
Downloads: 0
Uploads: 0
Send a message via AIM to cheathamlane
Default

Quote:
Originally Posted by Scott Witte View Post
I'm not sure. Consider if you have two panoNames, "Pano" and "Pano1". Although they are unique both return true if you just search for existence of "Pano". (Effectively it would be the first matching instance that would return true, I expect.) So, your solution would probably work 95+% of the time but maybe not 100%?
Well, in the Flash help, do a search for "Pattern matching" or "regular expressions". One way to think about it is to search for things which surround what you want to match -- that is, if you have "panoName=blah&xml_file=...", then you'd search for any-number-of-characters that exist between "panoName=" and "&".

But, again, I think it's overthinking the issue. If you read thru and/or try out some of my suggestions, I think your issue may go away.

Quote:
Originally Posted by Scott Witte View Post
Patrick,

I'd like to followup on the debug issue in another thread.
No problem -- there's already one or two forum posts about it here...

Cheers
__________________
Patrick
http://cheathamlane.net
--
Tutorials: Embed Pano 101, Pano auto-presentation
Reply With Quote
  #10  
Old 09-16-2007, 11:12 PM
Scott Witte's Avatar
Scott Witte Scott Witte is offline
Senior Member
 
Join Date: Sep 2007
Location: Milwaukee, WI USA
Posts: 510
Downloads: 0
Uploads: 0
Default

Patrick,

I expect your approach would work and may be easier for a one off. But it may be harder for the majority of people and might get more awkward as your tour gets larger. It may be easily broken. Are trailing spaces automatically truncated, for instance? If not that would be a problem and debugging would be difficult.

Back in the day you had a rule that data stayed in data and process stayed in code as much as possible, for good reasons. Your first solution puts a lot of data in the code. Your XML solution keeps them separate (and personally I like better), at a small performance hit for opening and loading more files. Here, too, things get a bit awkward as the tour grows and it ends up like a database with a separate file for each record, whereas they should all be kept in one file.

So, except for some easier upfront coding (not to be dismissed), I'm not sure your solution would remain the easiest. But I definitely appreciate where you are coming from.
__________________
Scott
Tour de Force 360VR
Scott Witte Photography
----------------------
Auto Quality Plugin: Guarantee the best FPP experience possible for every viewer on every computer.
Motion Zoom Transition Plugin: Move from Node to Node
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 04:30 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.