Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic text field to load image? possible? 1

Status
Not open for further replies.

Flashoid

Technical User
Dec 11, 2002
163
US
I apologize for this sounding like a stupid question but is it possible to dynamically load an image (jpeg,png) using a dynamic text field? The reason I ask is I am forced to use a content management system that only allows dynamically-generated text fields to dynamically load content (including images).

I have this code (below) that loads images using an empty movieclip on the stage but I have had no success trying to load an image using a dynamic text field. Again, I apologize for asking a stupid question but I thought I would throw it out there in case someone knows of a way to do it.

code I use for dynamically loading an image:

_level0.empty_mc.loadMovie("image01.jpg");


thanks!
 
Code:
var tf:TextField = this.createTextField("tf", 1, 10, 10, 100, 1);
with (tf) {
	autoSize = true;
	multiline = true;
	wordWrap = true;
	html = true;
	htmlText = "<img src='image01.jpg' width='70' height='100' vspace='0' hspace='0' />";
}

Kenneth Kawamoto
 
I put your code in frame 1 and created a dynamic text field named "tf".

I get this error when I publish though:

Error: A 'with' action failed because the specified object did not exist.
 
It works great!

But for this particular audience they are limited to player 6 which sucks (I only got this to work by publishing to player 8) But eventually they will move to player 9 and then this will work.

thanks!!
 
It works on Flash 6 too. Just need to change the code to AS1 style, that's all.

Change the first line:
[tt]var tf:TextField = this.createTextField("tf", 1, 10, 10, 100, 1);[/tt]

to:
[tt]this.createTextField("tf", 1, 10, 10, 100, 1);[/tt]

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top