Code: Select all
on mouseup
open socket to strSocketConnection with message "connected"
end mouseUp
on connected theHost
--connected so login
put fld "fldUsername" into strUsername
put the userPassword of fld "fldPassword" into strPassword
write "*LOGIN::" & strUsername & "::" & strPassword to socket theHost
set label of button "Connect" to "Disconnect"
read from socket theHost with message "readSomething"
end connected
If I move the stuff in 'on connected' into the mouseup (commenting the 'with message' portion of the 'open socket') it works, but it seems better to have the connection broken out into its own handler.
So, once again, what am I missing?