3 Replies Latest reply on Jul 24, 2008 11:56 PM by SujitG

    Hammering my procedural shaped brain...

    jmattaboni
      Okay, I'm old school. Last thing I coded was C and now I'm playing 15 years of catchup and trying to learn Flex. I finally figured out what's driving me nuts.

      The thing that bothers me most about Flex is that my data is moved around between objects via events, I never actually *see* the array with the customer's name, address, zip, etc.

      I think if I drilled down into the event in the debugger, I could see it, it just bugs me that it's handed from one ActionScript event handler to another, each time with a new event name (and probably event structure but I don't know for sure).

      Instead of just referring to myArray[ ].firstname throughout the code, it changes every time it's handed from one event to another, ie dataGrid's eventResult.target.itemData.firstname (or whatever) ... how the heck am I supposed to know that's where a Datagrid hides the data?

      Please, help an old dinosaur get comfortable with this newfangled technology. Can anyone give me an anology that helps me put objects and events into perspective? Objects talk to each other via events, yes?

      Can anyone recommend training materials that might help get me going? I have worked my way through Flex 2.0 with ActionScript 3.0 by Charles Brown and I'm about to start Training from The Source by Tapper and LaBriola.
        • 1. Re: Hammering my procedural shaped brain...
          Gregory Lafrance Level 6
          Data in Flex often comes as a result of requests, from HTTPService, WebService, RemoteObject components, so from that standpoint the data from the start is "cloudy".

          Often when data is returned from a request, it can be stored in an ArrayCollection, XMLListCollection, complex Object, or some form of data model. So in this regard you can see the data there.

          Passing data among objects is often best done via events, in some cases this is necessary, in other cases it just makes sense from an architecture perspective.

          Those data requests, HTTPService, WebService, RemoteObject components, are handled asynchronously, so you can't just send the request and assume the data will be immediately available. That's why ResultEvent is so valuable. You don't proceed until the ResultEvent has been dispatched, thus you know your data is available.

          But if the data has been received and you just want to work with it, your objects can intercommunicate to a degree directly on the "dataProvider". I'm not a Flex architecture guru, but I believe this is often done.

          Bottom line is read at least the FB3 help doc section "Adobe Flex 3 Help" and as much of the sub-topics as possible, and you will be surprised how quickly you gain a feel for how Flex "operates" in typical programs.

          Hope this helps.
          • 2. Re: Hammering my procedural shaped brain...
            Level 7

            > Can anyone recommend training materials that might help get me going? I
            > have
            > worked my way through Flex 2.0 with ActionScript 3.0 by Charles Brown and
            > I'm
            > about to start Training from The Source by Tapper and LaBriola.
            >


            Flex 3 Training from the Source
            http://www.amazon.com/Adobe-Flex-3-Training-Source/dp/0321529189/ref=sr_1_1?ie=UTF8&s=book s&qid=1215706046&sr=8-1

            This book builds a shopping cart from scratch (an old metaphor, but a good
            one for teaching the plethora of interconnected bits in Flex). It introduces
            the MVC architecture. I've worked my way through much of it (well, actually
            the Flex 2 version) and it helped give me a basic understanding of Flex that
            I will build on as I get the opportunity to work with it.

            If you get this, and find it gives you enough grasp to be able to move
            forward, you may want to look at Cairngorm
            http://labs.adobe.com/wiki/index.php/Cairngorm or Pure MVC
            http://puremvc.org/component/option,com_frontpage/Itemid,1/ as Architectures
            for your Flex code.


            Cairngorm vs. Pure MVC
            http://blogs.eyepartner.com/adrian/flex/cairngorm-vs-pure-mvc/

            These use their own version of events (that I don't really understand yet!!)
            that may or may not make more sense to you.

            Also, since you can bind your controls to data, you may find that as you get
            a better grasp of things you have less need to fire events around with
            abandon. As a Flex novice, I too find that relying on events is confusing
            and open to trouble. I think that using Architectures helps to tidy that up
            by handling events more centrally so that you don't need to pass them
            around.

            There's also a good book on design patterns that might be useful
            ActionScript 3.0 Design Patterns
            http://www.amazon.com/ActionScript-3-0-Design-Patterns-Programming/dp/0596528469/ref=pd_bb s_sr_1?ie=UTF8&s=books&qid=1215706822&sr=8-1

            It describes various methods that can be employed for architecting your
            code. Should be pretty useful if you have the technical
            knowledge/understanding.

            HTH

            Steve


            --
            http://twitter.com/Stevehoward999

            Adobe Community Expert: eLearning, Mobile and Devices
            European eLearning Summit - EeLS
            Adobe-sponsored eLearning conference.
            http://www.elearningsummit.eu

            • 3. Re: Hammering my procedural shaped brain...
              SujitG Level 2
              Hi,

              This forum category is created for developers who are learning Flex using FLEX IN A WEEK training found at this URL

              http://www.adobe.com/devnet/flex/videotraining/

              Please use this forum for discussing topics related to FLEX IN A WEEK video training courses only. For any other discussion please use the Flex General Discussion category or any other appropriate category.

              Thanks for co-operation and apologies for any inconvenience caused.