![]() |
![]() |
||||||
|
|||||||
| Tags: |
![]() |
|
|||
|
How do I create an event handler to check that a class has completed its tasks
before I continue with my next line of code? For example, in the code below, the class that is being used must hit a database before it is able to return a value for myVar. However, the trace statement executes before the value of myVar has been changed. <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete='init()'> <mx:Script> <![CDATA[ public function init():void{ var something:TestClass=new TestClass trace("here="+something.myVar) } ]]> </mx:Script> </mx:Application> |
| Sponsored Links |
|
|||
|
If you are loading from a database you have a listener function on the result,
something like onResult(event:ResultEvent) In that listener function you usually parse the data and then dispatch a (custom) event that the data has loaded. Any object that needs to know about this event, registers for the event and in a listener function you can proceed with your code. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise