How to add MovieClip (Image) to TextField in Action script 3 Flash Professional CS6

Posted by & filed under Action Script 3, ADOBE FLEX, Flash.

In action script 3 adding images and movie clips to the TextField very easy using <img> tag and htmlText property of TextField. Just follow few steps to add images or movieclips to the TextField.

step 1: Initialize TextField instance using TextField Class, and assign font, text size and color to the TextField using TextFormat Class.

Step 2: Now add image or movie clip to TextField using <img> tag by referring image name in src property of the  <img> tag.

<img src=’eye.jpg’ width=’190′ height=’200′>

example.

var img:String= “<img src=’eye.jpg’ width=’190′ height=’200′><br/’><p> This is nice photograph</p> “;
txt_field.htmlText=img;

Note: If you want to add movie Clip to text field just mention movieclip name in the src property of the <img> tag. Like if you have MovieClip named car just refer that MovieClip like below

<img src=’car’ width=’190′ height=’200′>

How to add MovieClip (Image) to TextField in Action script 3 Flash Professional CS6
import flash.display.MovieClip;
import flash.text.*;

var txt_field:TextField = new TextField;
txt_field.border=true;
txt_field.wordWrap=true;
txt_field.multiline=true;
txt_field.background=true;
txt_field.width=200;
txt_field.height=250;

var format:TextFormat = new TextFormat();
format.font = "Verdana";
format.size = 15; 

txt_field.defaultTextFormat=format;

var img:String= "<img src='eye.jpg' width='190' height='200'><br/><p> This is nice photograph</p> ";

txt_field.htmlText=img;

addChild(txt_field);

 .

Download Premium Only Scripts & 80+ Demo scripts Instantly at just 1.95 USD per month + 10% discount to all Exclusive Scripts

If you want any of my script need to be customized according to your business requirement,

Please feel free to contact me [at] muni2explore[at]gmail.com

Note: But it will be charged based on your customization requirement

Get Updates, Scripts & Other Useful Resources to your Email

Join 10,000+ Happy Subscribers on feedburner. Click to Subscribe (We don't send spam)
Every Email Subsciber could have access to download 100+ demo scripts & all future scripts.

%d bloggers like this:

Get Instant Script Download Access!