Solved

Flash Callback functions

Posted on 2004-03-22
5
142 Views
Last Modified: 2010-04-03
This one should be easy but not sure why this doesnt work......I have a webservice call.  When the onResult event fires...I need it to call another method.  But it doesnt.  

public function getThisData() {
      
            
            var aRes:Object = _global.sessionSvc.getThis();
            aRes.onResult = function( sResult ) {
                                    trace("Calling getThatData Method");
                    getThatData();
            }
            
            aRes.onFault = function( res ) {
                  trace("Error getting This");
            }                              
      }

      public function getThatData() {
            trace("In getThat Method");
            var bRes:Object = _global.motionSvc.getThat();
                        
            bRes.onResult = function (cResult) {
                  trace("In getThat OnResult");
                                }
                               
                                bRes.onFault = function( res ) {
                  trace("Error getting That");
            }
               }

I get this trace statement.....

trace("Calling getThatData Method");

But not this one...

trace("In getThat Method");


Why???????????????????????????????????????????


thanks,

knoxxx
0
Comment
Question by:JohnnyKnoxville
  • 4
5 Comments
 
LVL 5

Expert Comment

by:stef4s
Comment Utility
//Try this

//instead of

aRes.onResult = function( sResult ) {
                                    trace("Calling getThatData Method");
                  getThatData();
          }

//

aRes.onResult = function( sResult ) {
                                    trace("Calling getThatData Method");
                  this.getThatData();
          }
0
 

Author Comment

by:JohnnyKnoxville
Comment Utility
Still no luck.  It seems like when I enter..

aRes.onResult = function( sResult ) {
                                    trace("Calling getThatData Method");
                  getThatData();
          }


I cannot leave to go to another method.  If I place the 'getThatData()' call outside of the function {} it gets called.  But I need it to be called AFTER the onResult event fires.
0
 
LVL 5

Expert Comment

by:stef4s
Comment Utility
call it with

this. getThatData();
0
 
LVL 5

Expert Comment

by:stef4s
Comment Utility
sorry no space

this.getThatData();
0
 
LVL 5

Accepted Solution

by:
stef4s earned 100 total points
Comment Utility
JohnnyKnoxville did it work?
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now