Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
Locked
0

How do I define Embedded image in FLT XML?

Guest
Mar 09, 2010 Mar 09, 2010

Hi,

Let's say I have embedded an image like this:

package
{
   
public final class Resource
   
{
       
[Embed (source="/assets/images/1.gif" )]
       
public static const image_1:Class;
   
}
}

How would I call this from FLT XML for the source to be correctly mapped to my image?

<TextFlow xmlns="http://ns.adobe.com/textLayout/2008">

   <p>

       <img source="  ??  "/>

   </p>

</TextFlow>

Thanks in advance!

TOPICS
Text layout framework
890
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Mar 09, 2010 Mar 09, 2010

There is no built in way to do that.  It can, however, be done in several ways.

One way is to supply a custom Configuration to the importer that converts the XML to a TextFlow.  That configuration would include an inlineGraphicResolver function that would convert your markup to a DisplayObject.

Another possibility would be to simply walk the markup after the import and modify the source of the various ILG objects.

I'm kind of wondering though - can you new "StringNameOfClass"?

The class and DisplayObject source specifications for ILGs are there mostly because it works.  They do have limitations with cut/copy/paste.  Class works within a SWF but not to an external swf.  There is no way in Flash to "clone" a generic DisplayObject.

Hope that helps,

Richard

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 09, 2010 Mar 09, 2010

Thank you for the quick response.

I will try to look into that. I have tried to resolve the string, just for the benefit of not having to build my own parser. And the string you get from the export function does not work if you send it the other way, so the only way I have been able to do this is the parser way which I currently use. It would be so neat, though, if one could just use the build in XML.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 13, 2010 Mar 13, 2010
LATEST

Here's an idea: In your markup, give the image tag a src property like "_embedded01". The importer will turn that into an InlineGraphicElement, which will contain a Loader. The load will fail, and the error will be handled by the framework. What's left is an empty loader somewhere in your text flow.

Search your text flow's display list for Loaders. The Loader you're interested in has a parent InlineGraphicElement whose source property is "embedded01". Once you find that loader, just load the bytes of your embedded file into it– which requires that you embed it as a file, and not an image.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines