9 Replies Latest reply on Jul 13, 2009 9:52 AM by DanJustason

    Flex Development Question


      Good day,


      I'm starting up my first Flex project and I have a question.


      First off, a little info. I'm a Computer Programming Technology student that just finished the first year. I've picked up C++, VB.Net, HTML, SQL, PL/SQL and a few other OOAD courses, so I know a bit, but still have a lot to learn.


      The project I'm working on is a small Baseball game. I have a MySQL database created with 2 teams and attributes for the players for which I'm going to be running computations for the inning to inning play.


      My first question is the proper order in which to develope my Flex page. I'm not sure if I should develope the page itself, load the players and attributes into text fields, and then use Actionscript with the textfields, or if I should be loading the data into array collections to do my computations. I'm thinking the array collections, but just haven't had enough experience yet to know for sure.


      So basically...what's thr first step? The website, or the script?



      Thanks for any suggestions you might have,



      Daniel Justason

        • 1. Re: Flex Development Question
          meshgraphics Level 2

          If you don't have a good grasp of OO reusability, be prepared to rip it up and start over again... repeat as necessary.


          Organisation is the name of the game.

          • 2. Re: Flex Development Question
            DanJustason Level 1

            Well, let's say you're creating your first C++ program and you choose, say, "Hello World". How concerned are you with OO reusability?


            I'm just picking up Flex and have a small program idea to play around with to get used to Actionscript and MXML. I've got a good grasp on OOAD and OOP, I'm just not sure how that matter at the moment.


            Anyone else?

            • 3. Re: Flex Development Question
              meshgraphics Level 2

              Man Oh Man!  What is wrong with the Feminist Daycare Generation?  Every little thing is a threat to their egomania.


              You can do it sweetheart.  All you need is CONFIDENCE.  You can do anything... pur..

              • 4. Re: Flex Development Question
                DanJustason Level 1

                Sorry, didn't mean to come off snarky. I'll try this again.


                I'm going to be loading data from a MySQL server via PHP and displaying it on a Flex page. I'll also be using Actionscript to play with the values that I bring into the page. Should I be looking to display the values in a datagrid and then using the values in the datagrid to do my computations, or should I be loading it into an arraycollection to do the math?

                • 5. Re: Flex Development Question
                  meshgraphics Level 2

                  That will be the least of your problems.  Try both and see which one works best.


                  You have a lot of work to do.  Try things, fail, read tutorials.  There's a million ways to make a game.


                  • 6. Re: Flex Development Question
                    John Hall Level 4

                    Meshgraphics is actually spot on, there's probably no shortcut to just trying a bunch of stuff and hit the walls. I think if I were doing it I would take your second approach of returning the data as an AC and then maybe create new objects within Flex out of that data. So I'd probably use the db to store data then bring it in and create team objects, game objects etc, whereever you're going with it. I think that would give you the best experience using Flex because you'll have to deal with creating objects in ActionScript and figure out how databinding might help you with the display of properties. Sounds like it would be fun to at least have some project in mind as you experiment.

                    1 person found this helpful
                    • 7. Re: Flex Development Question
                      DanJustason Level 1

                      Thanks. It's mainly my unfamiliarity with Flex that causes me to ask the question. In the languages I've learned it's been better to use the arrays, just didn't know if it was easier/more effective in Flex to use an array or manipulate objects like datagrids. I do plan on banging away and trying out things in Flex, was just stuck out of the starting gate cause I didn't want to pick up a bad habit right off the hop. Could have been that arrays were horrible in Flex.


                      Anyways, thx again.

                      • 8. Re: Flex Development Question
                        John Hall Level 4

                        Nothing at all wrong with arrays or, in Flex, array collections (which carry with them some databinding capability that plain arrays don't have). But the arrays might be arrays of objects like teams or venues or games which are themselves custom classes that you create, much like in java or whatever other languages you're using. The datagrid itself doesn't really enter the equation imho except as one way to display data. The data provider for the datagrid is where the action is - the actual data itself which will be constructs that you create be they custom classes call Teams and Games etc or just a collection of properties. That's why it's always tough to say what's the "best" approach.


                        Since one of the things that make Flex a bit different than Flash or other languages is the concept of databinding, it's probably worth your while to get a sense of what's under the hood with that. Michael Labriola's presentation is a pretty good starting place.



                        • 9. Re: Flex Development Question
                          DanJustason Level 1

                          Thanks John,


                          I've been going over some tutorials and picking up a lot of info and it's making sense so far. I like Flex, and I'm pretty sure I can get it to do what I want it to. I do have another question though that's been plaguing me. Is there an easy way of grabbing the data out of an array or array collection and dynamically display it? For example, this is my proposed layout:


                          Combobox (To select which team to load)


                          Player  Hitting Speed Power Fielding ect ect.

                          1          10        5          8        12       -     -

                          2           12       4          9         8        -     -

                          "            "         "          "          "        "     "



                          I'm going to have 9 players to start, and 7 columns. I was hoping that there was a container that I could use to organize the 63 fields and populate through a loop from a 2d array, instead of having 63 labels/text fields and loading individually (p1Player, p1Hit, p1Speed......p2Player, ect.)


                          I'm thinking a grid, but from what I've seen, a grid is just a grid to hold other objects, so I still end up with 63 objects. Any suggetions?