0 Replies Latest reply on Apr 26, 2012 5:07 AM by enPerdition

    Create swf skin with assets

    enPerdition

      Hi,

       

      is it possible to create a skin in a swf which contains assets (images) ?

       

      I have a skin class :

       

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009" 
              xmlns:s="library://ns.adobe.com/flex/spark" 
              xmlns:mx="library://ns.adobe.com/flex/mx">
          
          <fx:Metadata>
              [HostComponent("com.test.BoutonPerso")]
          </fx:Metadata>
          
          <fx:Script>
              <![CDATA[
                  
                  [Embed(source="/assets/url2.png")]
                  [Bindable]
                  public var img:Class;
                  
              ]]>
          </fx:Script>
              
          <s:Label id="label" text="skinYellow" />
          
          <s:Image source="{img}" />
          
      </s:Skin>
      

       

       

      and a css file :

       

      /* CSS file */
      @namespace s "library://ns.adobe.com/flex/spark";
      @namespace mx "library://ns.adobe.com/flex/mx";
      @namespace test "com.test.*";
      
      test|BoutonPerso{
          skinClass: ClassReference("skins.yellow.BoutonPersoSkinYellow");
      }
      
      test|BoutonPerso #label {
          color: "0xFFFF00";
      }
      

       

      when I launch this command :

       

       

      mxmlc myCSSFile.css
      

       

      there is no error and my SWF contains my url2.png image but when I try to use this skin at runtime in my main application with styleManager.loadStyleDeclarations2() I received an error :

       

       

      Error: Skin for skinsRuntimeBase0.ApplicationSkin2._ApplicationSkin_Group1.contentGroup.BoutonPerso9.BoutonPersoSkinYellow19._BoutonPersoSkinYellow_Image1 cannot be found.
      

       

       

      My url2.png image doesn't seem to be found but it's in the skin swf...

       

       

      How can I solve this problem please ?

       

      Thank you