2 Replies Latest reply on Feb 3, 2010 3:12 PM by jimmyoneshot

    Event Handler and Event.complete question

    jimmyoneshot Level 1

      I am interested in finding out about the event.complete function and using it in my app. In my app I have html components and I have a function I've made which I don't want to actually activate UNTIL all the html components have loaded fully.


      Can this be achieved through the event.complete class and if so how?


      Lets say for example I have html components with ids of myhtl1 and myhtml2 and a function I've made called load, what code would I need to apply in my app to make sure that the load function doesn't activate until AFTER the hmtl components are fully loaded and am I on the right track thinking that this could be achieved by listening to the event.complete classes of the 2 html components?


      It makes sense to me but putting it into code is where I'm struggling.

        • 1. Re: Event Handler and Event.complete question
          Jason Szeto Level 3



          I'd recommend reading the Flex 3 Dev Guide, Chapter 4 on Events. http://livedocs.adobe.com/flex/3/devguide_flex3.pdf

          This will explain the event model and how to dispatch and listen for events.


          As I mentioned to you earlier, you'll need to play around with listening either to the complete event or the htmlRender event from mx:HTML.


          Good luck,


          1 person found this helpful
          • 2. Re: Event Handler and Event.complete question
            jimmyoneshot Level 1

            Thanks again Jason.


            I managed to find a solution that listens for a html component to complete it's loading and then despatches an event:-


            http://airexamples.com/2009/01/04/determining-when-an-html-control-has-finished-loading-in -adobe-air-using-flex/


            I probably just need to replace the event in that example with my screenshot event (which you already know of) and then do the same for every one of the html components I have which unfortunately I have about 50 of. This may speed up the loading time as it will mean that I don't have to have a function constantly loading these images (which is what I was recommended in my looping a function thread which also works) and each image will appear only when it's corresponding html component has finished loading. Should work well I think.


            Am I thinking along the right lines here when considering the intention of this is a method to have live thumbnails of websites within an app without the use of placing images on a server or is there a better method you can think of that can be achieved in flex alone?


            I find working with existing examples and adapting them to my own apps is my best way to learn but I'll check out those docs too. Thanks a lot. All the best.