Discussion list for Unity developers.
unity-dev at moock.org
Tue Dec 19 14:28:44 CST 2006
Hello,
I am trying to incorporate Unity into my web app for work. We are a
non-profit lab and our group is just myself and one other semi-
developer. Can someone please help me?
Here is the scenario: Each person logged in has a view of a screen
with 4 buttons on it. When one user selects a button, it becomes
selected on everyone else's screen. If another user changes the
selection, everyone's is changed. I was thinking of using a "room
variable" to do this. But between the listeners and the local
variables, I am lost.
Here is my code... I need to hook up something like the chat window
listener so that when I select a button, it sets a room variable
called "whichButtonIsSelected" and some way of having everyone else's
screen constantly check to see the state of that variable.
Is this the right way to do it? I am stuck... and the documentation
and examples works fine for chat, but not for much more.
Thank you so much for your help,
Ryan
Cambridge, MA
import mx.skins.RectBorder;
import mx.core.ext.UIObjectExtensions;
// Listen for send Button clicks.
send.clickHandler = function (e:Object):Void {
sc.sendMessage();
}
// ////////////////////////////////////////////////////////////////////
// Listen for 4 Button clicks.
option0.clickHandler = function (e:Object):Void {
sc.setCurrentButton(this);
}
option1.clickHandler = function (e:Object):Void {
sc.setCurrentButton(this);
}
option2.clickHandler = function (e:Object):Void {
sc.setCurrentButton(this);
}
option3.clickHandler = function (e:Object):Void {
sc.setCurrentButton(this);
}
// ////////////////////////////////////////////////////////////////////
// Listen for enter key presses in outgoing.
var outgoingEnterHandler:Object = new Object();
outgoingEnterHandler.enter = function (e:Object):Void {
sc.sendMessage();
};
outgoing.addEventListener("enter", outgoingEnterHandler);
// Listen for setName Button clicks.
setName.clickHandler = function (e:Object):Void {
sc.setName();
}
// Listen for enter key presses in nameInput.
var nameInputEnterHandler:Object = new Object();
nameInputEnterHandler.enter = function (e:Object):Void {
sc.setName();
};
nameInput.addEventListener("enter", nameInputEnterHandler);
//var currentButton:String = "option0";
//option0.setStyle("themeColor", "haloOrange");
//option0.setStyle("emphasized", "true");
//trace("Current selection is on " + currentButton);