|
-
[RESOLVED] RangeError: Error #2006: The supplied index is out of bounds. HELP!!!
Hi,
I made shared object application with drawing lines, arrow and circles. Almost everything works fine until I restart application.
Not every time but very often I get this error:
RangeError: Error #2006: The supplied index is out of bounds.
This is code which loading share objects:
function addNewChild(data, name) {
var child = null;
switch(data.toolType) {
case "brush":
child = new ScrappyBrush();
break;
case "arrow":
child = new ScrappyLine();
break;
case "text":
child = new ScrappyTxt();
break;
case "textBox":
child = new ScrappyTxtBox();
break;
case "circle":
child = new ScrappyCircle();
break;
case "bitmap":
child = new ScrappyBMP();
break;
}
if (child) {
child.name = name;
dragTarget.addChild(child);
child.updateSharedObject(this.so);
}
}
I was trying to replace dragTarget.addChild(child); to dragTarget.addChildAt(child,0); but that did not solved my problem.
Can anyone explain me what is wrong?
-
I don't see anything in that code that would throw an index error - can you post the full trace when the swf fails? That should show you exactly what function is breaking. (I suspect it's in one of those constructors)
-
-
Finally I solved that 
The problem was in function mainInit(), I replace part of the code from this function to the function netStatusHandler
Code:
function mainInit() {
// create a connection to the media server
if(nc == null){
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS,netS tatusHandler);
nc.connect("rtmp://localhost/whiteboard");
}
}
public function netStatusHandler(event:NetStatusEvent):void {
if(event.info.code == "NetConnection.Connect.Success") {
this.so = SharedObject.getRemote(args.gidReq+"-"+args.cidReq, nc.uri, true);
this.so.addEventListener(SyncEvent.SYNC,syncEventH andler);
this.so.connect(nc);
trace(event.info.code);
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|