7 Replies Latest reply on Aug 7, 2007 9:41 PM by Newsgroup_User

    Flash CS3 vs. Flex Builder 2

    Beatie3 Level 1
      Here's the $64,000 question: should we be developing in Flash CS3 or should we shift over to Flex Builder 2? I maintain that AS 3.0 is a pain in the proverbial, but I've been researching and finding as much help as possible online about it, and I've found that by and large people are using Flex Builder 2 as the basis of tutorials about AS 3.0. Does anyone have an official slant on this question? Should we abandon Flash for Flex? Will it help? Will it mitigate the difficulties non-programmers are experiencing with AS 3.0 - or as I call it simply ***? Would I be getting more responses to my *** questions if I post them over in the *** forum under Flex Builder?
      Any thoughts on this matter would be most welcome, thank you.
        • 1. Re: Flash CS3 vs. Flex Builder 2
          Level 7
          Beatie3,

          > Here's the $64,000 question: should we be developing in
          > Flash CS3 or should we shift over to Flex Builder 2?

          If I answer, will you send me a check? ;)

          > I maintain that AS 3.0 is a pain in the proverbial, but I've
          > been researching and finding as much help as possible online
          > about it, and I've found that by and large people are using
          > Flex Builder 2 as the basis of tutorials about AS 3.0.

          If what you say is true, then my hunch is that your assessment holds, at
          least partly, because Flex Builder 2 has supported AS3 for over a year,
          whereas Flash CS3 -- the first version of Flash to support AS3 -- has only
          been on the market for a couple months, as of this writing. All these
          people blogging about AS3 (or wherever you've been reading your findings
          online) have only been able to use Flex Builder 2 ... unless they tried the
          short-lived public alpha release of Flash 9 ActionScript 3.0 Preview, from
          Adobe Labs.

          > Does anyone have an official slant on this question?

          Ehh, it's a personal preference question, more than anything else.

          > Should we abandon Flash for Flex? Will it help? Will it
          > mitigate the difficulties non-programmers are experiencing
          > with AS 3.0 - or as I call it simply ***?

          What difficulties, in particular, are you talking about? If you count
          yourself among frustrated non-programmers, you should be aware that Flex
          Builder is specifically geared *toward* the coding-inclined. In a sense,
          it's Adobe's answer to Microsoft's Visual Studio or Borland's JBuilder.
          Flex Builder has no drawing tools, no Timeline panel. What it is -- if
          you're a programmer -- is a fantastic scripting IDE based on Eclipse (an
          application traditionally used for Java programming).

          > Would I be getting more responses to my *** questions if
          > I post them over in the *** forum under Flex Builder?

          You'd be posting questions to a hardcore programmer's forum. You'll
          likely get answers to ActionScript 3.0 questions, but you'd less likely get
          answers pertaining to AS3's usage in Flash.

          If you're a traditional Flash designer/developer (as Jen deHaan says, a
          "deseloper), you may very well want to go on using Flash. If you're having
          trouble with ActionScript 3.0, configure your publish settings for
          ActionScript 2.0 and carry on as usual (with the benefit of Flash CS3's new
          UI workflow improvements). Take on AS3 as you can, dipping into it when you
          have a spare moment to experiment.


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: Flash CS3 vs. Flex Builder 2
            Beatie3 Level 1
            Hi David,

            Thank you very much, that's exactly the sort of answer I needed. Hmmm, cheque's in the mail. ;)

            I'm definitely a 'deseloper' and will stick with Flash. I wish I had the luxury of only dipping into AS3. My problem is that I built a little program that draws scale bars on uploaded images that can then be printed. It did everything it needed to, but in AS2.0 you can't control the quality of the imported jpgs. As this is for the people in Microscopy the images need to import at the highest quality possible, which I believe is possible with AS3. I wanted to import .tiff files but I know that's impossible.

            I've got the calculation function working, and adapting the Adobe drawingApi sample it can now draw a line that's constrained to the x axis, but I can't get the most important part to work, which is the ability to see the line as it's drawn and have the number of pixels drawn displayed in a text field. The scale bars have to be very precise and without this functionality the program is useless.

            I'm experimenting with Sprites and I have something appearing as the line is drawn but I can't crack the new way to express coordinates. The code I'm attaching results in weird green lines drawing all over the stage. I just want a blue hair line with a nice green dot at each end that can be seen while the line is drawn. Once the mouseUp happens the drawing guide should disappear and the black line appear.

            (And it's still giving me this error repeated as the mouse moves:

            TypeError: Error #1009: Cannot access a property or method of a null object reference.
            at sb_cs3_fla::MainTimeline/mouseMoveHandler()

            Here's the code again:

            • 3. Re: Flash CS3 vs. Flex Builder 2
              Beatie3 Level 1
              Help please.
              • 4. Re: Flash CS3 vs. Flex Builder 2
                Level 7
                Beatie3,

                >> Help please.

                Sorry about that ... some days are crazier than others. :-/

                [From an earlier reply ...]
                > Thank you very much, that's exactly the sort of answer I
                > needed. Hmmm, cheque's in the mail. ;)

                Heh, good on ya! :)

                > I'm definitely a 'deseloper' and will stick with Flash. I wish
                > I had the luxury of only dipping into AS3.

                I don't know that I'd call it a luxury, really. Work is work. ;) As
                you might imagine, though, Flex Builder 2 provides a number of scripting
                improvements over the Actions panel (there's really no comparison; if you've
                tried them both, the Actions panel barely feels useful) and the Flex
                framework offers significantly more UI Components. Ideally, if the pocket
                book allows it, using both applications is the killer setup.

                > My problem is that I built a little program that draws scale bars
                > on uploaded images that can then be printed. It did everything
                > it needed to, but in AS2.0 you can't control the quality of the
                > imported jpgs.

                When you say imported, you mean dynamically loaded (loaded at runtime),
                right? Otherwise, I'm confused. The Flash IDE itself allows you to
                determine the quality of imported JPGs. In ActionScript 3.0 ... are you
                talking about the Stage.quality property?

                > I'm experimenting with Sprites and I have something appearing
                > as the line is drawn but I can't crack the new way to express
                > coordinates.

                Not sure what might be tripping you up, actually. The coordinate grid
                is the same. Horizontally, higher numbers move toward the right;
                vertically, higher numbers move toward the bottom. That's the same as it's
                been.

                > I just want a blue hair line with a nice green dot at each end
                > that can be seen while the line is drawn. Once the mouseUp
                > happens the drawing guide should disappear and the black
                > line appear.

                Having heard what you're after, I just started a quick experiment from
                scratch. Here's my version, below. Note: I've made no effort to optimize
                my code. This is just a first draft to achieve a blue line segment with
                green dots on each end that becomes a black line segment when the mouse
                lifts.

                var startX:Number;
                var startY:Number;

                var canvas:Sprite = new Sprite();
                addChild(canvas);

                canvas.stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
                canvas.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);

                function mouseDownHandler(evt:MouseEvent):void {
                startX = mouseX;
                startY = mouseY;
                var dot:Sprite = new Sprite();
                dot.name = "dotStart";
                dot.graphics.beginFill(0x00FF00);
                dot.graphics.drawCircle(mouseX, mouseY, 5);
                dot.graphics.endFill();
                canvas.addChild(dot);
                dot = new Sprite();
                dot.name = "dotEnd";
                dot.graphics.beginFill(0x00FF00);
                dot.graphics.drawCircle(0, 0, 5);
                dot.graphics.endFill();
                canvas.addChild(dot);
                canvas.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
                }

                function enterFrameHandler(evt:Event):void {
                var dot:DisplayObject = canvas.getChildByName("dotEnd");
                dot.x = mouseX;
                dot.y = mouseY;
                canvas.graphics.clear();
                canvas.graphics.lineStyle(1, 0x0000FF);
                canvas.graphics.moveTo(startX, startY);
                canvas.graphics.lineTo(mouseX, mouseY);
                }

                function mouseUpHandler(evt:MouseEvent):void {
                canvas.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
                canvas.removeChild(canvas.getChildByName("dotStart"));
                canvas.removeChild(canvas.getChildByName("dotEnd"));
                canvas.graphics.clear();
                canvas.graphics.lineStyle(2, 0x000000);
                canvas.graphics.moveTo(startX, startY);
                canvas.graphics.lineTo(mouseX, mouseY);
                }

                There's a lot of repeated code there, and this isn't how I'd leave the
                above in an actual project, but by spilling out a rough cut like this, I'm
                hoping it gives you something to work with -- showing the mechanics of how
                this might be done.


                David Stiller
                Adobe Community Expert
                Dev blog, http://www.quip.net/blog/
                "Luck is the residue of good design."


                • 5. Re: Flash CS3 vs. Flex Builder 2
                  Beatie3 Level 1
                  quote:

                  Originally posted by: Newsgroup User
                  > When you say imported, you mean dynamically loaded (loaded at runtime),
                  >right? Otherwise, I'm confused. The Flash IDE itself allows you to
                  >determine the quality of imported JPGs. In ActionScript 3.0 ... are you
                  >talking about the Stage.quality property?

                  Hmmm, no images that user will upload to the server and load into a scrollpane in Flash. I believe I'll be using fileReference to achieve that part ... but I could be wrong.

                  >Not sure what might be tripping you up, actually. The coordinate grid
                  >is the same. Horizontally, higher numbers move toward the right;
                  >vertically, higher numbers move toward the bottom. That's the same as it's
                  >been.

                  No my problem was where the sprite starts, but your code seems to have the answer to that.

                  >Having heard what you're after, I just started a quick experiment from
                  >scratch. Here's my version, below. Note: I've made no effort to optimize
                  >my code. This is just a first draft to achieve a blue line segment with
                  >green dots on each end that becomes a black line segment when the mouse
                  >lifts.

                  David, if I weren't exclusively a woman's woman, I'd be offering to have your babies. That is a huge help. I was working with MOUSE_MOVE. I'll get to work and show you what I end up with. Thank you very very veyr very very veyr much.

                  Beatie (Fiona)
                  Educational Designer
                  USyd eLearning



                  • 6. Re: Flash CS3 vs. Flex Builder 2
                    Beatie3 Level 1
                    Okey dokey, I've been playnig and I have another question:

                    I've managed to constrain the line to the x axis, but I'm now trying to constrain the drawing of the line to the ScrollPane. I've tried the hitTest code:

                    if (this.holder_sp.hitTestPoint(22,160,false)) {
                    blah blah blah
                    }

                    inside the enterFrameHandler, but that doesn't do anything.

                    I've tried setting the coordinates and bounds of the canvas sprite, but then nothing happens:

                    var canvas:Sprite = new Sprite();
                    addChild(canvas);
                    canvas.x = 22;
                    canvas.y = 160;
                    canvas.width = 580;
                    canvas.height = 400;

                    I also tried doing this inside the enterFrameHandler but again everything disappeared.

                    The targeting and display list stuff is all new and I'm finding it confusing. The _root or _global used to get me out of lots of trouble.
                    • 7. Re: Flash CS3 vs. Flex Builder 2
                      Level 7
                      Beatie3,

                      > Okey dokey, I've been playnig and I have another
                      > question:

                      Okay.

                      > I've managed to constrain the line to the x axis, ...

                      Good. :)

                      > but I'm now trying to constrain the drawing of the line
                      > to the ScrollPane. I've tried the hitTest code:
                      >
                      > if (this.holder_sp.hitTestPoint(22,160,false)) {
                      > blah blah blah
                      > }
                      >
                      > inside the enterFrameHandler, but that doesn't do
                      > anything.

                      Well, my hunch is that it does do *something,* just not what you're
                      expecting. Are you familiar with some of the troubleshooting/debugging
                      tools available in Flash? One of the most basic, for example, is the
                      trace() statement, which prints information to the Output panel. You might,
                      for example, trace(mouseX, mouseY) inside your frame loop to get a
                      continuous update of where the mouse is located.

                      I figure you'll want to feed that hit test a set of dynamic numbers,
                      right, rather than the hard-coded 22 and 160?

                      >> David, if I weren't exclusively a woman's woman,
                      >> I'd be offering to have your babies. That is a huge help.

                      Haha! Love it. I enjoy helping people here when I can ... the
                      thank-yous are always nice -- and often fun -- but rarely so fervent. ;)

                      >> I was working with MOUSE_MOVE. I'll get to
                      >> work and show you what I end up with.

                      MOUSE_MOVE would probably work just fine; I just happened to pick
                      ENTER_FRAME -- not even sure why, honestly. In any case, keep your chin up
                      ... AS3 does seem overwhelmingly different in many ways, I agree, but the
                      principles are usually the same. Break down your goal and take small steps.
                      If you introduce a new mechanism (like this hitTestPoint() method), isolate
                      that mechanism in a separate FLA to make sure you understand how it works.
                      Test it in a new file without the "baggage" of whatever complexity is
                      already in your other FLA. Get good and clear on what its parameters, if
                      any, do, and what it's return value, if it has one, is. When you've
                      mastered that new dance step, roll it into the rest of the prom.


                      David Stiller
                      Co-author, Foundation Flash CS3 for Designers
                      http://tinyurl.com/2k29mj
                      "Luck is the residue of good design."