FES Posted January 13, 2010 Posted January 13, 2010 Hi, I've been trying to figure out a way to change all of the text within a text frame based on the contents of a field using an OnRecordStart callback rule. So far no luck. Basically, I have a text frame with several variables in it using a white font on top of a graphic frame. I need to be able to change the font color depending on the background image that gets loaded into the graphic frame, since several have a white background. Any help is appreciated.
Dan Korn Posted January 13, 2010 Posted January 13, 2010 In FusionPro 6.0 or later, you can name the text frame and then do something like this in OnRecordStart: var myFrame = FindTextFrame("Story"); myFrame.content = "<span color=Green>" + myFrame.content;However, there's a somewhat simpler solution that will work in any (currently supported) version of FusionPro, without creating an OnRecordStart rule. You can just create a regular text rule like so: return "<span color=Red>"; // Don't forget to check "Treat returned strings as tagged text." Then you can insert the variable with the rule's name at the very start of the text in the frame (in the Variable Text Editor). To use a color name from a data field, just change the rule to do something like this: return '<span color="' + Field("TextColor") + '">';
FES Posted January 14, 2010 Author Posted January 14, 2010 I can't believe I wasted so much time and all I needed was "span"! I was trying to do it the same way you have it except I wasn't using that one little word. What a relief to be past that issue. Thanks for the help.
Dan Korn Posted January 14, 2010 Posted January 14, 2010 I'm glad I could help. For reference: Mysteries of the <span> tag revealed
Recommended Posts
Archived
This topic is now archived and is closed to further replies.