# Copyright (c) 2006-2007, Gregory Fleischer (gfleischer@gmail.com) # # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # 3. The names of the authors may not be used to endorse or promote # products derived from this software without specific prior # written permission. # # THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .flash bbox=1x1 version=7 fps=50 filename="xmlsocket.swf" .frame 1 .action: var xmlsocket; var host; var port; var data; var connected; function event_close(event) { getURL('javascript:XmlSocketOnClose(\'' + event + '\');', ''); } function event_connect(event) { getURL('javascript:XmlSocketOnConnect(\'' + event + '\');', ''); } function event_data(event) { getURL('javascript:XmlSocketOnData(\'' + escape(escape(event)) + '\');', ''); } function event_xml(event) { getURL('javascript:XmlSocketOnXML(\'' + escape(escape(event)) + '\');', ''); } getURL('javascript:XmlSocketOnInit();', ''); stop(); .end # labels .frame name="isInitialized" .action: if (FrameLoaded(69)) { getURL('javascript:XmlSocketOnInit();', ''); } stop(); .end # .frame name="create" .action: xmlsocket = new XMLSocket(); xmlsocket.onClose = event_close; xmlsocket.onConnect = event_connect; xmlsocket.onData = event_data; xmlsocket.onXML = event_xml; getURL('javascript:XmlSocketOnCreate(\'' + xmlsocket + '\');', ''); stop(); .end # .frame name="send" .action: if (null != xmlsocket) { xmlsocket.send(_root.data); } stop(); .end # .frame name="connect" .action: if (null != xmlsocket) { xmlsocket.connect(_root.host, _root.port); } stop(); .end # .frame name="close" .action: if (null != xmlsocket) { xmlsocket.close(); xmlsocket = null; } stop(); .end # .frame name="isConnected" .action: if (null != xmlsocket) { _root.connected = xmlsocket.connected; } stop(); .end # .frame 69 .action: stop(); .end .end # eof