4 Replies Latest reply on Sep 25, 2008 11:36 PM by Milo[HUN]

    BackgroundImage

    GeorgeWS Level 1
      I have tried alot, I get this error when I compile:
      Invalid Embed directive in stylesheet - con't resolve source ...

      <mx:Style>
      Panel
      {
      backgroundImage: Embed("assets/Grapes4.jpg");
      }
      </mx:Style>

      I tried using css but that gave the same error, I am using Flex 2 I do not see anywhere in the Design mode to set a backgroundImage. How can such easy things seem so hard. Thanks

      George
        • 1. Re: BackgroundImage
          Milo[HUN] Level 1
          probably the source path doesn't point to the direct location of the picture file.
          I would place this into a .css like this
          into the mxml goes:
          <mx:Style source="../css/Panel.css" />

          and the panel.css:
          (if Panel is a part of your app, else dot doesn't needed at the beginning of "Panel" name)
          Application
          {
          }
          .Panel
          {
          background-image:Embed("assets/Grapes4.jpg");
          }

          and the folder architecture is:
          -src
          |
          -assets
          |
          ---Grapes.jpg
          ---
          |
          - css
          |
          ---panel.css
          -----
          --.mxml (your file)
          • 2. Re: BackgroundImage
            Level 7

            "GeorgeWS" <webforumsuser@macromedia.com> wrote in message
            news:gbgjql$ie3$1@forums.macromedia.com...
            >I have tried alot, I get this error when I compile:
            > Invalid Embed directive in stylesheet - con't resolve source ...
            >
            > <mx:Style>
            > Panel
            > {
            > backgroundImage: Embed("assets/Grapes4.jpg");
            > }
            > </mx:Style>
            >
            > I tried using css but that gave the same error, I am using Flex 2 I do not
            > see
            > anywhere in the Design mode to set a backgroundImage. How can such easy
            > things
            > seem so hard. Thanks

            I read somewhere that if you refer to something in an embed statement, it
            needs an extra forward slash ("/assets/Grapes4.jpg")

            HTH;

            Amy


            • 3. Re: BackgroundImage
              GeorgeWS Level 1
              Thanks, but it still does not work. I put the Grapes4.jpg everywere to see if it would see it. I even took out the backgroundImage line, compiled and then changed the css file on the server. That stalls on the loading process.
              Stumped.
              Thanks

              George
              • 4. Re: BackgroundImage
                Milo[HUN] Level 1
                You can try to give stylename (.styleName property at the component), and use that name in the css file