Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

+ Reply to Thread
Results 1 to 3 of 3
  1. #1

    Default HELLLP for shareobject error either client side and server side plezz i'm beginner

    i've error like net.connection is fail the client code :
    Code:
    var key:Keyboard;
    var drawer:Boolean;
    var erasertool:Object;
    var X;
    var Y;
    var nc:NetConnection;
    var slot;
    var line = new Object();
    var drawObject:SharedObject;
    var textformat:TextFormat = new TextFormat();
    var activeColor:uint = 0x000000;
    graphics.lineStyle(5,0x000000);
    drawer = false;//to start draw
    initSharedObject();
    stage.addEventListener(MouseEvent.MOUSE_DOWN, startDrawing);
    stage.addEventListener(MouseEvent.MOUSE_MOVE, dodraw);
    stage.addEventListener(MouseEvent.MOUSE_UP, stopDrawing);
    erasertool.addEventListener(MouseEvent.CLICK, eraser);
    txt.addEventListener(MouseEvent.CLICK, texto);
    rect.addEventListener(MouseEvent.CLICK, recto);
    cir.addEventListener(MouseEvent.CLICK, ciro);
    function startDrawing(event:MouseEvent):void {
    X = mou***;
    Y = mouseY;
    graphics.moveTo(X,Y);
    drawer = true;
    }
    function dodraw(event:MouseEvent) {
    if(this.drawer){
    graphics.lineTo(mou***, mouseY);
    }
    }
    function stopDrawing(event:MouseEvent) {
    drawer = false;
    line.x1 = mou***;
    line.y1 = mouseY;
    line.x2 = mou***;
    line.y2 = mouseY;
    slot = "line_" + X + "-" + Y + "X" + mou*** + "-" + mouseY;
    drawObject.data[slot] = line;
    }
    function eraser(event:MouseEvent){
        var blank = new Sprite;
        var erasertool = new Object;
        graphics.beginFill(0xFFFFFF);
        graphics.drawRect(0, 0, stage.width, stage.height);
        graphics.endFill();
        drawObject.data[blank] = erasertool;
        nc.call("l", erasertool);
        addChild(blank);
        drawer = false;
    }
    function texto(event:MouseEvent){
        var textfield = new TextField();
        var texttool = new Object;
        textfield.type = TextFieldType.INPUT;
        textfield.autoSize = TextFieldAutoSize.LEFT;
        textfield.selectable = false;
        textfield.defaultTextFormat = textformat;
        textfield.textColor = activeColor;
        textfield.x = mou***;
        textfield.x = 250;
        textfield.y = mouseY;
        textfield.y = 150;
        stage.focus = textfield;
        drawObject.data[textfield] = texttool;
        nc.call("c", texttool);
        stage.addChild(textfield);
    }
    function recto(event:MouseEvent){
        var c = new Shape;
        var fa = new Object;
        graphics.beginFill(0xFFFFFF);
        graphics.drawRect(30, 40, 70, 75);
        graphics.endFill();
        drawObject.data[c] = fa;
        nc.call("b", fa);
        addChild(c);
        drawer = false;
    }
    function ciro(event:MouseEvent){
        var k = new Shape;
        var circletool = new Object;
        graphics.beginFill(0xFFFFFF);
        graphics.drawCircle(stage.width, stage.height,100);
        graphics.endFill();
        drawObject.data[k] = circletool;
        nc.call("a", circletool);
        addChild(k);
        drawer = false;
    }
    
    function initSharedObject() {
    var nc = new NetConnection();
    nc.addEventListener(NetStatusEvent.NET_STATUS , onConnection);
    function onConnection(event:NetStatusEvent) {
    trace(event.info.code);
    if (event.info.code == "NetConnection.Connect.Success") {
    drawObject = SharedObject.getRemote("user2", nc.uri, true);
    drawObject.connect(nc);
    drawObject.addEventListener(SyncEvent.SYNC, syncit);
    function syncit(event:SyncEvent) {
    for (var n:String in event) {
    var line = this.data[event[n].name];
    graphics.moveTo(line.x1, line.y1);
    graphics.lineTo(line.x2, line.y2);
    }
    }
    
    }
    }
    nc.connect("rtmp://192.168.0.1/draw");
    }
     and the server side for draw class:
    application.onAppStart = function()
    {
      trace("The deux is out of the deck");
      this.drawObject = sharedObject.getRemote("user2", true);
    };
    application.onConnect = function(currentClient){
        this.drawObject.send("user2",x,y);
        }
        currentClient.user2 = function(x,y){
            this.drawObject.lineTo(mou***,mouseY);
        }
        currentClient.user2 = function(x,y){
            this.drawObject.moveTo(mou***, mouseY);
        }
            currentClient.b = function(){
                this.drawObject.drawRect(30,40,70,75);
                }
        currentClient.a = function(){
            this.drawobject.drawCircle(stage.width, stage.height, 100);
        }
        currentClient.l = function(){
                this.drawObject.drawRect(0,0, stage.width, stage.height);
                
            }
            currentClient.c = function(){
                this.drawObject.send("c");
                
            }
        
    }
    application.onDisconnect = function(currentClient)
    {
        trace("disconnect: "+currentClient.name);
        this.drawObject.setProperty(currentClient.name, null);
    };

    i've error TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at Untitled_fla::MainTimeline/stopDrawing(), the problem is in stop drawing, ciro, texto, eraser, recto function did u know how to fix.. plezz urgent..
    Last edited by Vlykarye; 09-29-2011 at 03:05 AM.

  2. # ADS
    Join Date
    Always
    Posts
    Many
     
  3. #2
    Join Date
    Jun 2009
    Location
    Houston, Tx
    Posts
    485

    Default

    Sup bro. Few pointers.
    One: I already know your beginner; you're posting here.
    Two: Could you read the forum rules instead of just begging for help? Then you would know what information would be helpful to post.
    Three: I know you need this urgently, but it would help if you used the CODE tags to set apart your code from your question. That way I can easily look at your code in code form; instead of looking at it how it is all jumbled up and continuous.
    Four: Don't take these as personal attacks. I'm just here to help you with your future posts.

  4. #3
    Join Date
    Jun 2009
    Location
    Houston, Tx
    Posts
    485

    Default

    Ok. How about you post the actual files. Idk if you even bothered to take into consideration what someone has to go through in order to help you. Looking at a bunch of code is one thing. Your code has no syntactical problems. The problem you are probably facing is a logical problem, which depends on 1) what you are trying to do, 2) where you placed your code, and 3) how your client and server are trying to communicate.

    I obviously cannot read your mind; no one can. So you will need to post a lot more information or just post your files. When you do, I'll try to get back to you.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial