PDA

View Full Version : Communicate between hotspots?


amandap
11-21-2007, 12:27 AM
Perhaps this question has already been answered, but I haven't been able to find quite what I'm looking for. I have a panorama with two hotspots, both swf files. I need to trigger an ActionScript function in hotspot2 when I click a button in hotspot1. Additionally, I need to pass some parameters from hotspot1 to hotspot2. I have no idea how to access one hotspot from another. I am using AS2 NOT AS3, which is what a lot of the threads I've already seen have been discussing. Is there a way to do this? Any help you can give me would be much appreciated. Thanks!
Amanda

zleifr
11-21-2007, 01:07 AM
LocalConnection is the answer. You can talk to any other swf open at any time with it. You just have to put the appropriate code hooks in both swfs.

And you don't want to use the same localConnectionID as FPP (the controller) because that could cause problems.

You should be able to reuse some controller code (the original is AS2), but bear in mind that you are only seeing half of the process in the controller, as both swf have to have a "channel" to speak to the other on, and a "channel" to listen to the other, which in controller parlance is masterSlot and slaveSlot. controller issues commands over masterSlot and fpp responds (if asked to) over slaveSlot.

(The other answer would be using direct calls after you find the address to the other hotspot, but that really sounds complicated to me given that you are using AS2, etc, etc, but I could be wrong).

I hope that helps, more so than I could with the business about pixel to angle conversions. In depth trig for free just isn't my gig.

amandap
11-21-2007, 01:14 AM
Thanks Zephyr. I've never used LocalConnection before (I've always been able to use ExternalInterface), but will look into it tomorrow and will let you know if I get something figured out. :)

zleifr
11-21-2007, 01:21 AM
I have an unrelated question for you about your last post. (Since I am tacitly admitting to breaking the unspoken rules slightly, therefore I am pre-exonerated, right?). How do you get the specific color of a pixel in the panorama? I think I have a use for it. Thanks.

amandap
11-21-2007, 01:45 AM
I posted a reply in the original thread:
http://www.flashpanoramas.com/forum/showthread.php?t=602

zleifr
11-23-2007, 02:28 AM
I was just looking into another problem, and you can use external interface to do what you want, I am almost certain. I have never much messed around with external interface except to send commands from html through javascript, but the externalInterface example has a .fla (in AS2, conveniently for you) that send/receives messages from another swf and talks to fpp.

So, if you know external interface, you might look into it.

I just keep giving you less than flawless information... I hereby apologize.

amandap
12-03-2007, 04:30 PM
Sorry for the very delayed follow-up. I was away at a conference. LocalConnection was exactly what I needed. I just looked at Flash's help section and after about 5 lines of code, I had the two swfs talking to each other. Thanks a million for pointing me in that direction! :)

Amanda