<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: AS3 + HTML Text +  tags</title>
	<atom:link href="http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/</link>
	<description>actionscript and creative playground of Donovan Adams</description>
	<lastBuildDate>Thu, 27 Oct 2011 05:40:10 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Geit-vd-plas</title>
		<link>http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/comment-page-1/#comment-15603</link>
		<dc:creator>Geit-vd-plas</dc:creator>
		<pubDate>Mon, 22 Mar 2010 21:04:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/#comment-15603</guid>
		<description>I ment tag wrapped images to display in textfields, ofcourse... silly wordpress</description>
		<content:encoded><![CDATA[<p>I ment tag wrapped images to display in textfields, ofcourse&#8230; silly wordpress</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Geit-vd-plas</title>
		<link>http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/comment-page-1/#comment-15602</link>
		<dc:creator>Geit-vd-plas</dc:creator>
		<pubDate>Mon, 22 Mar 2010 21:03:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/#comment-15602</guid>
		<description>The reason why the images get fucked up is because of the fontsize. It&#039;s very silly but if you put the fontsize to zero then the images are clickable. It&#039;s ok for me &#039;cause I just needed an easy way to get those thumbs displayed while keeping my html untouched. Works like a charm if you just need images in that textfield. 

You can change the fontsize per tag with CSS, maybe someone needs to give that one a try. Sounds like it could work. We&#039;ll then have a perfectly good way to get those &lt;a&gt;tag wrapped images to display in textfields.</description>
		<content:encoded><![CDATA[<p>The reason why the images get fucked up is because of the fontsize. It's very silly but if you put the fontsize to zero then the images are clickable. It's ok for me 'cause I just needed an easy way to get those thumbs displayed while keeping my html untouched. Works like a charm if you just need images in that textfield. </p>
<p>You can change the fontsize per tag with CSS, maybe someone needs to give that one a try. Sounds like it could work. We'll then have a perfectly good way to get those <a>tag wrapped images to display in textfields.</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: seth</title>
		<link>http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/comment-page-1/#comment-14615</link>
		<dc:creator>seth</dc:creator>
		<pubDate>Sat, 06 Jun 2009 19:27:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/#comment-14615</guid>
		<description>You can reference more than one image from the html using the getImageReference(id:String). You just have to give the different  different id names in the html, then you reference them separately by that id name.

&lt;img id=&quot;dragImage&quot; ....
&lt;img id=&quot;mainImage&quot; ....

then use getImageReference(&quot;dragImage&quot;) and getImageReference(&quot;mainImage&quot;) etc.</description>
		<content:encoded><![CDATA[<p>You can reference more than one image from the html using the getImageReference(id:String). You just have to give the different  different id names in the html, then you reference them separately by that id name.</p>
<p>&lt;img id="dragImage" &#8230;.<br />
&lt;img id="mainImage" &#8230;.</p>
<p>then use getImageReference("dragImage") and getImageReference("mainImage") etc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wagster</title>
		<link>http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/comment-page-1/#comment-14607</link>
		<dc:creator>wagster</dc:creator>
		<pubDate>Wed, 27 May 2009 21:02:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/#comment-14607</guid>
		<description>I ended up just adding a MouseEvent.CLICK listener to the textfield and then checking if the target was an [object Loader] in order to figure out if I was clicking an image.  I could then query the contentLoaderInfo in order to retrieve a URL and grab the big image.

It looks like a lot of these problems stem from the fact that TextField is, as you might suspect from the name, just for displaying text.  Adobe have obviously bodged some sort of vague html support into it but it remains a bodge.  For instance:  tags create a Loader instance, attach it to the TextField and pass it a URL - but as TextField doesn&#039;t inherit from DisplayObjectContainer it shouldn&#039;t be able to do that.  You also don&#039;t get any of the DisplayObjectContainer methods, so while you can reference the Loader object that&#039;s a child of textField, you can&#039;t remove it with textField.removeChild or loader.parent.removeChild.  TextFields can&#039;t do that.  I&#039;ll use AIR next time.</description>
		<content:encoded><![CDATA[<p>I ended up just adding a MouseEvent.CLICK listener to the textfield and then checking if the target was an [object Loader] in order to figure out if I was clicking an image.  I could then query the contentLoaderInfo in order to retrieve a URL and grab the big image.</p>
<p>It looks like a lot of these problems stem from the fact that TextField is, as you might suspect from the name, just for displaying text.  Adobe have obviously bodged some sort of vague html support into it but it remains a bodge.  For instance:  tags create a Loader instance, attach it to the TextField and pass it a URL &#8211; but as TextField doesn't inherit from DisplayObjectContainer it shouldn't be able to do that.  You also don't get any of the DisplayObjectContainer methods, so while you can reference the Loader object that's a child of textField, you can't remove it with textField.removeChild or loader.parent.removeChild.  TextFields can't do that.  I'll use AIR next time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wagster</title>
		<link>http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/comment-page-1/#comment-14606</link>
		<dc:creator>wagster</dc:creator>
		<pubDate>Wed, 27 May 2009 14:52:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/#comment-14606</guid>
		<description>Sorry if that didn&#039;t make sense.  Stupid wordpress is knocking out my angle brackets.  My image tag looks like this: img src=&quot;thumbs/placeholder.jpg&quot; id = &quot;1&quot; hspace = &quot;0&quot; vspace = &quot;0&quot;/</description>
		<content:encoded><![CDATA[<p>Sorry if that didn't make sense.  Stupid wordpress is knocking out my angle brackets.  My image tag looks like this: img src="thumbs/placeholder.jpg" id = "1&#8243; hspace = "0&#8243; vspace = "0&#8243;/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wagster</title>
		<link>http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/comment-page-1/#comment-14605</link>
		<dc:creator>wagster</dc:creator>
		<pubDate>Wed, 27 May 2009 14:50:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/#comment-14605</guid>
		<description>I have two images (thumbnails, really) that I embed right into the textfield like this:  giving the next one an id =&quot;2&quot;.

I then attach event listeners to them like this:

i = 1;

while (displayBox.getImageReference(i.toString()) != null) {
				displayBox.getImageReference(i.toString()).addEventListener(MouseEvent.MOUSE_DOWN, displayImage);

i++;
}

That works fine for me and allows me to bring up full size images.  My problem is that as soon as I alter htmlText even a TINY bit (eg htmlText += &quot;.&quot;) the formatting goes all over the shop.  Stumped.</description>
		<content:encoded><![CDATA[<p>I have two images (thumbnails, really) that I embed right into the textfield like this:  giving the next one an id ="2&#8243;.</p>
<p>I then attach event listeners to them like this:</p>
<p>i = 1;</p>
<p>while (displayBox.getImageReference(i.toString()) != null) {<br />
				displayBox.getImageReference(i.toString()).addEventListener(MouseEvent.MOUSE_DOWN, displayImage);</p>
<p>i++;<br />
}</p>
<p>That works fine for me and allows me to bring up full size images.  My problem is that as soon as I alter htmlText even a TINY bit (eg htmlText += ".") the formatting goes all over the shop.  Stumped.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Notes: HTMLText &#124; Course Vector</title>
		<link>http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/comment-page-1/#comment-14566</link>
		<dc:creator>Notes: HTMLText &#124; Course Vector</dc:creator>
		<pubDate>Thu, 02 Apr 2009 13:57:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/#comment-14566</guid>
		<description>[...] Note: (April 2, 2009) You cannot nest an &lt;img&gt; tag within an &lt;a&gt; tag. [Ref] [...]</description>
		<content:encoded><![CDATA[<p>[...] Note: (April 2, 2009) You cannot nest an &lt;img&gt; tag within an &lt;a&gt; tag. [Ref] [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: montana</title>
		<link>http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/comment-page-1/#comment-14509</link>
		<dc:creator>montana</dc:creator>
		<pubDate>Wed, 04 Mar 2009 22:22:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/#comment-14509</guid>
		<description>You&#039;re absolutely right. one should be able to enumerate children of the TextField if they are in fact children of the TextField. I recently ran across an implementation where being able to index images referenced in img tags in that manner would have saved a lot of time. I ended up using regex to list all img tags... not ideal really. 
here&#039;s the regex to match all img tags 

var reImages:RegExp = //sigm;
var oIMGMatches:Object = reImages.exec(sContent);</description>
		<content:encoded><![CDATA[<p>You're absolutely right. one should be able to enumerate children of the TextField if they are in fact children of the TextField. I recently ran across an implementation where being able to index images referenced in img tags in that manner would have saved a lot of time. I ended up using regex to list all img tags&#8230; not ideal really.<br />
here's the regex to match all img tags </p>
<p>var reImages:RegExp = //sigm;<br />
var oIMGMatches:Object = reImages.exec(sContent);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim K</title>
		<link>http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/comment-page-1/#comment-14505</link>
		<dc:creator>Tim K</dc:creator>
		<pubDate>Mon, 02 Mar 2009 18:53:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/#comment-14505</guid>
		<description>woops sorry. btnRuleBook is supposed to be emb.</description>
		<content:encoded><![CDATA[<p>woops sorry. btnRuleBook is supposed to be emb.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim K</title>
		<link>http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/comment-page-1/#comment-14496</link>
		<dc:creator>Tim K</dc:creator>
		<pubDate>Fri, 27 Feb 2009 15:01:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.hydrotik.com/2007/12/19/as3-html-text-tags/#comment-14496</guid>
		<description>I&#039;ve come up with a decent workaround. Hope this helps someone.

What you do is put a MouseEvent.CLICK listener on the TextField then you check to see if the mouse clicked within the rectangle area of the embedded image.

//t is the TextField
//emb is the embedded image

t.addEventListener(MouseEvent.CLICK, onTextClick);
emb = t.textField.getImageReference(&quot;icon&quot;) as Loader;

function onTextClick(e:MouseEvent):void
{
   var p:Point = new Point(e.localX, e.localY);
   var r:Rectangle = btnRuleBook.getRect(e.target as TextField);
   if (r.containsPoint(p))
   {
      //launch URL or whatever
   }
}</description>
		<content:encoded><![CDATA[<p>I've come up with a decent workaround. Hope this helps someone.</p>
<p>What you do is put a MouseEvent.CLICK listener on the TextField then you check to see if the mouse clicked within the rectangle area of the embedded image.</p>
<p>//t is the TextField<br />
//emb is the embedded image</p>
<p>t.addEventListener(MouseEvent.CLICK, onTextClick);<br />
emb = t.textField.getImageReference("icon") as Loader;</p>
<p>function onTextClick(e:MouseEvent):void<br />
{<br />
   var p:Point = new Point(e.localX, e.localY);<br />
   var r:Rectangle = btnRuleBook.getRect(e.target as TextField);<br />
   if (r.containsPoint(p))<br />
   {<br />
      //launch URL or whatever<br />
   }<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

