Object inside object not working

14 views
Skip to first unread message

Christen Lorensen

unread,
Mar 13, 2012, 10:29:43 AM3/13/12
to protobuf-actionscript3
Hi

I am using the project to generate protoobject, and it works fine.
But the generated classes are not correct when one class is using
another class.

part form my proto file
------------------------
package HnG_States;

message SearchPlayersResponse
{
required int32 request_id = 1;
required string response = 2; // See
SearchPlayersEventHandler.ReturnValues
repeated player_search_item items = 3;
}
------------------------

I get the file:
-----------------------
// Generated by the protocol buffer compiler. DO NOT EDIT!

package HnG_States {

import com.google.protobuf.*;
import flash.utils.*;
import com.hurlant.math.BigInteger;
import player_search_item;
public final class SearchPlayersResponse extends Message {
public function SearchPlayersResponse() {

registerField("requestId","",Descriptor.INT32,Descriptor.LABEL_REQUIRED,
1);

registerField("response","",Descriptor.STRING,Descriptor.LABEL_REQUIRED,
2);

registerField("items","player_search_item",Descriptor.MESSAGE,Descriptor.LABEL_REPEATED,
3);
}
// required int32 request_id = 1;
public var requestId:int = 0;

// required string response = 2;
public var response:String = "";

// repeated .HnG_States.player_search_item items = 3;
public var items:Array = new Array();

//fix bug 1 protobuf-actionscript3
//dummy var using HnG_States. necessary to avoid following
exception
//ReferenceError: Error #1065: Variable NetworkInfo is not
defined.
//at global/flash.utils::getDefinitionByName()
//at com.google.protobuf::Message/readFromCodedStream()
private var itemsDummy:HnG_States.player_search_item = null;


}
}
-----------------------

This will create an error: import player_search_item;
it is not using the package

What to do?

Christen Lorensen

unread,
Mar 14, 2012, 6:18:40 AM3/14/12
to protobuf-actionscript3
Tried to submit it as an issue but I cannot submit.

Christen Lorensen

unread,
Mar 14, 2012, 8:09:45 AM3/14/12
to protobuf-actionscript3
Made a quick fix.

Removed the code that makes this line from the file as3_message.cc:
import player_search_item;

because it is referenced in the line where it uses it:
private var itemsDummy:HnG_States.player_search_item = null;

No compile errors anymore.

On Mar 13, 3:29 pm, Christen Lorensen <c...@reto.dk> wrote:
Reply all
Reply to author
Forward
0 new messages