| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Jul 2003
Posts: 11
|
I have trouble with the following code (I don't know how to describe it) :
Code: function getData_result (result) { _root.tempData = result ; } function load () { trace (_root.tempData) ; } function init () { myService.getData () ; load () ; } init () ; stop(); I'm trying to process the _root.tempData which is a reference to the result returned from service call GetData. tempData is assigned the result value from the service call but I can't access the tempData in the load function. But I can access it if the init function finish executing. Is there a way to access that variable from the same function call? Vincent |
|
|
|
|
|
#2 |
|
Master of Nothing
Join Date: Dec 2002
Location: San Diego, CA
Posts: 2,468
|
You can't access until its populated. Which means after the result handler fires. This would fix it.
ActionScript Code:
|
|
|
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Jul 2003
Posts: 11
|
I see. but I may not want to use load () in the getData_result function every time. Just inside of the init function. Would a setInterval work?
V |
|
|
|
|
|
#4 |
|
Master of Nothing
Join Date: Dec 2002
Location: San Diego, CA
Posts: 2,468
|
I am not going to try and figure out why you don't want to use load() in the result handler. But a watch would work.
ActionScript Code:
Last edited by freddycodes; 07-17-2003 at 02:58 PM.. |
|
|
|
|
|
#5 |
|
Registered User
Join Date: Jul 2003
Posts: 11
|
nope didn't work
. is there another function I can use?V |
|
|
|
|
|
#6 |
|
Registered User
Join Date: Jul 2003
Posts: 11
|
I can access the tempData after init function has been called. but not inside the same function
|
|
|
|
|
|
#7 |
|
Master of Nothing
Join Date: Dec 2002
Location: San Diego, CA
Posts: 2,468
|
I mean it does work, I don't just spew non-working code here for the fun of it, could you post your attempt? Even better to show you it works.
ActionScript Code:
|
|
|
|
|
|
#8 | |
|
Master of Nothing
Join Date: Dec 2002
Location: San Diego, CA
Posts: 2,468
|
Quote:
|
|
|
|
|
|
|
#9 |
|
Registered User
Join Date: Jul 2003
Posts: 11
|
I apologize; I didn't read your code thoroughly. The code I placed above is a simplified version of the code below. The code involves two service calls, a getUTCID to populate a combobox, and loadData which loads saved data from a database and replaces the top item of combobox with the load item. That's the reason for running both functions inside of Init.
ActionScript Code:
I know it's not pretty. I hope you can help. Thanks |
|
|
|
|
|
#10 |
|
Master of Nothing
Join Date: Dec 2002
Location: San Diego, CA
Posts: 2,468
|
Would you not be able to use
ActionScript Code:
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|