Go Shopping Cart Site Map User Panel and Admin English Home

Home > Easypano Forum    Easypano Forum has been upgraded.

Easypano Forum


Welcome Guest Register Login Search The Forum Display List of Forum Members
 All Forums
  Tourweaver
 
Subject Topic: Communication between swf LocalConnection Post Reply Post New Topic
Message posted by zcalvin on May-20-2012 at 12:21pm
View zcalvin's Profile Profile   Search for other posts by zcalvin Search   Visit zcalvin's Homepage www   Quote zcalvin Quote   Send Private Message Send Msg  
zcalvin
Standard Member
Standard Member
United States
May-20-2012
1 Posts
I just started using tourweaver a week ago ( and a slightly older version, 6.5 ) , so maybe there's already a solution for this problem, but here's what I came against.

When switching between tours using the link to scene action on a hotspot, the hotspots immediately disappear while there's a nice fade-effect between the pano scenes.

Also, audio playing in the scene immediately cuts off instead of fading out gradually.

The first issue can be mitigated somewhat using a flash button to link between scenes, that fades out when clicked, but the other info icons I've got sprinkled around the scene don't fade out, also the audio was cutting out too quickly.

This issue can be fixed using the LocalConnection object available in flash. This allows for communication between swfs. So you have a sender and recievers. The arrow swf in this case, when clicked, sends a message to all other swfs to do an action, in this case to fade out audio and to fade out the info icons.

Here's the as3 code sample for the receiver ( the info icons and the flash swf playing audio )

stop();
import flash.net.LocalConnection;
var receiverLC:LocalConnection = new LocalConnection()


function playMC():void {
     // here, do whatever action you want when the
        // sender swf is clicked
}

// for some reason messages arent recieved
// reliably. This timer delays connection and fixes the issue.

var myTimer:Timer = new Timer(1000, 1);
myTimer.addEventListener(TimerEvent.TIMER, runOnce);
myTimer.start();

function runOnce(event:TimerEvent):void {
     receiverLC.connect("_myConnection");
receiverLC.client = this;
}

// end.
and here's the code for the sender swf, the arrow, in this case,
or whatever object you want to send communication to

stop();

import flash.net.LocalConnection;
import flash.events.MouseEvent;
var receiverLC = new LocalConnection();

btn.addEventListener(MouseEvent.CLICK, myClick);

function myClick (e:MouseEvent):void
{
     receiverLC.send("_myConnection", "playMC");
     // do whatever else here in this swf youd like
// like fading out the arrow.
}

One final note, I noticed that only one connection is allowed, so to communicate to multiple swfs, the sender can send out multiple messages, for example,

receiverLC.send("_myConnection2", "playMC");
and another reciever swf can be authored like so:

receiverLC.connect("_myConnection2");

Using the above methods can add whole new levels of interactivity to the tours.

Also, the communication doesn't have to be just within the tourweaver scene. the reciever swf can be anywhere. it can be embedded in the html on the webpage, on another webpage, or running from flash player on your computer, etc.

If you wish to post a reply to this thread you must first Login
If you are not already registered you must first register

Forum Jump Post Reply Post New Topic
Printer Friendly Version Printable version

Powered by: - Web Wiz Guide Discussion Forums