A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [AS3] How do i load pictures in text field?

  1. #1
    Senior Member bluemagica's Avatar
    Join Date
    Jun 2008
    Posts
    766

    [AS3] How do i load pictures in text field?

    i tried:

    dyntxt.htmText="Test <img src='image/pic/laugh.gif' id='laugh1'> !!";

    But nothing is being embedded, except "Test !!"......any ideas?

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    dyntxt.htmlText

    I am surprised you did not get any error.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    change htm to html and it works fine:

    PHP Code:
    dyntxt.htmlText="Test <img src='http://www.make-some-noise.info/badges/88x31.gif' id='laugh1'> !!"

  4. #4
    Senior Member bluemagica's Avatar
    Join Date
    Jun 2008
    Posts
    766
    well it works now, but still, the image is not placed correctly within the text, and over that, i cannot attach more than one of the same image!

    Code:
    function doReplace(msg):String
    {
    	var _search:Array = [":b:","":_b:",":)"];
    	var _replace:Array = ["<b>","</b>","<img src='images/smiley/laugh.gif' id='::laugh"+i+"::'>"];
    	
    	for(var i:int=0;i<_search.length;i++)
    	{
    		msg = msg.split(_search[i]).join(_replace[i]); 
    	}
    	return msg;
    }
    i am using the split.join instead of replace, because of my habit from as2, but can you guys give me any more suggestions on how to put multiple instances of same smiley and how to position them correctly?

  5. #5
    Member
    Join Date
    Feb 2004
    Location
    Isfahan
    Posts
    97
    You're trying to load a .gif file into TextField? TextField does not support animated gif files, if that's what you're hoping for. instead, try to use TextArea >> http://doitflash.com/

    MyFlashLab Team
    Hadi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center