Pass data to loaded movie clip with Hotspot

Using Pano2VR/Object2VR SWF files with your own Flash projects
User avatar
Hrvoje
Posts: 131
Joined: Sat Feb 28, 2009 7:34 pm
Location: Zagreb, Croatia
Contact:

Pass data to loaded movie clip with Hotspot

Post by Hrvoje » Wed Apr 10, 2013 4:19 pm

Hello

I have several questions:

Question 1:
Is it possible to pass data to loaded movie clip with hotspot action?

In custom skin I added flash SWF element named "html_loader"
html_loader serves for displaying info about specific spots in panorama(s) and it basically
loads external html: 1 image and text, and it enables scrolling if needed.

This is AS3 code for loaded clip:

Code: Select all

package {
	
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.text.TextField;
	import flash.text.TextFormat;
	import flash.text.TextFieldAutoSize;	
	public class externalContent extends Sprite {		
		public var scroller:Scroller		= new Scroller ();
		public var scrollContent:TextField	= new TextField ();
		public var textFormat:TextFormat	= new TextFormat ("Arial", 12, 0x000000);
		public var textLoader:URLLoader		= new URLLoader ();				
		public function externalContent ():void {
			scrollContent.x = 20;
			scrollContent.y = 20;
			scrollContent.width = 500;			
			addChild (scrollContent);			
			scroller.x = 570;
			scroller.y = 20;
			scroller.scrollTarget = scrollContent;
			scroller.trackHeight = 350;
			scroller.maskHeight = 350;
			scroller.trackSpeed = 8;
			scroller.justification = "left";
			addChild (scroller);			
			textLoader.addEventListener (Event.COMPLETE, textLoaded);
			textLoader.load (new URLRequest ("externalContentText.html"));
		}		
		public function textLoaded (event:Event):void {
			scrollContent.htmlText = textLoader.data;
			scrollContent.setTextFormat (textFormat);
		}
	}
}
I would like to be able to pass file data into that swf file with hotspot click so that I can change "externalContentText.html" URL with hotspot click. I would like to use only one external swf file for many info windows.

Is this possible?


Question 2:
I have educational tour with 30 panoramas. Visitors should visit 1st one, than next, etc.
On the bottom I need to have 30 clickable dots, each when clicked should open specified panorama name. I'm creating dots dynamically, and I can pass panorama names from array list.

2.1 Which code should I use and put into click action to load specified panorama?
2.2 Can I use numbers (from Tour Browser) instead of actual panorama names?
2.3 Does p2vr provide feature functions to load previous and next panorama with arrow buttons?
I would like to be able to navigate to previous or next panorama from current one, by clicking navigational arrows

Instead clickable dots, maybe I will use another approach: scrollable panorama thumbnails, but with same click action.


I'm using p2vr 4.1.0 pro

Thanks
Regards

User avatar
Hrvoje
Posts: 131
Joined: Sat Feb 28, 2009 7:34 pm
Location: Zagreb, Croatia
Contact:

Re: Pass data to loaded movie clip with Hotspot

Post by Hrvoje » Sat Apr 13, 2013 10:21 am

Anyone?

User avatar
Hrvoje
Posts: 131
Joined: Sat Feb 28, 2009 7:34 pm
Location: Zagreb, Croatia
Contact:

Re: Pass data to loaded movie clip with Hotspot

Post by Hrvoje » Thu Apr 18, 2013 6:38 pm

OK so I guess that the answer is - not possible.
TBH, I'm a little bit disappointed with silence on this forum. :?
As paid customer, I expected at least: Yes or No.

Regards

User avatar
Hopki
Gnome
Posts: 9015
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Re: Pass data to loaded movie clip with Hotspot

Post by Hopki » Thu Apr 18, 2013 6:43 pm

Hi,
Im not a Flash junky and was hoping one of our forum members may of stepped in but will copy this thread to Thomas to have a look.
Regards,
Hopki

User avatar
Hrvoje
Posts: 131
Joined: Sat Feb 28, 2009 7:34 pm
Location: Zagreb, Croatia
Contact:

Re: Pass data to loaded movie clip with Hotspot

Post by Hrvoje » Thu Apr 18, 2013 9:18 pm

Thanks

Looking forward for any clue :)

Regards

User avatar
thomas
Site Admin
Posts: 2489
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

Re: Pass data to loaded movie clip with Hotspot

Post by thomas » Fri Apr 19, 2013 9:53 am

Hello,
Hrvoje wrote: Question 1:
Is it possible to pass data to loaded movie clip with hotspot action?
Yes, it should be possible. Just send the parameter as GET parameter, so for example myswf.swf?src=externalContentText.html. The parameter should show up in loaderInfo.parameters.src. So if you replace textLoader.load (new URLRequest ("externalContentText.html")); with textLoader.load (new URLRequest (loaderInfo.parameters.src)); it should do the trick.
Question 2:
I have educational tour with 30 panoramas. Visitors should visit 1st one, than next, etc.
On the bottom I need to have 30 clickable dots, each when clicked should open specified panorama name. I'm creating dots dynamically, and I can pass panorama names from array list.

2.1 Which code should I use and put into click action to load specified panorama?
2.2 Can I use numbers (from Tour Browser) instead of actual panorama names?
You can open the other panoramas for example with <panomovie>.pano.openNext("{node3}");. You can enable the display of node ids for the tour browser in the preferences/settings.
2.3 Does p2vr provide feature functions to load previous and next panorama with arrow buttons?
Not yet.
MfG, Thomas

User avatar
Hrvoje
Posts: 131
Joined: Sat Feb 28, 2009 7:34 pm
Location: Zagreb, Croatia
Contact:

Re: Pass data to loaded movie clip with Hotspot

Post by Hrvoje » Mon Apr 22, 2013 10:05 pm

Hi Thomas

I managed to completely solve Question 1, thanks a lot.
If someone is interested how, just ask in this thread and I'll post exact steps


But I'm struggling now with Question 2
thomas wrote:You can open the other panoramas for example with <panomovie>.pano.openNext("{node3}");.
You can enable the display of node ids for the tour browser in the preferences/settings.
I created dot_buttons.swf movie, with 5 buttons, and added it into panorama skin with "dot_buttons" id.
Panorama is named "tour_out.swf"

This is as3 code for my 5 buttons:

Code: Select all

var NumberOfButtons = 5
var ButtonDistance = 18
// adds buttons on stage
var btn:Array = new Array();
for(var i = 0; i < NumberOfButtons; i++) {
	var button:ButtonMC = new ButtonMC();
	button.y = 2;
	button.x = i * ButtonDistance + 2;
	addChild(button);
	btn.push(button);
	btn[i].butText.text = i+1;	
}
butBgr.width = NumberOfButtons * ButtonDistance + 2;
// Adds click action to buttons
var clipArray:Array = [btn[0], btn[1], btn[2], btn[3], btn[4]];
var destArray:Array = ["node1", "node2", "node3", "node4", "node5"];
for (var b = 0; b < clipArray.length; b++) {
	clipArray[b].buttonMode = true;
	clipArray[b].addEventListener(MouseEvent.CLICK, clickHandler);
}
function clickHandler(event:MouseEvent):void {
	for (var b:int = 0; b < clipArray.length; b++) {
		if (event.currentTarget == clipArray[b]) {
			MovieClip(root).tour_out.pano.openNext("{node3}")
                        //MovieClip(root).tour_out.pano.openNext(destArray[b])
			//trace(destArray[b])		
		}
	}
}
Problem is that clicking on buttons doesn't open node3 panorama.
I tried several path combinations but no one worked.

What would be the correct path for calling openNext("{node3}") function?

Currently, node3 is hardcoded in this path:
MovieClip(root).tour_out.pano.openNext("{node3}")
When I manage to find correct path I'll change hardcoded "node3" value into destArray, something like
MovieClip(root).tour_out.pano.openNext(destArray)

Regards

User avatar
Hrvoje
Posts: 131
Joined: Sat Feb 28, 2009 7:34 pm
Location: Zagreb, Croatia
Contact:

Re: Pass data to loaded movie clip with Hotspot

Post by Hrvoje » Tue Apr 23, 2013 7:05 pm

Hi

Please, I need to solve this last issue: how to call openNext function from my
flash movie clip with buttons, which is loaded in the panorama with skin editor.

I spent several hours yesterday by trying many paths, but no luck.

Thanks
Regards

User avatar
thomas
Site Admin
Posts: 2489
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

Re: Pass data to loaded movie clip with Hotspot

Post by thomas » Thu Apr 25, 2013 6:14 pm

Hrvoje wrote: Please, I need to solve this last issue: how to call openNext function from my
flash movie clip with buttons, which is loaded in the panorama with skin editor.

I spent several hours yesterday by trying many paths, but no luck.
Hello,
the magic only happens if you include the brackets "{" and "}" ! If you change your destinations to {node1},{node2}, {node3} etc. it should work.
MfG, Thomas

User avatar
Hrvoje
Posts: 131
Joined: Sat Feb 28, 2009 7:34 pm
Location: Zagreb, Croatia
Contact:

Re: Pass data to loaded movie clip with Hotspot

Post by Hrvoje » Thu Apr 25, 2013 8:14 pm

Hi

I'm close to give up. :?
<panorama>.tour_out.pano.openNext("{node3}") - this doesn't work in flash:
Error: Syntax error: XML does not have matching begin and end tags.

This doesn't work either:
MovieClip(root).pano.openNext("{node3}")
Error: TypeError: Error #1010: A term is undefined and has no properties. at dot_buttons_fla::MainTimeline/frame1()

nor this:
this.pano.openNext("{node3}")
Error: TypeError: Error #1010: A term is undefined and has no properties. at dot_buttons_fla::MainTimeline/frame1()

I have quite a lot experience with AS2, much less with AS3, and zero with Pano2VR AS3 API.
Maybe I'm missing something obvious, but I simply cannot make this to work.
I tried various paths, decompiled tour file to see AS3, but nothing works.

So this is my last attempt:
This is suggested example: <panorama>.pano.openNext("{node3}")
If I put this action in root of my swf file which is embed into panorama.swf with skin editor
Whats exactly needed path?
???.???pano.openNext("{node3}")
and why is this ("{node3}") part giving me compiler error in Flash?

Maybe I could switch approach and call javascript with my AS3 functions and use javascript to load next panos?

Thanks a lot for pushing me so far :)

Regards

osolsona
Posts: 5
Joined: Tue May 21, 2013 4:24 pm

Re: Pass data to loaded movie clip with Hotspot

Post by osolsona » Tue May 21, 2013 4:43 pm

Hi Hrvoje,
I hope you were able to solve your issue in Question 2. I'm contacting you regarding Question 1. I'm trying to to pass data to a loaded movie clip in with hotspot actions but I'm not able to get it working. Would you mind to briefly post the steps you followed?
Thanks in advance for your help.
oscar

User avatar
Hrvoje
Posts: 131
Joined: Sat Feb 28, 2009 7:34 pm
Location: Zagreb, Croatia
Contact:

Re: Pass data to loaded movie clip with Hotspot

Post by Hrvoje » Tue May 21, 2013 6:45 pm

Hi Oscar

Hi, I'll try to guide you, but I cannot do it before Thursday.
I'm away now, and I need to look at my files to post exact solution.

Regards

osolsona
Posts: 5
Joined: Tue May 21, 2013 4:24 pm

Re: Pass data to loaded movie clip with Hotspot

Post by osolsona » Wed May 22, 2013 9:32 am

No worries, take your time. Thanks Hrvoje.

User avatar
Hrvoje
Posts: 131
Joined: Sat Feb 28, 2009 7:34 pm
Location: Zagreb, Croatia
Contact:

Re: Pass data to loaded movie clip with Hotspot

Post by Hrvoje » Fri May 24, 2013 12:09 pm

Hi

OK I'll try to explain now. Let's say that you need to pass variable named src (url or file name) from hotspot click into flash movieclip which is loaded by using template editor.

1. In your flash movie add this line: var WhichUrl = loaderInfo.parameters.src
after clicking hotspot, "loaderinfo.parameters" will pass data contained in src variable into your WhichUrl variable which you can use in your flash movieclip.

2. Export this movie as myflash_clip.swf

3. In your p2vr template editor, click "Add Flash SWF element" button and select your myflash_clip.swf.
As ID write: myflash_clip

4. Create (or duplicate original) your new hotspot and name it "FlashSpot"
In action modifiers add this:
Mouse Click - Set Text - Text: $hu - Target: myflash_clip
You can also add some actions to toggle visibility for that flash movie clip or if you are using container to hold it.

5. Save template

6. In your pano2vr, Hotspots, click Modify, double click on desired place to add new hotspot

7. ID: use default data - Skin-ID: FlashSpot - Title: add your title - URL: skin_content/myflash_clip.swf?src=somefile.html - Target: myflash_clip

Let me explain URL part. I placed myflash_clip.swf into skin_content folder.
?src is variable which contains "somefile.html" file name or any other variable content.

I think that this pretty much covers it.

HTH & Good luck :D
Regards

osolsona
Posts: 5
Joined: Tue May 21, 2013 4:24 pm

Re: Pass data to loaded movie clip with Hotspot

Post by osolsona » Fri May 24, 2013 3:00 pm

I owe you one Hrvoje!
Your instructions are cristal clear. Now I can pass the ID of the hotspot to my flash loader and then load all the info from an xml file.
Thanks so much again and have a nice day.
oscar

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests