Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Remoting / April 2004



Tip: Looking for answers? Try searching our database.

Flash Remoting and Cold Fusion Issues

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mjtanzer - 23 Apr 2004 19:07 GMT
I am just getting started with Flash Remoting and Cold Fusion so I apologize
for the newbie question, but I have been spinning my wheels trying to figure
out this problem. I am using a very simple example that I took from the
developer site and have modified it to return a string from a cfm file into a
Flash text field.

If I use the old standard of including the  "NetServices.as" file at the top
of the actionscript file and export as actionscript 1.0, I have no problems.

However, when I try to use the newer method of not including the
"NetServices.as" file at the top of the actionscript file and making sure all
of my standard classpaths are in place - $(UserConfig)/Classes, the current
directory, and the standard classpath to the classes folder in first run - and
publishing as Actionscript 2.0, I can't make a gateway connection.
-----------------------------------------------------------------
Here is the simple cfm code that I'm using:

<cfset tempStruct.helloMessage = "Hello World">
<cfset Flash.Result = tempStruct.helloMessage>
------------------------------------------------------------------
Here is the Actionscript:

//#include "NetServices.as"


NetServices.setDefaultGatewayUrl("http://localhost:8500/flashservices/gateway");
var gatewayConnection = NetServices.createGatewayConnection();
var CFMService = gatewayConnection.getService("helloExamples", this);

helloWorld = function() {
    CFMService.helloWorld();
}
helloWorld();

function helloWorld_Result ( result )
{
   returnField_txt.text = result
}

--------------------------------------------------------------------------------
--------------------------------------
here are the pertinent variables from the output window when exported as
actionscript 1.0:
This works fine-

Variable _global.NetServices = [object #55, class 'Object'] {
    gatewayUrl:undefined,
    setDefaultGatewayUrl:[function 'setDefaultGatewayUrl'],
    setGatewayUrl:[function 'setGatewayUrl'],
    createGatewayConnection:[function 'createGatewayConnection'],
    getHostUrl:[function 'getHostUrl'],
    isHttpUrl:[function 'isHttpUrl'],
    trace:[function 'trace'],
    getVersion:[function 'getVersion'],
    defaultGatewayUrl:"http://localhost:8500/flashservices/gateway"
  }
Level #0:
Variable _level0.$version = "WIN 7,0,14,0"
Variable _level0.helloWorld_Result = [function 'helloWorld_Result']
Variable _level0.gatewayConnection = [object #64, class 'NetConnection'] {
    contentType:"application/x-fcs"
  }
Variable _level0.CFMService = [object #65, class 'NetServiceProxy'] {
    nc:[object #64, class 'NetConnection'],
    serviceName:"helloExamples",
    client:[movieclip:_level0]
  }

--------------------------------------------------------------------------------
-----------------------------------
And here are the same variables with actionscript 2.0:
this isn't working-

Level #0:
Variable _level0.$version = "WIN 7,0,14,0"
Variable _level0.helloWorld_Result = [function 'helloWorld_Result']
Variable _level0.gatewayConnection = undefined
Variable _level0.CFMService = undefined
Variable _level0.helloWorld = [function]
Edit Text: Target="_level0.returnField_txt"
    variable = null,
    text = ,
    htmlText = ,
    html = false, textWidth = 0, textHeight = 0, maxChars = null,
    borderColor = 0x000000, backgroundColor = 0xFFFFFF, textColor = 0x000000,
border = true,
    background = true, wordWrap = false, password = false, multiline = false,
    selectable = true, scroll = 1, hscroll = 0, maxscroll = 1,
    maxhscroll = 0, bottomScroll = 1,
    type = "dynamic",
    embedFonts = false, restrict = null, length = 0, tabIndex = undefined,
    autoSize = "none",
    mouseWheelEnabled = true, condenseWhite = false, styleSheet = undefined

--------------------------------------------------------------------------------
-----

I am working on Windows XP Pro with Flash MX 2004 Professional and Cold Fusion
MX.
This is making me crazy and any help would be appreciated,

Mark
pstnotpd - 26 Apr 2004 07:31 GMT
Mark,

I don't understand what you mean with the 'second method'. As far as I'm aware
the #include "NetServices.as" must still be there, at least until the actual
remoting component is available from MM (where is it?) or unless you use the
beta component available on http://www.person13.com/flashremoting/index.php.

The MM course manuals I have still use the #include regardless.

The rewrite of the remoting components for 2004 still seems to be in AS 1 and
was only an overhaul to allow it to compile and work on AS2.

Further if you plan to use classes you'd have to import them first, of have an
#include which imports them.

Short answer: keep using the #include
mjtanzer - 26 Apr 2004 15:19 GMT
HI, thanks for the response. I am sure I am overlooking something basic here
but what I meant by the 'second method' was based on what I read in the "Flash
Professional 2004 Unleashed" book in chapter 23. It states that "because of
Flash's new classpath, you do not need to use an #include action as you would
have in previous versions."  I have set up the classpaths in the Actionscript
2.0 settings to include my source folder and the AS classes in the First Run
folder.

As I said, if I compile using AS1 and the #include "Netsevices.as"  all is
well. After setting the correct classpaths, and compiling with AS2 without the
#include "Netservices.as"  the compile is also fine, but I can't make a
connention to the gateway. If I try to add the #include "Netsevices.as" and
compile in AS2 I get this message: "**Error** Scene=Scene 1, layer=Layer 1,
frame=1:Line 140: The member is private and cannot be accessed."

I hate to be obtuse but I am still in the dark with respect to using Flash
remoting in AS2.

Are you saying that there is not an AS2 version of the remoting component
available yet and that I should compile as AS1?

Thanks, Mark
mjtanzer - 26 Apr 2004 18:53 GMT
Hi there, I just thought I would mention that I think I discovered the issue.  
If I uncomment the "import mx.remoting.*; header at the top of the
"Netservices.as" and remove "$(UserConfig)/Classes" from my classpaths it
works. Whew!!

Thanks for your help.

Mark
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.