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

superscript/subscript character/text in AS3

Participant ,
May 28, 2009 May 28, 2009

Hi,

As shown in the demo I am trying to create a sample to make a character superscript/scbscript but don't know what is required to create this functionality.

http://labs.adobe.com/technologies/textlayout/demos/

Can some provide any sample code for the same.

Thanks for any help.

TOPICS
ActionScript
8.8K
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 Expert ,
May 28, 2009 May 28, 2009

as far as i know, you still have to fake it using specialized fonts.  files are attached (i hope).

no, two attach failures.

the files are here:  www.kglad.com/Files/superscript.zip

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
Participant ,
May 28, 2009 May 28, 2009

Thanks for your reply kglad.

But for this I will have to embed the characters/font. In the sample it seems to work with device text.

I think (not sure though) it has something to do with the baseline

http://livedocs.adobe.com/flex/3/langref/flash/text/engine/TextBaseline.html

Unable to find any sample/tutorial which explains this

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
Participant ,
May 28, 2009 May 28, 2009

To confirm what I said I pasted a special character in editor from character map and applied superscript which worked fine.So for sure the method does not require font embedding.

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
Participant ,
May 29, 2009 May 29, 2009

The problem is solved. FTE components have to be used for this.

var ca:CharacterFormat = new CharacterFormat();
ca.baselineShift = flashx.textLayout.formats.BaselineShift.SUPERSCRIPT;

Still stuck on how to apply on a character and not on whole text.

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
Feb 19, 2010 Feb 19, 2010

Hey man, I'm doing the same thing now.  you HAVE to use the text flow  with the TLF

E.g:  one word "hello" and another word "hello" as superscript

<?xml version="1.0" encoding="utf-8"?>
<TextFlow fontFamily="Arial" fontSize="16" paddingBottom="2" paddingLeft="2" paddingRight="2" paddingTop="2" whiteSpaceCollapse="preserve" xmlns="http://ns.adobe.com/textLayout/2008">

     <p><span>hello </span><span baselineShift="superscript">hello</span></p>

</TextFlow>

just download the TLF examples from adobe and paste the code above into a textflow example

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
New Here ,
Feb 24, 2012 Feb 24, 2012

Hello,

I am also facing the issue with super scripts.Is anybody have any idea with  how to load a super script in the flash text field.

thanks

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 Expert ,
Feb 24, 2012 Feb 24, 2012

since 2009 when this post was accurately answered (at that time), adobe has added the textlayoutframework (tlf) to flash.  tlf supports subscripts and superscripts.

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
Explorer ,
Sep 24, 2014 Sep 24, 2014
LATEST

Now that Adobe has depreciated TLF text are we back to having to use superscript fonts?

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