5 Replies Latest reply on Nov 25, 2009 3:52 PM by cheftmo

    I think this is a problem with Events - please help

    cheftmo Level 1

      Hello all, here is my problem:


      Please look at the project at http://www.timos.com/timos/green/ct/CounterThink.cfm, a collection of cartoons.


      There are two States: the one you see first, describing what this is all about, then the cartoon viewer (press the image on the upper left). The linkButton 'About CounterThink' brings you back to the Base State


      It works fine the way it is set up presently, but I want to reverse the order of the states, i.e., when you first load it I want the cartoon viewer to display first, then give the user the option to read about it. When I switch the order of the Sates is when I run into problems. To see what happens, change the name of the cfm page to CounterThinkNG.cfm (NG=no good), so the URL ends up like this: http://www.timos.com/timos/green/ct/CounterThinkNG.cfm.


      As you can see, the language change works fine either way, but the data for the ComboBox at the extreme right does not get updated. I suspect this is an issue with events, which is why, in View Source, you see the metatags cartoonsLoaded and keywordsLoaded at the top of the main application file. Those are just there because I think I am going to need them, but are not being used anywhere.


      Besides being a complete idiot when it comes to ActionScript, I have been away from doing any Flex work for over a year, so please resist the urge to cringe when you see my code - but this should be a piece of cake for gurus like Greg Lafrance,  Alex Harui of many of you out there. If someone wants to take a look and tell me what I should do, I would be immensely grateful.


      Best regards to all,



        • 1. Re: I think this is a problem with Events - please help
          Gregory Lafrance Level 6

          I tried to replicate this in Flex Builder by View Source, download zip, import Flex project into Flex Builder, but as you might expect, because I don't have your backend, or the resource bundle(s), I couldn't get it to work.


          Just keep and eye on the keywordList ArrayCollection because it is obviously not getting initially populated.


          BTW, you should think of getting rid of the states and using a ViewStack instead, your code is too complex, but I think you already know that


          If this post answers your question or helps, please mark it as such.

          • 2. Re: I think this is a problem with Events - please help
            cheftmo Level 1

            OK Greg, thanks for the reply.


            Here's what I am looking at: when you run the app that is working (CounterThink.cfm), everything works.


            In the NG.cfm, what does not work is when you change the language while in the satate where you see the cartoons, the language itself changes fine, but the keywords ComboBox do not get updated - but it would work if the language selection were not available in that state, like in the "good" cfm page. That' why I'm thinking I have to have the keyword ComboBox wait for some kind of event before it can show the right keyword list.


            I don't see that changing to ViewStack would solve the problem; is there some other angle we can look at this from?




            • 3. Re: I think this is a problem with Events - please help
              Gregory Lafrance Level 6

              This is 50% shot in the dark, 50% analysis, but if you try this maybe it will fix the problem:


              <c:LocaleSelectList id="localeList" creationComplete="localeList_initializeHandler(event)" change="localeList_changeHandler(event)"/>


              where the change is to call localeList_initializeHandler() on the creationComplete event instead of the initialize event.


              The reason I suggest this is because I am wondering if you get the expected results in the version of the app that works because when the Application object executes currentState="intro", and thus localeList_initializeHandler() is called, something else that must be set is in fact set, but in the version that does not work, because the base state is the initial state, localeList_initializeHandler() is called before everything in the base state has been created.


              If the above does not work, you might try calling localeList_initializeHandler() on the Application creationComplete event.

              1 person found this helpful
              • 4. Re: I think this is a problem with Events - please help
                cheftmo Level 1

                OK Greg, I had already tried calling the handler on Application creationComplete; I also tried on the localeList creationComplete, as you suggest. Neither of those worked.


                But I think you are on the right track. I am taking a few hours off the computer today, but later I plan to try moving some of the handlers around; eventually, I'll get it right. When I do, I'll let you see the new code so you know what I did. Thanks for all the help and we'll talk later.



                • 5. Re: I think this is a problem with Events - please help
                  cheftmo Level 1

                  Hello, Greg et al:


                  I figured out the problem and got the project working (sort of): the app did not like 'resetKeywordList()' in 'localeList_changeHandler', so I set the keywordList in the two 'getKWs_[locale]ResultHandlers' directly (result of the calls to my CFC).


                  That fixed the issue, but not completely: if I change language while the KeywordSelect ComboBox (on the right) selected item is not 'ALL' the cartoon AC does not refresh correctly. For now, I am getting around this by disabling the language change ComboBox (on the left) when anything other than ALL is selected. This is not so bad, until I figure out what the problem is.


                  If anyone wants to look, you can access the Main page of the app from here, http://www.timos.com/timos/green/greenPlanet.cfm, by pressing the CounterThink logo at the bottom. The new page, not linked to from my site yet, is   http://www.timos.com/timos/green/ct/CounterThinkNEW.cfm (just insert NEW before the .cfm extension).


                  I know my code could be a lot better and intend to keep working on it, so I would love and really appreciate comments/suggestions that anyone wants to provide.


                  Regards and ciao for now.