Remoting question
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Macromedia Flash Server > Remoting question




Pages (2): [1] 2 »   Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Remoting question  
Merrill, Jason


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-14-05 10:45 PM

Couldn't find this - thanks to help on the chattyfig lists, I am able to
read in data from a cfc source in Flash using remoting, - cool -  but
how do I go the other way - send variables from Flash to a CFM page
using Remoting (2.0) - does the cfc accept complex data types like
objects/arrays from Flash?

i.e.

var myObject:object =3D {[name:"Product1", myProp1:23, myProp2:34],
[name:"Product2", myProp1:400, myProp2:220]};

Then, in the cfc how do I refer to the object/variable sent from Flash?

Any sample code out there?

Thanks.


Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com
NOTICE:
This message is for the designated recipient only and may contain privile=
ged or confidential information. If you have received it in error, please=
=20notify the sender immediately and delete the original. Any other use o=
f this e-mail by you is prohibited.

=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm






[ Post a follow-up to this message ]



    Re: Remoting question  
Matthew Ganz


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-14-05 10:45 PM

yes, the cfc accepts complex datatypes. i pass an array into my cfc and
here's a stripped down method of what i do with it. basically, i just
loop over the structure and do my sql inserts, for example:

<cffunction name="logThisStuff" access="remote">

<cfargument name="myStructure" type="array" required="yes">

<cfset mLen = ArrayLen(myStructure)>

<cfloop from="1" to="#mLen#" index="someVar">

<cfquery name="logThisStuff" datasource="myDSN">
INSERT INTO logTable(
// the fields )

VALUES (

// the values iterated over by the loop)

</cfquery>
</cfloop>
<cfreturn "1"> // send this back to flash so you know your code
is working...
</cffunction>


it's basic, i know. but hope it helps.

matt.

Merrill, Jason wrote:

>Couldn't find this - thanks to help on the chattyfig lists, I am able to
>read in data from a cfc source in Flash using remoting, - cool -  but
>how do I go the other way - send variables from Flash to a CFM page
>using Remoting (2.0) - does the cfc accept complex data types like
>objects/arrays from Flash?
>
>i.e.
>
>var myObject:object = {[name:"Product1", myProp1:23, myProp2:34],
>[name:"Product2", myProp1:400, myProp2:220]};
>
>Then, in the cfc how do I refer to the object/variable sent from Flash?
>
>Any sample code out there?
>
>Thanks.
>
>
>Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com
>NOTICE:
>This message is for the designated recipient only and may contain privilege
d or confidential information. If you have received it in error, please noti
fy the sender immediately and delete the original. Any other use of this e-m
ail by you is prohibited.
>
>=---------------------------------------------------------
>Supported by Fig Leaf Software - http://www.figleaf.com
>=---------------------------------------------------------
>
>To change your subscription options or search the archive:
>http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
>
>


=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm






[ Post a follow-up to this message ]



    RE: Remoting question  
Merrill, Jason


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-14-05 10:45 PM

Cool - thanks Matt, that helps - I'll look at it. Now I need some help
on the Flash end with the Remoting 2.0 components - how do you send the
Array from Flash to the CFC via Remoting?

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com









[vbcol=seagreen] 
and[vbcol=seagreen] 
required=3D"yes">[vbcol=seagreen] 
loop)[vbcol=seagreen] 
code[vbcol=seagreen] 
to[vbcol=seagreen] 
Flash?[vbcol=seagreen] 
privileged or[vbcol=seagreen] 
notify the sender[vbcol=seagreen] 
you is[vbcol=seagreen] 

=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm






[ Post a follow-up to this message ]



    RE: Remoting question  
Stefan Richter


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-14-05 10:45 PM

I just had real trouble sending vanilla objects to a CFC. Without going into
much detail: yes you can do it but in my case it was easier to use an
associative array.

var myArr:Array = new Array();
myArr["Product1"] = "apples";
myArr["Product2"] = "pears";

Then on your CFC

<cffunction [...] >
<cfargument name="myobj" required="true" type="struct">
<cfreturn myobj.Product1>
</cffunction>

In my case I also pack another array full of objects into the associative
array. Works fine.
(just some sample code)

<cfset chapters = myArr.chapters>

<cfloop index="chap" from="1" to="#ArrayLen(chapters)#">

#chapters[chap].Chapter#
#chapters[chap].Time#
#chapters[chap].Title#

</cfloop>


Another neat tip is how you can test your CFc in a browser (at least if you
send basic datatypes).
www.domain.com/path/to/cfc/mycfc.cf...¶1=hi¶2
=1234

The Netconn Debugger drives me insane. Seems to have a mind of its own and
refuses to work most times. Bah.


Stefan




-----Original Message-----
From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
[mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.
org] On Behalf Of Merrill, Jason
Sent: Thursday, July 14, 2005 4:16 PM
To: FlashComm Mailing List
Subject: [FlashComm] Remoting question

Couldn't find this - thanks to help on the chattyfig lists, I am able to
read in data from a cfc source in Flash using remoting, - cool -  but how do
I go the other way - send variables from Flash to a CFM page using Remoting
(2.0) - does the cfc accept complex data types like objects/arrays from
Flash?

i.e.

var myObject:object = {[name:"Product1", myProp1:23, myProp2:34],
[name:"Product2", myProp1:400, myProp2:220]};

Then, in the cfc how do I refer to the object/variable sent from Flash?

Any sample code out there?

Thanks.


Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com
NOTICE:
This message is for the designated recipient only and may contain privileged
or confidential information. If you have received it in error, please notify
the sender immediately and delete the original. Any other use of this e-mail
by you is prohibited.

=---------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=---------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm


=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm






[ Post a follow-up to this message ]



    RE: Remoting question  
Merrill, Jason


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-14-05 10:45 PM

OK - cool, good to know thanks! =20

Still need to know the answer to my main question - what is the
Actionscript code using the 2.0 remoting classes to send the object from
Flash to the cfc?

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com









[vbcol=seagreen] 
going into[vbcol=seagreen] 
associative[vbcol=seagreen] 
if you[vbcol=seagreen] 
[vbcol=seagreen] 
and[vbcol=seagreen] 
Jason[vbcol=seagreen] 
to[vbcol=seagreen] 
how do[vbcol=seagreen] 
Remoting[vbcol=seagreen] 
from[vbcol=seagreen] 
Flash?[vbcol=seagreen] 
privileged[vbcol=seagreen] 
notify[vbcol=seagreen] 
e-mail[vbcol=seagreen] 

=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm






[ Post a follow-up to this message ]



    Re: Remoting question  
Matthew Ganz


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-14-05 10:45 PM

well, you need the basics first, i.e. the connection object and then i
just do this:

svc_myService.theRemoteMethod( responseObject, theArray );

the array/object you can populate and set up however you like. the
trick, at least for me, was in looping over it in coldFusion.

and my response object looks s/thing like this:

res_service = new Object();
res_service.onResult = function( result )
{
trace( " response from server: " + result );
};

and that's what the "1" refers to in my last post. if the "1" comes
back, you know that what you did worked.

Merrill, Jason wrote:

>Cool - thanks Matt, that helps - I'll look at it. Now I need some help
>on the Flash end with the Remoting 2.0 components - how do you send the
>Array from Flash to the CFC via Remoting?
>
>Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com
>
>
>
>
>
>
>
>
>
>
>
> 
>and
>
> 
>loop)
>
> 
>code
>
> 
>to
>
> 
>Flash?
>
> 
>privileged or
>
> 
>notify the sender
>
> 
>you is
>
> 
>
>=---------------------------------------------------------
>Supported by Fig Leaf Software - http://www.figleaf.com
>=---------------------------------------------------------
>
>To change your subscription options or search the archive:
>http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
>
>


=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm






[ Post a follow-up to this message ]



    RE: Remoting question  
Merrill, Jason


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-14-05 10:45 PM

Thanks  - I'll check it out. =20

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com









[vbcol=seagreen] 
help[vbcol=seagreen] 
the[vbcol=seagreen] 
just[vbcol=seagreen] 
required=3D"yes">[vbcol=seagreen] 
able[vbcol=seagreen] 
but[vbcol=seagreen] 
page[vbcol=seagreen] 
myProp2:34],[vbcol=seagreen] 
by[vbcol=seagreen] 

=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm






[ Post a follow-up to this message ]



    RE: Remoting question  
Merrill, Jason


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-14-05 10:45 PM

Typo in that post I meant - <cfloop from=3D"1" to=3D#mLen# index=3D"i">
instead... but it still returns a query error...

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com









[vbcol=seagreen] 
trouble[vbcol=seagreen] 
get[vbcol=seagreen] 
"Error[vbcol=seagreen] 
Required, Time)[vbcol=seagreen] 
NOTICE:
This message is for the designated recipient only and may contain privile=
ged or confidential information. If you have received it in error, please=
=20notify the sender immediately and delete the original. Any other use o=
f this e-mail by you is prohibited.

=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm






[ Post a follow-up to this message ]



    Re: Remoting question  
Matthew Ganz


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-14-05 10:45 PM

hmm...good question. now my cf scripting abilities aren't as up to par
as my flash ones. normally, if you were using a .cfm page you'd probably
be able to use this:

<cfdump var="#myArray[i]#>
<cfabort />

but i don't think you can dump from a cfc. so i am a little unsure on
how to output those values. i would try just referencing one element in
the array and dumping that into 1 field at first. if the first one
works, you should be able to figure out how to reference the first.

sorry jason, wish i could be of more help here.

matt.

Merrill, Jason wrote:

>Matt  - cool - I was able to receive the array.  Now I am having trouble
>understanding how to pick out the individual values in the array and get
>the query to work.  I get an error returned in Flash which says, "Error
>Executing Database Query"
>
>What I have right now (which isn't working) is this:
>
>In the cfc:
><cffunction name="recieveData" access="remote">
>	<cfargument name="myArray" type="array" required="yes">
>	<cfset mLen = ArrayLen(myArray)>
>	<cfloop from="1" to="#mLen#" index="i">
>           		<cfquery name="updateData" source="coursesDB">
>               		INSERT INTO Lessons(ID, Lesson, Required, Time)
>                		VALUES (#myArray[i]#)
>            	</cfquery>
>       	 </cfloop>
>        	<cfreturn "1">
></cffunction>
>
>In flash:
>var updateService:Service = new Service(/*bunch of stuff*/);
>var myArray:Array = ["hi", "howdy", "hello", "what's up?"];
>var pc:PendingCall = updateService.recieveData(myArray);
>//etc.
>
>If my array is named, "MyArray", how do I refer to the individual
>elements with it?
>
>Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com
>
>
>
>
>
>
>
>
>
>
>
> 
>help
>
> 
>the
>
> 
>just
>
> 
>able
>
> 
>but
>
> 
>page
>
> 
>by
>
> 
>
>=---------------------------------------------------------
>Supported by Fig Leaf Software - http://www.figleaf.com
>=---------------------------------------------------------
>
>To change your subscription options or search the archive:
>http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
>
>


=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm






[ Post a follow-up to this message ]



    RE: Remoting question  
Merrill, Jason


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-14-05 10:45 PM

Yeah, no dice, but thanks.

Anyone else? =20

And thanks very much to Matt and Stefan for getting me 90% there!

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com









[vbcol=seagreen] 
probably[vbcol=seagreen] 
in[vbcol=seagreen] 
trouble[vbcol=seagreen] 
get[vbcol=seagreen] 
"Error[vbcol=seagreen] 
Required, Time)[vbcol=seagreen] 
then i[vbcol=seagreen] 
send[vbcol=seagreen] 
cfc[vbcol=seagreen] 
required=3D"yes">[vbcol=seagreen] 
the[vbcol=seagreen] 
am[vbcol=seagreen] 
-[vbcol=seagreen] 
like[vbcol=seagreen] 
myProp2:34],[vbcol=seagreen] 
from[vbcol=seagreen] 
contain[vbcol=seagreen] 
please[vbcol=seagreen] 
e-mail[vbcol=seagreen] 

=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 08:20 AM.      Post New Thread    Post A Reply      
Pages (2): [1] 2 »   Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register