0

I am trying to add an Icon to NavigatorContent, but for some reason it is not working.

My code is below:

<s:TabBar id="tabs" dataProvider="{vs}"/>
<mx:ViewStack id="vs" width="100%" height="100%">
        <s:NavigatorContent label="Consultant"  width="100%" height="100%" icon="@Embed(source='presentation/skin/searchButton.png')">
            <presentation:GridView width="100%" height="100%" />
            <presentation:Form id="myForm" width=" 100%" height="40%" visible="{myForm.model.visibility}" includeInLayout="{myForm.model.visibility}"/>
        </s:NavigatorContent>
</mx:ViewStack>

My aim is to gain something like this: http://it-skills.su/sosamples/webspark46/navigatoricon/index.html

Spinxas
  • 71
  • 1
  • 2
  • 15

1 Answers1

0

The only reason that I see - maybe path to the icon file is incorrect. As I remember in your case with this path your file must exist at "your_source_path/presentation/skin/searchButton.png".

Crabar
  • 1,829
  • 1
  • 14
  • 26
  • The path is correct. I have in couple lines above a line of code : which is working perfectly. – Spinxas Nov 11 '14 at 14:35
  • It's different cases. In Image you don't use "Embed" so it loads at runtime. With "Embed" your picture will be loads at compile time. – Crabar Nov 11 '14 at 14:38
  • Thanks for the comment. But I am still facing the problem. I tried altering the path in many ways, but it still does not show up. Can I load the image without the Embedded tag? – Spinxas Nov 11 '14 at 14:47
  • Path in @Embed metadata tag must be relative to your source path. For example: your sources at "D:/develop/my_program/src", then picture must be at "D:/develop/my_program/src/presentation/skin/searchButton.png". – Crabar Nov 11 '14 at 15:00
  • Yes that is correct. I checked it couple of times. I also tried moving to src folder and changing the path in the code, still no result. Thanks for the commments :) – Spinxas Nov 11 '14 at 15:03
  • Your code is absolutely correct. I tested it on my system and icon is coming just fine. if path is not correct then you will get compile time encoding error., but as you are not getting any error that means image is embedded correctly. By the way, which flex sdk you are using? – Sumit Nov 12 '14 at 07:11