Adobe Connect User Community
Menu

#1 2009-07-27 08:20:04

**_sprockett_rocket_**

Easy Question

I have a simple Flash piece that requires a user to click on a picture which then reveals an answer underneath. This was very easy to build, but I'm having trouble making it share-able Flash piece for Adobe Connect. I've been going through the Collaboration Builder SDK over and over and it's not been very helpful to me; maybe just because I'm not especially proficient at AS2.

Each cover (12 in all) has a code similar to this:

cover1.onPress = function() {
    if (Key.isDown(Key.CONTROL) && Key.isDown(Key.SHIFT)) {
        this._visible = false;
};

Any suggestions on what I should add so that the SyncConnectors update each other every time something is clicked (MouseDown, I'm assuming)? A specific example of the code you have in mind would be perfect, since, as I mentioned, I'm not the best at AS.

Last edited by **_sprockett_rocket_** (2009-07-28 14:29:52)

Offline

#2 2009-07-27 10:49:55

alistairlee

Re: Easy Question

You'll need to add a couple of things for each (and every) event that you want shared.

Once you've added the SDK component onto your flash application, you'll need to broadcast any events you want synchronized.  You use the function called 'dispatchSyncMessage' and send it a message name and message value.  The name is a string value, the message value can be an object.  For example:

syncConnector.dispatchSyncMessage("hideCover",cover1)

You'll also need a function to listen for any of those broadcast messages.  Something like this:

function syncMessageReceived(p_evt:Object)
{
  if (p_evt.messageName == "hideCover")
    {
       p_evt.messageValue._visible = false;
     }
}

I did a introduction to the SDK during a Best Practices User Group Meeting.  You may want to check out the recording:
http://www.connectusers.com/groups/best … vents/356/

Offline

#3 2009-07-28 14:28:57

**_sprockett_rocket_**

Re: Easy Question

Thanks, Alistair. I have been working on this all day and I'm burning out. I watched your presentation, which was more accessible than the SDK guide, but hasn't brought me much closer to syncing my Flash file.

Maybe you can see what I'm doing wrong just from my code:

cover1.onPress = function() {
    if (syncConnector.role == BreezeSyncConnector.k_PARTICIPANT) {
        this.onPress = false;
}
    if (this.onPress) {
        this._visible = false;
}
    syncConnector.dispatchSyncMessage("hideCover", cover1);
};



syncConnector.addEventListener ("MessageReceived", cover1);
syncConnector.addEventListener ("hideCover", cover1);



function syncMessageReceived(p_evt:Object)
{
  if (p_evt.messageName == "hideCover", cover1)
    {
       p_evt.messageValue._visible = false;
     }
}

I have tried a dozen different changes and I have a feeling I'm close to debugging it... but I'm out of ideas on what could be wrong. Any help would be great!

Offline

#4 2009-07-28 15:05:36

alistairlee

Re: Easy Question

I'm no expert, but I've got a couple of ideas.

First - you've got an error in your syncMessageReceived function.  The 'if' statement shouldn't include the ',cover1' text.  Just use the following:

if (p_evt.messageName == "hideCover")

Second - the code that I used in my original example may not resolve the messageValue properly.  Try using the following:

  this[p_evt.messageValue]._visible = false;

That should work - but I would temporarily hard code the value until you get it working, then replace the hard coded value with value you are passing.  The whole function would like like this:

function syncMessageReceived(p_evt:Object)
{
  if (p_evt.messageName == "hideCover")
    {
       cover1._visible = false;
     }
}

Offline

Board footer