Copy link to clipboard
Copied
I cannot seem to embed an inline image in a TLFTextField from the library. Using the following snippet (with both a TLFTextField and a standard Dynamic TextField on the stage), the image appears ok in the Dynamic TextField, but no image in the TLFTextField.
var source:String ="image <img src='linkageId' width='100' height='100'/> footer";
TLFText.htmlText = source;
DynamicText.htmlText = source;
Changing the image source to a file path, and the image appears correctly in both. However, I would really like to keep using the in-library symbols if possible, and the TLFTextField documentation suggests this is still possible.
This is using Flash Professional CS5 11.0.0.485 on Windows 7. Any suggestions would be appreciated.
Copy link to clipboard
Copied
I'm not sure I have a good answer to this, but I can tell you what I know, and maybe that will help get you further. Feel free to ping back with more questions.
First, the markup for images in the HTML markup is not supported, because TLF doesn't have support for floats, only for inline graphics. But there is support for <img> in the TLF markup. You can see this in FLA file, which is a zipped XML file. If you unzip the file, and you've added TLF text, you'll see a TLF TextFlow. Inside the TextFlow, you can put an <img> element (see the TLF Blog for a TLF markup description). The <img> element can have a "source" and a "customSource" attribute. These get set to a number, which maps to an entry in the <elements> element, which is a child of the DOMTLFText element. The number in the customSource in the img element maps to the a DOMSymbolInstance in the elements. That, in turn, has a libraryItemName, which is the name of the XML file that contains the inline. In my case, I'm using a file generated by InDesign, its called "InlineText". Inside the InlineText.xml file is a DOMBitmapInstance with a libraryItemName that contains the name of the JPG file the inline is linked to.
Whew. I'm not saying there's not an easier way to do this, but this is how its all expressed in the FLA file. I'm guessing there's a parallel mechanism inside Flash runtime, but I don't know what it is -- I will see if I can get someone who knows Flash to answer, or you could try posting to a Flash Pro forum. In the meantime, I'm hoping this helped.
- robin
Copy link to clipboard
Copied
Flash Pro sets up the inlineGraphicImageResolver to figure out the symbols.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flashx/textLayout/elements/Configuration.html?allClasses=1#inlineGraphicResolverFunction
Somehow that's not getting called or properly resolving the symbol.
Richard
Copy link to clipboard
Copied
Thanks for the insight guys. At this stage I might just sit with "it's broken" and wait for a point release - hacking around a replacement inlineGraphicResolverFunction sounds like it'll burn too much time and likely not fix anything.
Copy link to clipboard
Copied
maular,
A few months ago, I had a similar question from one of our beta sites. If I can re-remember how to post a file here, I'll put a sample FLA up that shows how to do this. I haven't ever attempted to do this using the htmlText setter, as your code is doing. It might work if you put a customSource attribute on it, but it may just be that htmlText doesn't handle the <img> tag. I do know that the tlfMarkup setter does what you want if you define a graphicResolver function (see attached example). The resolver could certainly be a little smarter, but for my example, I just allocated an instance of a library item. If there were multiple <img> tags, you'd have to look at the customSource value and sort out which library item to allocate.
Also note in my example that I had to reset the flowComposer value to the original composer.
Hopefully, I can figure out how to post my FLA.
Regards,
Rusty
Hmmm. I figured out how to upload a graphics image, but it won't allow FLA files. Maybe I can post elsewhere, and put up a URL.
Copy link to clipboard
Copied
Is there any progress on this ?
I am trying the same thing you use the img tag in a TLFTextField, the docs say it should work but it doesn't.. very stupid...
Is there any other way of handling this except using the classic textField ?
idratherbegolfing just use some free hosting to upload the fla file.
I would recommend https://www.dropbox.com/.
Copy link to clipboard
Copied
Sorry for the delay in responding (I was out for about 10 days on vacation). Try this link:
http://dl.dropbox.com/u/9110597/Red%20Circle%20Inline.fla
Rusty
Copy link to clipboard
Copied
Rusty,
In your example .fla, how did you embed the red circle MovieClip into the TLF instance named "tlf" at author time?
T
Copy link to clipboard
Copied
I'm not sure where you've misunderstood, so, I'll try to explain the entire process.
Steps to reproduce:
1. Draw or select a shape on the stage.
2. With the shape selected, do Convert to Symbol... under the Modify menu.
3. Give the symbol a good name, say "MySymbol".
4. Make sure to select the "Export for ActionScript" checkbox in the Advanced section & check "Export in frame 1".
5. In the frame script code (Window->Actions), I wrote the following function:
function inlineResolver(incomingILG:Object):DisplayObject
{
var ilg:InlineGraphicElement = InlineGraphicElement(incomingILG);
if (ilg == null)
return null;
return new InlineText;
}
function inlineResolver(incomingILG:Object):DisplayObject
{
var ilg:InlineGraphicElement = InlineGraphicElement(incomingILG);
if (ilg == null)
return null;
if (incomingILG.userStyles.customSource == 225)
return new MySymbol();
return null;
}
Copy link to clipboard
Copied
Hi Rusty,
Thank you for responding.
> I think you're asking is how the original code shows the inline graphic on the stage.
Yes, that was my question.
> The only way to do that is to export it from InDesign.
Too bad. I thought you were inadvertently revealing some undocumented way to do this in Flash at author time.
> Notice the <img> tag and that there is a "customSource" attribute.
I did notice that. Before posting my question, I added "trace(tlf.tlfMarkup);" to your code. If you google "tlfMarkup customSource", you'll get exactly one hit: this forum thread.
T