flash remoting with coldfusion help!

  • babygodzilla
  • Newbie
  • Newbie
  • babygodzilla
  • Posts: 7

Post 3+ Months Ago

i have a function in my CF component page with a return type of 'array,' and i <cfreturn> this array so i can access it in my Flash movie.
the part i seem to be having trouble with is accessing the array in the movie. so i call the CF method in the movie and supposedly, because i have used the <cfreturn>, i can access the array directly in the movie? i don't know im really poking in the dark here... i am no expert in neither CF nor flash...

basically i want to access an array created in my CFC and display it in my movie

thx a lot! i hope what little i just wrote is comprehensible. there's not much to the code than what i wrote above, so no code now unless u request it.

thx so much again!! :P
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • babygodzilla
  • Newbie
  • Newbie
  • babygodzilla
  • Posts: 7

Post 3+ Months Ago

  • Beginner
  • Beginner
  • User avatar
  • Posts: 45

Post 3+ Months Ago

You might have to parse the array in the Flash movie.
  • babygodzilla
  • Newbie
  • Newbie
  • babygodzilla
  • Posts: 7

Post 3+ Months Ago

parse the array? how's that?
  • Beginner
  • Beginner
  • User avatar
  • Posts: 45

Post 3+ Months Ago

Generally an array is like an apartment building.

Say you have 20 Avenue Street (the name of the array)
In 20 Avenue Street you can have Unit #1, #2, #3 and so on.
In Unit #1 you might have a number stored in there for my example I'll use the number 7, and in Unit #2 a string like "green". and in Unit #3 another string "hello"

What might be happening is the array is in fact loading in Flash but it might be loaded at one big string (My example would yield "7greenhello")

Parsing it would separate it all into something that would make a little more sense.

But a good start would be to see if the array is, in fact, loading in the Flash movie.
  • bozak
  • Born
  • Born
  • bozak
  • Posts: 1

Post 3+ Months Ago

I am trying to do the same thing but am not sure where the problem is:
macromedia documentation is really lame.

so far I have this:
specifically, I am trying to get a cfc return an array into a flash movie.

I am trying to replace
pic_arr = ['1','2','3','4']


pic_arr = [array result from CFC]

slides.cfc looks like: (is this correct?)
Code: [ Select ]
<cfcomponent displayName="grabSlides">
<cffunction name="grabSlides" access="remote" returnType="array">
<cfquery name="rsGrabSlides" datasource="fresh" >
SELECT Picture
<cfset returnArray = ArrayNew()>
<cfset returnArray = grabSlides>
<cfreturn returnArray>
  1. <cfcomponent displayName="grabSlides">
  2. <cffunction name="grabSlides" access="remote" returnType="array">
  3. <cfquery name="rsGrabSlides" datasource="fresh" >
  4. SELECT Picture
  6. </cfquery>
  7. <cfset returnArray = ArrayNew()>
  8. <cfset returnArray = grabSlides>
  9. <cfreturn returnArray>
  10. </cffunction>
  11. </cfcomponent>

AS in .fla file looks like this: I am so far just testing to see if flash will read the array from CFC.
Code: [ Select ]
if (connected == null) {
connected = true;
var my_conn = NetServices.createGatewayConnection();
var myService = my_conn.getService("slides",this);


function grabSlides_Result(result) {
trace(arrayResult); // outputs: a,b,undefined,undefined,undefined
  1. if (connected == null) {
  2. connected = true;
  3. NetServices.setDefaultGatewayUrl("http://flashfusion.net/flashservices/gateway");
  4. var my_conn = NetServices.createGatewayConnection();
  5. var myService = my_conn.getService("slides",this);
  6. }
  7. myService.grabSlides();
  8. function grabSlides_Result(result) {
  9. trace(arrayResult.length);
  10. trace(arrayResult); // outputs: a,b,undefined,undefined,undefined
  11. }

macromedia support docs are totally weak and devoid of examples.

looking through various forums, this is one of THE MOST ASKED QUESTIONS.
get a clue MACROMEDIA .. support docs SUCK!
  • ginx75
  • Born
  • Born
  • ginx75
  • Posts: 1

Post 3+ Months Ago

Code: [ Select ]
_global.resultsRow = "";
    function memberBlanks_Result (selectBlanks) {
        //scrollpage.one_one.text = result;
        len = selectBlanks.getLength();
        // trace(selectBlanks); // an object is returned
        // create our own recordset
        for (i=0; i<len; i++) {
            var resultsRow = selectBlanks.getItemAt(i);
            trace("Q: " + resultsRow.question);
            trace("A: " + resultsRow.answer);
  1. _global.resultsRow = "";
  2. serviceObject.memberBlanks(memberID,chapter,numQuestions);
  3.     function memberBlanks_Result (selectBlanks) {
  4.         //scrollpage.one_one.text = result;
  5.         len = selectBlanks.getLength();
  6.         // trace(selectBlanks); // an object is returned
  7.         // create our own recordset
  8.         for (i=0; i<len; i++) {
  9.             var resultsRow = selectBlanks.getItemAt(i);
  10.             trace("Q: " + resultsRow.question);
  11.             trace("A: " + resultsRow.answer);
  12.         }
  13.     }

This took me a while to find but i finally did. I have columns in my db 'question' and 'answer'.
I also had alot of trouble getting the variables outside of the resutlt function before remembering that i need to declare a variable as a _global.

let me know if it helps!!

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 5 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.