-
December 14th, 2009, 08:07 PM
#1
Issue with scope
I'm very inexperienced, so please bear with me..
I'm using open source code from FlourineFX. I'm needing to get a value from an object, but the scope of the object is limited to being instantiated as part of a parameter (new AmfResult).
_netConnection.Call(command, new AmfResult() , new object[] { file, 103207, true, null, 1.859671316E9 });
Here is AmfResult code:
public class AmfResult : IPendingServiceCallback
{
public void ResultReceived(PollAmf.IPendingServiceCall call)
{
result = call.Result;
}
}
I know nothing of containers, which IPendingServiceCallback is. I can't change the return type, or I'll get a compile error. My question is how can I get the value of result out of this instance?
-
December 14th, 2009, 09:37 PM
#2
Re: Issue with scope
Please post the complete code from when you make the NetConnection.
-
December 15th, 2009, 09:05 AM
#3
Re: Issue with scope
There's not much to it. Most of it I got from the samples
public class AmfConnect
{
public AmfConnect(ArrayList args)
{
ServerConnect(args);
}
private void ServerConnect(ArrayList args)
{
//get args from array list
string server = args[0].ToString();
string command = args[1].ToString();
string file = args[2].ToString();
// Create NetConnection client
NetConnection connection;
connection = new NetConnection();
connection.ObjectEncoding = ObjectEncoding.AMF3;
//connection.NetStatus += new NetStatusHandler(_netConnection_NetStatus);
//This is an example of a good connection
//connection.Connect("http://c.brightcove.com/services/messagebroker/amf");
connection.Connect(server);
//This is an example of a good call
//connection.Call("com.brightcove.player.runtime.PlayerMediaFacade.findMediaById", new AmfResult(), new object[] { 5.3500013001E10, 103207, true, null, 1.859671316E9 });
connection.Call(command, new AmfResult() , new object[] { file, 103207, true, null, 1.859671316E9 });
}
}
public class AmfResult : IPendingServiceCallback
{
object result;
public void ResultReceived(IPendingServiceCall call)
{
result = call.Result;
}
}
-
December 15th, 2009, 09:09 AM
#4
Re: Issue with scope
I am using C# 2008 Express edition.
-
December 15th, 2009, 10:41 AM
#5
Re: Issue with scope
just make a getter for result in afmresult
-
December 16th, 2009, 04:13 PM
#6
Re: Issue with scope
Basically I've got a form class "GetAmf" that has a button, "Go". The code for the go button is:
ArrayList args = new ArrayList { "value1," "value2", "value3"};
AmfConnect VidData = new AmfConnect(args);
After doing some reading and adding some code, similar to what was suggested, I was stepping through and it appears that the "new AmfResult()" in "connection.Call" is not being processed until after VidData is instantiated. I'm assuming this is why I can't access any value generated my AmfResult class.
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
|