# onData

**URL:** <https://forum.kirupa.com/t/ondata/265430>\
**Category:** flash\
**Created:** [July 8, 2008, 8:21pm UTC](https://forum.kirupa.com/t/ondata/265430 "2008-07-08T20:21:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![irafuller](https://avatars.discourse-cdn.com/v4/letter/i/91b2a8/32.png) [@irafuller](https://forum.kirupa.com/u/irafuller)\
**Post date:** [July 8, 2008, 8:21pm UTC](https://forum.kirupa.com/t/ondata/265430/1 "2008-07-08T20:21:55Z")

</div>

I have been piecing some code together to try to get this working and am still having some problems, I can get the connection to establish but I cannot get the onData function to work. If anyone has any insight to this it would be greatly appreciated!

function lsOnConnect(success) {  
if (success) {  
trace (“Connection succeeded!”)  
} else {  
trace (“Connection failed!”)  
}  
}

var socket = new XMLSocket();  
socket.onConnect = lsOnConnect  
if (!socket.connect(‘ipnumber’, 0000)) {  
trace (“Connection failed!”)  
}

socket.onData = function(success){  
if (success){  
trace (“loaded”);  
}  
else {  
trace(“XML did not load”);  
}  
}
