6 Replies Latest reply on Feb 4, 2009 7:07 PM by Newsgroup_User

    How to Reset/ReCreate screen items

    EWN-CMI
      I would like for my "application" areas to "reset" to its initial onComplete whenever a user leaves an area of the application and then returns. An example would be a login/registration tab off a main page. The user can either login or register. If the user selects the registration option - I would change the currentState to registration. If the user then decides to go back the the main (home page) before completing the registration process, looks around a bit and then selects the login/registration tab again - I would like the login/registration default state to be active but currently the old "registration" state is used. Is there anyway to reCreate or emulate onComplete? I should not have to reset the initial state of each tab under all the other tabs, should I?? All help is appreciated.
        • 1. Re: How to Reset/ReCreate screen items
          ice9_us
          i do this by how they move in my site...
          1. I have a timer that resets based on no activity
          2. anytime they click to move someplace, or hover a mouse over some location i reset the states inthe action script "AND" clear data from any variables involved with that function.. then run System.GC to flush the memory...

          • 2. Re: How to Reset/ReCreate screen items
            EWN-CMI Level 1
            Thanks Ice - but there has to be a better way. The method you use is the one that I really don't want to use. I don't want to have to manage all my unused/inactive tabs. I build each of my tab modules as customComponents outside the main app and really don't want to have to consider other application items in them. I don't know if my approach is remotely correct, but it keeps my app mxml neat and clean. I would like to be able to use for example the login/registration tab in multiple applications without change or knowing what the other parts of the app is doing. Thanks again, but hopefully there is a better way.
            • 3. Re: How to Reset/ReCreate screen items
              Level 7

              "EWN-CMI" <webforumsuser@macromedia.com> wrote in message
              news:gmd2ni$api$1@forums.macromedia.com...
              > Thanks Ice - but there has to be a better way. The method you use is the
              > one
              > that I really don't want to use. I don't want to have to manage all my
              > unused/inactive tabs. I build each of my tab modules as customComponents
              > outside the main app and really don't want to have to consider other
              > application items in them. I don't know if my approach is remotely
              > correct,
              > but it keeps my app mxml neat and clean. I would like to be able to use
              > for
              > example the login/registration tab in multiple applications without change
              > or
              > knowing what the other parts of the app is doing. Thanks again, but
              > hopefully
              > there is a better way.

              Create a Resettable interface, then call the reset() function of the object
              corresponding to the change event's oldIndex if the child of the
              TabNavigator is a Resettable.

              There's an example on my blog about using an interface in a way similar to
              this that I posted a week or two ago.

              BTW, seen any good sourdough starter lately?


              • 4. Re: How to Reset/ReCreate screen items
                EWN-CMI Level 1
                Amy,

                Thanks for the input, I looked at the blog example but still don't see how I could use it to solve my issue. I'll try to research a resettable interface.

                BTW, check your email for sourdough - I will send it once the wife finds it.
                • 5. How to Reset/ReCreate screen items
                  levancho Level 3
                  you can refresh the page with external Interfaces Call :) that will reload swf recall creationComplete and reset everything :)
                  • 6. Re: How to Reset/ReCreate screen items
                    Level 7

                    "EWN-CMI" <webforumsuser@macromedia.com> wrote in message
                    news:gmdhqa$roj$1@forums.macromedia.com...
                    > Amy,
                    >
                    > Thanks for the input, I looked at the blog example but still don't see how
                    > I
                    > could use it to solve my issue. I'll try to research a resettable
                    > interface.

                    You'll have to create it.

                    It will look something like

                    package com.yourDomain
                    {
                    public interface Resettable
                    {
                    function reset():void;
                    }
                    }

                    Then each class you build will need to have a reset method that takes no
                    arguments and returns nothing (or you can change the interface it you want
                    arguments or a return). Inside that method, you take care of whatever you
                    need to do to reset.

                    If you notice in the example, all four of the implementations of the
                    interface are different. In one implementation, the Application changes the
                    backgroundColor of a Canvas. In the Flash movie as a whole, the methods
                    transmit the command down to the child Blushers (more or less). In the
                    rectangle inside the Flash movie, it does a goToAndStop(), and in the
                    circle, it uses Tweener to tween the color.

                    That's the point of interfaces...they're a contract that says "I have this
                    method available, you can call it this way." And then the implementation is
                    specific to the component that implements it.

                    If you don't already have the book ActionScript 3 Design Patterns, I highly
                    recommend it.

                    > BTW, check your email for sourdough - I will send it once the wife finds
                    > it.

                    :-)