فلاش AS3 XML CDATA جريئة العلامات المقدمة في HTMLText مع خط مضمن

StackOverflow https://stackoverflow.com/questions/5035098

سؤال

أنا فقط أحاول الحصول على فلاش لتقديم نص جريء في حقل نص ديناميكي مع خط مضمن، باستخدام البيانات التي قمت باستيرادها من ملف XML باستخدام CDATA.أي شخص يعرف كيفية القيام بذلك؟

ملف XML: giveacodicetagpre.

و AS3 الرمز: giveacodicetagpre.

هل كانت مفيدة؟

المحلول

Wrap the text you want to be bold in span tags with a class name.

<description><![CDATA[ FOR THE PAST TWO YEARS, <span class="myBoldText">SUPERFAD</span> HAS WORKED...</description>

Then use a StyleSheet object to style it within your actionScript.

var my_styleSheet = new StyleSheet();
var n:Object = new Object();
n.fontWeight = 'bold';
my_styleSheet.setStyle('.myBoldText', n);
container.header.t_desc.styleSheet = my_styleSheet;
container.header.t_desc.htmlText = project_desc;

Don't forget to import the styleSheet class!

import flash.text.StyleSheet;

More info on the StyleSheet class here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/StyleSheet.html

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top