9 Replies Latest reply on Jan 4, 2008 6:54 PM by Tariq Ahmed [ACP]

    Need help

      Ok... straight up, I'm a .NET developer and the company I'm doing business with is either going to use Silverlight or Flex to develop some stuff on their website. So they asked me to get into both and find out which one I like better, and it's my decision. So I developed a quick little thing, just to play around, but it failed miserably. I had no issue developing this in Silverlight. Hopefully it's just something small, and I hope there isn't a lot of stuff like this or it's gonna be a no brainer decision for me. Here's my code.

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" horizontalAlign="left" horizontalGap="15" verticalGap="15" width="235" height="200">
      <mx:Style source="flash.css" />
      <mx:HBox y="15" width="205" x="15" height="170" horizontalGap="0">
      <mx:HBox width="80" height="100%" verticalAlign="middle" horizontalAlign="center">
      <mx:Spacer width="15"/>
      <mx:VBox height="100%">
      <mx:Text text="Header Text" id="header" enabled="true" styleName="header2"/>
      <mx:TextArea text="This is where text goes." enabled="true" editable="false" wordWrap="true" height="127" width="110" backgroundAlpha="0.0" borderThickness="0"/>

      Now, it's important to note that I followed a tutorial online and discovered this only works in Flex Builder 3, so that's t3h suck, so this is Flex Builder 3. If there is another place to get this info, please direct me there. Anyway, when I try to run this application, I get three errors:

      1084: Syntax error, expecting rightparen before Frame.
      1093: Syntax error.
      Syntax error: expecting rightbracket before rightbrace.

      All of this from line 12: </mx:Vbox>
      Now, if I remove the <mx:Style> tag, it compiles but then my stylesheet doesn't work, so wtf? What am I doing wrong?
        • 1. Need help
          m_hartnett Level 3
          Is your style sheet located in the base directory or is in some css directory hanging off the root?
          If it is in the correct directory, then you should post the css. It seams that there is an error in the CSS file.
          • 2. Re: Need help
            Tariq Ahmed [ACP] Level 1
            Could you copy 'n paste your style sheet as well?

            The other thing I'd recommend is doing a Project->Clean to make sure everything gets built fresh.
            • 3. Re: Need help
              Toadicus_Rex Level 1
              /* CSS file */

              fontWeight: bold;
              fontFamily: Tahoma;
              fontSize: 12;
              color: #FF0000;
              fontFamily: Tahoma;
              fontWeight: bold;
              fontStyle: normal;
              src: local("Tahoma");
              fontWeight: bold;
              • 4. Re: Need help
                Toadicus_Rex Level 1
                The stylesheet is in the "src" directory, put there by default, I guess, so is the mxml file. I created the stylesheet by selecting a text element and using the option "Convert to CSS", and then detailing the style.
                • 5. Re: Need help
                  Tariq Ahmed [ACP] Level 1
                  I just tried it and it worked, so I don't think it's the style sheet. If Flex wasn't able to find the css file in the specified location you would have gotten a very specific error related to that.

                  Did you try the Project->Clean trick?

                  • 6. Re: Need help
                    m_hartnett Level 3
                    To keep things clean create a CSS folder hanging off your main project.

                    put your css files in there.

                    Replace your style tag with
                    <mx:Style source="css/flash.css"/>

                    Hopefully that will solve it.
                    • 7. Re: Need help
                      Toadicus_Rex Level 1
                      Nope, didn't help.
                      • 8. Re: Need help
                        m_hartnett Level 3
                        All i can think of is that it may be a Flex Builder 3 bug.
                        I have not gone to FB3 yet.

                        I tried your app with the style sheet and it worked fine in flex builder 2.

                        You could try as DOPEJAM says and clean your project to see if that works. My only other suggestion would be to remove FB 3 and use FB 2 until FB 3 is in final release.

                        As a note, I think Flex is an awsome product.
                        I come from java/swing background so many flex are very familiar.
                        It does take a bit of ramping up but not too bad.
                        The data binding ability with flex is extremely powerful. If you do choose Flex take a look at the Cairngorm microarchitecture. It implements MVC design practices for flex applications.

                        • 9. Re: Need help
                          Tariq Ahmed [ACP] Level 1
                          Out of curiosity, if you create a brand new project, and copy 'n paste the files... does that work?