0 Replies Latest reply on Apr 25, 2012 5:41 AM by enPerdition

    Embed image into runtime skin (.swf)


      Hi all,


      I'm trying to embed an image into a runtime skin but I have this error :


      Error: Skin for skinsRuntimeBase0.ApplicationSkin2._ApplicationSkin_Group1.contentGroup.BoutonPerso8.Bout onPersoSkinRed16._BoutonPersoSkinRed_Image1 cannot be found.


      when I access to my swf skin in my main application with styleManager.loadStyleDeclarations2().


      I'm working with FB4 and command line (compc + mxmlc) to compile resources and to compile swf with my swc resource bundle.


      Here is my process :


      1) Creation of a FB4 library project and copy of an image url.png in package assets.

      2) Creation of a swc asset with this library project. Here is my xml :


      <?xml version="1.0"?>
               <source-path append="true">


      3) Creation of another FB4 library project in which I load into library path assets.swc


      4) Creation of a basic css file :


      @namespace s "library://ns.adobe.com/flex/spark";

      @namespace mx "library://ns.adobe.com/flex/mx";

      @namespace test "com.test.*";



          skinClass: ClassReference("skins.red.BoutonPersoSkinRed");



      test|BoutonPerso #label {

          color: "0xFF0000";



      My skin class is that :


      <?xml version="1.0" encoding="utf-8"?>
      <s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009" 
                  public var img:Class;
          <s:Label id="label" text="skinRed" />
          <s:Image source="{img}" />    


      I notice here that if I change the source of Embed metadata, I have an error so my image in my assets.swc is correctly found.


      5) Creation of my swf runtime skin :


      <?xml version="1.0"?>
              <source-path append="true">
              <include-libraries append="true">
              <keep-as3-metadata append="true">


      My redSkin.swf is created and Embed my image (verified with the size of my swf and a swf explorer in which I find my image).


      But when in my main application I try to load my skin with :


      styleManager.loadStyleDeclarations2("E:/workspaces/flex/skinsRuntimeRed/src/redStyle.swf", true, ApplicationDomain.currentDomain);


      I have error at top of message.


      what am I doing wrong please ?


      Thanks and sorry for my english