Scaleform implements image/Text mixing using embedded images in textfieldAccording to scaleform, gfx2.0 alpha5 supports replacing strings with images, and adds HTML tags to alpha6. So there are currently two ways to achieve text-and-text mixing: 1. Substitution of character strings with images the image to be replaced by the string requires an export name. The procedure is as follows: A> import a bitmap to the database. (File --> Import to database) B> right-click the image name on the database panel and select "Link" from the pop-up menu ". C> select "export for ActionScript (export as ActionScript)" and "Export in first frame (export in the first frame)", and then write the export name (such as myimage) in the identifier ). D> Fill in the name and click "OK"... here, the image export name is defined. The exported file will be used when bitmapdata is created. For example: Import flash. display. bitmapdata;
VaR imagebmp: bitmapdata = bitmapdata. loadbitmap ("myimage"); note: "Import flash. display. bitmapdata" cannot be omitted; otherwise, the result will be "undefined "! GFX 2.0 extends two functions for the flash textfield: "setimagesubstitutions" and "updateimagesubstitution ". Here we only use the setimagesubstitutions function. Public setimagesubstitutions (substinfoarr: array );
Public setimagesubstitutions (substinfo: Object); "substinfoarr" is an array. Each object in it should contain the following attributes: substring: String-specify the string to be replaced, this parameter cannot save image: bitmapdata-is used to replace the image name of the preceding string (the export name defined earlier). This parameter cannot save width: Number-image width. The optional parameter is height: number-Image Height. optional parameter: baseliney: Number-y offset. Default Value: = Image Height. optional parameter ID: String-specifies an ID to be called by the "updateimagesubstitution" function. optional parameter notes: "setimagesubstitutions" is added to an internal list. To cancel the preceding settings, you only need to call "setimagesubstitutions" and the parameter is "null ". The following is my example: _ Global. gfxextensions = true;
Import flash. display. bitmapdata;
VaR B1: bitmapdata = bitmapdata. loadbitmap ("bitmap1 ");
VaR B2: bitmapdata = bitmapdata. loadbitmap ("bitmap2 ");
VaR B3: bitmapdata = bitmapdata. loadbitmap ("bitmap3 ");
VaR B4: bitmapdata = bitmapdata. loadbitmap ("bitmap4 ");
VaR B5: bitmapdata = bitmapdata. loadbitmap ("bitmap5 ");
VaR B6: bitmapdata = bitmapdata. loadbitmap ("bitmap6 ");
VaR B7: bitmapdata = bitmapdata. loadbitmap ("bitmap7 ");
VaR B8: bitmapdata = bitmapdata. loadbitmap ("bitmap8 ");
VaR B9: bitmapdata = bitmapdata. loadbitmap ("bitmap9 ");
VaR B10: bitmapdata = bitmapdata. loadbitmap ("bitmap10 ");
VaR A = new array;
A [1] = {substring: "xiao1", image: B1 };
A [2] = {substring: "xiao2", image: B2 };
A [3] = {substring: "xiao3", image: B3 };
A [4] = {substring: "xiao4", image: B4 };
A [5] = {substring: "xiao5", image: B5 };
A [6] = {substring: "da1", image: B6, baseline: 20, width: 64, height: 64 };
A [7] = {substring: "da2", image: B7, baseline: 20, width: 64, height: 64 };
A [8] = {substring: "da3", image: B8, baseline: 20, width: 64, height: 64 };
A [9] = {substring: "da4", image: B9, baseline: 20, width: 64, height: 64 };
A [10] = {substring: "da5", image: B10, baseline: 20, width: 64, height: 64 };
M_mctext.setimagesubstitutions ();
M_mctext.autosize = true;
M_mctext.html = true;
M_mctext.htmltext = "<font size = '24' color = '# 0000ff'> This is Blue </font>, xiao1, da1 24-point text ";
:
2. using tag in HTML: Use the HTML tag to see an example: t.html text = "<p align = 'right'> Abra beddings </P> "; "myimage" is the export name. For more information, see the following label attributes: Src-Link name, width-Image Width height-Image Height align-currently only "baseline" is supported ". vspace-unsupported attributes: ID-specifies the name for the movie clip instance (created by Flash Player) that contains the Embedded Image File, SWF file, or movie clip. align-"Left" and "right ". specifies the horizontal alignment of the embedded image within the text field. hspace-for "Left" and "right" It specifies the amount of horizontal space that surrounds the image where no text appears. for the above two methods, I only tried method 1 successfully and method 2 was not successful for the moment. If you have succeeded, let us know. In addition, this method only supports static bitmap for image and text mixing. To make a dynamic expression, you need to use the updateimagesubstitution function. The principle is simple, that is, sequence frame animation.
Finally, let us explain that _ global. gfxextensions = true is required.
Copyright Disclaimer: This article is an original article and can be reproduced. However, you must use a hyperlink to indicate the original source and author information of the article. Please respect your labor achievements. Thank you!
Xiao Xiang's blog http://xfxsworld.cnblogs.com