A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: AIR shared object

Threaded View

  1. #1
    Junior Member
    Join Date
    Oct 2008
    Posts
    20

    AIR shared object

    Hi,
    Im working on AIR shared whiteboard in flash. When I draw lines data is send do share object but when I run it one more time not all objects are display on the whiteboard and sometimes I got error:
    RangeError: Error #2006: The supplied index is out of bounds.

    function to read data from shared object:
    public function syncEventHandler (event:SyncEvent) {
    var list = event.changeList;
    for (var i = 0; i<list.length; i++) {
    if (list[i].name == null) continue;
    trace(list[i].name);
    if (list[i].code == "delete") {
    this.dragTarget.removeChild(this.dragTarget.getChi ldByName(list[i].name));
    } else {
    var child = this.dragTarget.getChildByName(list[i].name);
    if (child)
    child.updateSharedObject(this.so);
    else
    this.addNewChild(this.so.data[list[i].name], list[i].name);
    }
    }
    }

    and function addNewChild:

    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;
    }
    if (child) {
    child.name = name;
    dragTarget.addChild(child);
    child.updateSharedObject(this.so);
    }
    }

    Any idea what is wrong.... ?
    Last edited by peem83; 05-20-2009 at 02:40 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center