GGshow reloaded GGshow reloaded

December 31, 2011

Compact, not vacuum…

Issue:

  • Unable to execute a SQLite VACUUM command from actionscript.

Reason:

  • flash.events.SQLErrorEvent
    
    SQLError
    detailID : 2037
    details : VACUUM is not allowed from SQL.

Solution:

  • use method compact() to reclaims all unused space in the database.
    compact(responder:Responder = null):void
Filed under: ActionScript,Flash Platform,SQLite — Tags: , , , , — GG @ 4:36 pm

October 23, 2010

Roots in dynamic and input text field

This is a solution for using Square root (SQRT), cube root, nth root, and other roots formula in dynamic and input text field, extended from the article How to use subscript & superscript in dynamic and input text field.

  1. Download & install GG Root Sans N, GG Root Sans Radical, GG Root Sans Radicand fonts.
  2. Create a dynamic text field with Arial font embeded. Set the HTML property to true.
  3. Create a dynamic text field with GG Root Sans N font embeded.
  4. Create a dynamic text field with GG Root Sans Radical font embeded.
  5. Create a dynamic text field with GG Root Sans Radicand font embeded.
  6. Use HTML tag to set text to roots formula like below:
    my_txt.html = true;
    my_txt.htmlText = "GG Root Sans<br>";
    my_txt.htmlText += "<font face="GG Root Sans Radical"> </font><font face="GG Root Sans Radicand">2</font>";
    my_txt.htmlText += "<font face="GG Root Sans Radical">n</font><font face="GG Root Sans Radicand">x</font>";
    my_txt.htmlText += "<font face="GG Root Sans Radical">2</font><font face="GG Root Sans Radicand">3</font>";
    my_txt.htmlText += "g = <font face="GG Root Sans N">f(d+e</font><font face="GG Root Sans Radical">)</font><font face="GG Root Sans Radicand">(ax+by)(ax-by)</font>";

Demo:

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

Download:

Filed under: ActionScript,Flash Platform,HTML — Tags: , , , — GG @ 3:37 pm

December 23, 2008

Video covered whole screen area when full screen

Issue:

  • Only can see video when full screen mode activated (StageDisplayState.FULL_SCREEN).
  • Other content not visible when full screen.

Reason:

  • Flash Player uses hardware acceleration to scale the video file, rather than scaling it through software.
  • By hardware acceleration for full-screen, FLVPlayback component instance take over whole full screen area by default.

Solution:
Set the fullScreenTakeOver parameter to false.

  • FLVPlaybackInstance.fullScreenTakeOver = false;

Additional Information:
Using the FLVPlayback component with Flash Player 9 Update 3

Filed under: ActionScript,Flash Platform,Web — Tags: , , , — GG @ 2:48 pm

December 18, 2008

How to embed fonts in Flash

Issue:

  • Text in dynamic/input text field not displayed.
  • Text missing after scale, screw, or rotate the text field.
  • Text problem when masking or tweening.

Reason:
Flash does not embed the entire font with all the characters. By default, only used glyphs embeded for static text fields, and no glyphs embeded for dynamic and input text field.

Solution:
Embed the required font glyphs to your Flash document.

Firstly, make sure that the fonts that you want to embed has already been installed in your local machine.

To embed a font thru Property Inspector

  1. Create a dynamic text field on your stage
  2. From the Property Inspector select ‘Embed…’ (or ‘character’ for older version of Flash software).
  3. Choose the character ranges that you want to embed.
  4. Press OK

Note: Make sure that you choose all the range of characters that may appear in the textfield
For Flash 5, you can embed the font thru the Text Options panel (Window>Panel>Character).

To embed a font in ActionScript

  1. Emmbed the font to the library of your Flash document
    – Open Library (Ctrl-L).
    – Click on the Library options button, select New Font.
    – In Font Symbol Properties dialog, select font, style, and size, set the value for name (e.g. my_font), then press OK.
  2. Set linkage for the font symbol
    – Right click on the font symbol in Library, select Linkage…
    – In Linkage Properties dialog, enable the Export for Actionscript option, then press OK.
  3. Create text field
    – Create a dynamic or input text field on your stage
    – In Property Inspector, set the font (my_font*), and set the style and size same value with step 1
    – Set the instance name for the text field, (e.g. my_txt)
  4. Add ActionScript
    – In Action Panel, add the following script

    • For ActionScript 2
      var myFormat:TextFormat = new TextFormat();
      myFormat.font = "my_font";
      myFormat.size = 24;
      my_txt.autoSize = "left";
      my_txt.embedFonts = true;
      my_txt.setTextFormat(myFormat);
    • For ActionScript 3
      var myFont:Font = new my_font();
      var myFormat:TextFormat = new TextFormat();
      myFormat.font = myFont.fontName;
      myFormat.size = 24;
      var myTextField:TextField = new TextField();
      myTextField.autoSize = TextFieldAutoSize.LEFT;
      myTextField.defaultTextFormat = myFormat;
      myTextField.embedFonts = true;

With the font embeded in your Flash document, you can dynamically set the font style, format, rotation, alpha, & etc. and allows mask, tween, and skew of a dynamic text field while gives a consistent, predictable viewing of fonts in your swf. However, embeding a font will increase your SWF file size.

Font embedding in other software
Flash is not the only software which require manual embedding font into published document.

In Microsoft PowerPoint, we need to embed fonts in Save As dialog, Save Options,
choose Embed TrueType fonts for PowerPoint 2003 or below, or choose Embed fonts in the file for PowerPoint 2007.

For web application, we can embed font by converting the font to Portable Font Resources (.pfr) and Embeddable Open Type (.eot) format, and then using <link> and <style> html tag to embed the font.

  • <link rel="fontdef" src="yourfont.pfr">
    <style type="text/css">
    <--!
    @font-face {
    src:url(fonts/yourfont.eot);
    }
    -->
    </style>

Additional Information:
LiveDocs: Embedding fonts
Flash Quick Start: Embedding fonts

Filed under: ActionScript,Flash Platform — Tags: , — GG @ 12:15 am

February 9, 2008

GG Chinese Text Converter v1

GG Chinese Text Converter is a free flash AS2 Chinese Simplified/Traditional text converter component.

GG Chinese Text Converter can converts text from Chinese Simplified to Chinese Traditional, or Chinese Traditional to Chinese Simplified.

s2t() & t2s() functions

trad_txt.text = componentInstance.s2t(simp_txt.text);
simp_txt.text = componentInstance.t2s(trad_txt.text);

Example:

my_btn.onPress = function() {
    trad_txt.text = my_cconv.s2t(simp_txt.text);
};

Demo:

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)
Filed under: ActionScript,Flash Platform,GG's Flash Extensions — Tags: , , — GG @ 7:32 pm

October 29, 2007

GG WebSwfExts v1.0.0

GG WebSwfExts is a set of flash component for web based swfs. Version 1.0.0 includes 3 useful components below:
– GG bgColor v1
– GG jsWindow v2
– GG mailto v1

GG bgColor v1
A flash actionscript component integrates DOM document object bgColor property. Allows HTML body background color to be changed by using actionscript command.
Editable Parameters:

N/A N/A

Examples:
[01][02] click to open

GG jsWindow v2
A flash actionscript component integrates JavaScript popup window function, launch JavaScript popup window in Flash, with fully customizable window properties, include toolbar, location, directories, status, menubar, scrollbars, resizable, copyhistory, width, and height.

componentInstance.openWindow(url, windowName);
e.g.:
my_btn.onPress = function() {
my_popup.openWindow(“http://www.ggshow.com”, “my_window”);
};

componentInstance.closeWindow(windowName);
e.g.:
my_btn.onPress = function() {
my_popup.closeWindow(“my_window”);
};

Editable Parameters:

toolbar Determines whether to include the standard Back, Forward, Home toolbar.
location Determines whether to show the current URL location.
directories Determines whether to show “What’s New” “What’s Cool,” or other buttons.
status Determines whether to have a status bar at the bottom of the window.
menubar Determines whether to include a menu bar at the top of the window.
scrollbars Determines whether to create scroll bars if the document exceeds the window size.
resizable Determines whether the user may resize the window.
copyhistory Determines whether this new window should inherit the current window’s session history.
width Defines how wide the window should be, measured in pixels.
height Defines how tall the window should be, measured in pixels.

Examples:

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

GG mailto v1
Customizable mailto function in flash, launch users’ email client with complete parameters includes to, cc, bcc, subject, and body.
Editable Parameters:

to Receipients’ email address(es), separated by using semicolon (;). *required
cc cc *optional
bcc bcc *optional
subject email subject *optional
body email message body, use %0A as line break. *optional

Examples:

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)
Filed under: ActionScript,Flash Platform,GG's Flash Extensions,Web — Tags: , , , — GG @ 3:56 am

April 19, 2007

How to use subscript & superscript in dynamic and input text field

Issue:

  • Unable to use subscript or superscript in dynamic and input text field.
  • Unable to display subscript or superscript for external loaded text.
  • Unable to use <sub> & <sup> tags in dynamic or input text field.
  • To create subscript or superscript text without Text Layout Framework (TLF).

Reason:
<sub> & <sup> tags are not supported by Flash.

TechNote: Subscript and superscript fail in dynamic and input text fields
LiveDocs: Supported HTML tags

Solution:

  1. Download & install GG Subscript & GG Superscript TrueType fonts. You will need to restart Flash software after installed fonts.
  2. Create a dynamic text field with Arial font embeded. Set the HTML property to true.
  3. Create a dynamic text field with GG Subscript font embeded.
  4. Create a dynamic text field with GG Superscript font embeded.
  5. Use HTML tag to set text to subscript or superscript like below:
    Adobe<font face="GG Superscript">TM</font>

    If you are using ActionScript to test the htmlText, use script like below:

    my_txt.text = "Adobe<font face="GG Superscript">TM</font>";

Demo:

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

Download:
superscript.fla
superscript.swf

Updated: (2008-09-21)
A new set of superscript & subscript fonts includes both sans & serif type, with more complete & improved glyphs, standard scale & shift, is now available to be downloaded (free) from here.

Updated: (2010-10-23)
Another set of fonts for displaying square root (SQRT), cube root, nth root, and other roots formula in dynamic and input text field is now available here.

Related:
For creating subscript & superscript text with Text Layout Framework in AS3 or Flex project, refer to here

Filed under: ActionScript,HTML — Tags: , , , , — GG @ 5:51 pm

© 2024 GGSHOW | Powered by WordPress