On Thursday, September 5, 2002, at 09:01 AM, Sean A Corfield wrote:
> On Wednesday, September 4, 2002, at 11:00 , Jon Gorrono wrote:
>> My tests of using cfset in the 'this' scope have failed to get
>> persistence btween calls to remote methods. For example, I 1)
>> initilialize this.lasterror before any function tag 'declarations', 2)
>> change the value in one method, which also puts the proof into cflog,
>> 3)
>> then call another method (using the same line of code).... blotto! The
>> value gets re-initialized just b4 the second method call...
>
> You don't show your code but I'll bet you are doing something like:
>
> <cfinvoke component="foo" method="bar"/>
> <cfinvoke component="foo" method="fubar"/>
>
> This creates a separate instance for each invoke so your CFC is being
> initialized each time. In order to persist instance data between calls,
> you must use the *same* instance:
>
> <cfset foo = createObject("component","foo")/>
> <cfinvoke component="#foo#" method="bar"/>
> <cfinvoke component="#foo#" method="fubar"/>
>
> Note that you do NOT need a *persistent* scope per se, just a scope that
> covers all the calls you need to make - in the case above, variables
> scope
> (the default) is fine. If you need to access that single instance across
> multiple pages, then request or session scope would be more appropriate.
>
>
Actually, I am *not* invoking the cfc from a cfm page... but, from a
flash file (which of course is on the client side)...
So... all the rules (apparently) change... Here is what I have 'learned'
(plz, don't hesitate to point out flaws):
When invoking cfc's via flash remoting,
1) there is no assumption of the existence of a web browser at all
(could be a stand-alone app)
2) even though the flash movie 'establishes' a connection to the
(flash web) service (aka cfc), each call to any method of the cfc,
causes the constructor code for the cfc to run...ie, each call to the
cfc instantiates the cfc object anew.
3) you can't access client, request, application, or sessions
scopes, even though the page that contains the flash movie might be
generated by a cfm page that has access to (ie, sets) properties of
these scopes. <cfapplciation tags that attempt to initiate any such
scopes from within the cfc, fail (sorta cryptically).
4) you CAN pass stuff back n forth using cookies *if* the cookie
gets written to disk (not a 'memory-resident' cookie) ... but, o'course
now the security problems compound....
Jp
______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists