<?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/"
	xmlns:series="http://unfoldingneurons.com/"
		>
<channel>
	<title>Comments on: Advanced Callout Component</title>
	<atom:link href="http://aaronhardy.com/flex/advanced-callout-component/feed/" rel="self" type="application/rss+xml" />
	<link>http://aaronhardy.com/flex/advanced-callout-component/</link>
	<description>For all your Aaron Hardy needs.</description>
	<lastBuildDate>Thu, 17 May 2012 03:52:23 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Winkyboy</title>
		<link>http://aaronhardy.com/flex/advanced-callout-component/comment-page-2/#comment-21796</link>
		<dc:creator>Winkyboy</dc:creator>
		<pubDate>Mon, 02 May 2011 19:58:53 +0000</pubDate>
		<guid isPermaLink="false">http://aaronhardy.com/?p=175#comment-21796</guid>
		<description>Great work on this - thanks so much!</description>
		<content:encoded><![CDATA[<p>Great work on this &#8211; thanks so much!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Micah Waldman</title>
		<link>http://aaronhardy.com/flex/advanced-callout-component/comment-page-2/#comment-15498</link>
		<dc:creator>Micah Waldman</dc:creator>
		<pubDate>Thu, 27 Jan 2011 05:04:48 +0000</pubDate>
		<guid isPermaLink="false">http://aaronhardy.com/?p=175#comment-15498</guid>
		<description>@Babu,

I&#039;m not familiar with Maps, so won&#039;t be able to help much. If Map is a subclass of UIComponent, then things should work. Otherwise, you&#039;ll probably need to understand what Map events could cause your callouts to &quot;lose&quot; their location and adjust appropriately. Good luck.

Micah</description>
		<content:encoded><![CDATA[<p>@Babu,</p>
<p>I&#8217;m not familiar with Maps, so won&#8217;t be able to help much. If Map is a subclass of UIComponent, then things should work. Otherwise, you&#8217;ll probably need to understand what Map events could cause your callouts to &#8220;lose&#8221; their location and adjust appropriately. Good luck.</p>
<p>Micah</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Babu</title>
		<link>http://aaronhardy.com/flex/advanced-callout-component/comment-page-2/#comment-15476</link>
		<dc:creator>Babu</dc:creator>
		<pubDate>Wed, 26 Jan 2011 17:22:07 +0000</pubDate>
		<guid isPermaLink="false">http://aaronhardy.com/?p=175#comment-15476</guid>
		<description>@Micah

I want to make my application exactly the same as,

http://maps.google.com/maps?hl=en&amp;safe=active&amp;um=1&amp;ie=UTF-8&amp;q=bank&amp;fb=1&amp;gl=us&amp;hq=bank&amp;hnear=Princeton,+NJ&amp;ei=8ldATailIYet8AawyoycBA&amp;sa=X&amp;oi=local_group&amp;ct=image&amp;resnum=4&amp;ved=0CAkQtgMwAw

Thank you</description>
		<content:encoded><![CDATA[<p>@Micah</p>
<p>I want to make my application exactly the same as,</p>
<p><a href="http://maps.google.com/maps?hl=en&#038;safe=active&#038;um=1&#038;ie=UTF-8&#038;q=bank&#038;fb=1&#038;gl=us&#038;hq=bank&#038;hnear=Princeton,+NJ&#038;ei=8ldATailIYet8AawyoycBA&#038;sa=X&#038;oi=local_group&#038;ct=image&#038;resnum=4&#038;ved=0CAkQtgMwAw" rel="nofollow">http://maps.google.com/maps?hl=en&#038;safe=active&#038;um=1&#038;ie=UTF-8&#038;q=bank&#038;fb=1&#038;gl=us&#038;hq=bank&#038;hnear=Princeton,+NJ&#038;ei=8ldATailIYet8AawyoycBA&#038;sa=X&#038;oi=local_group&#038;ct=image&#038;resnum=4&#038;ved=0CAkQtgMwAw</a></p>
<p>Thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Babu</title>
		<link>http://aaronhardy.com/flex/advanced-callout-component/comment-page-2/#comment-15474</link>
		<dc:creator>Babu</dc:creator>
		<pubDate>Wed, 26 Jan 2011 16:59:53 +0000</pubDate>
		<guid isPermaLink="false">http://aaronhardy.com/?p=175#comment-15474</guid>
		<description>@Micah

here&#039;s my change

public function show(owner:DisplayObjectContainer):void {
		if (!isPopUp) {
			if (owner != this.owner) {
					hide();
			} else {
					return;
			}
				
			this.owner = owner;
				
			if (this.owner is Map) {
		this.owner.addEventListener(MapEvent.MOVE_START, readjustPositioningMove);
				
		}

				
		PopUpManager.addPopUp(this, owner);
			}
			
		

		}</description>
		<content:encoded><![CDATA[<p>@Micah</p>
<p>here&#8217;s my change</p>
<p>public function show(owner:DisplayObjectContainer):void {<br />
		if (!isPopUp) {<br />
			if (owner != this.owner) {<br />
					hide();<br />
			} else {<br />
					return;<br />
			}</p>
<p>			this.owner = owner;</p>
<p>			if (this.owner is Map) {<br />
		this.owner.addEventListener(MapEvent.MOVE_START, readjustPositioningMove);</p>
<p>		}</p>
<p>		PopUpManager.addPopUp(this, owner);<br />
			}</p>
<p>		}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Babu</title>
		<link>http://aaronhardy.com/flex/advanced-callout-component/comment-page-1/#comment-15471</link>
		<dc:creator>Babu</dc:creator>
		<pubDate>Wed, 26 Jan 2011 15:43:37 +0000</pubDate>
		<guid isPermaLink="false">http://aaronhardy.com/?p=175#comment-15471</guid>
		<description>@Micah

Thank you so much for your quick response. My callout owner is map,  do you have any idea what will be my owner? I tried couple of things but still not working.

Babu</description>
		<content:encoded><![CDATA[<p>@Micah</p>
<p>Thank you so much for your quick response. My callout owner is map,  do you have any idea what will be my owner? I tried couple of things but still not working.</p>
<p>Babu</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Micah Waldman</title>
		<link>http://aaronhardy.com/flex/advanced-callout-component/comment-page-1/#comment-15448</link>
		<dc:creator>Micah Waldman</dc:creator>
		<pubDate>Wed, 26 Jan 2011 04:34:45 +0000</pubDate>
		<guid isPermaLink="false">http://aaronhardy.com/?p=175#comment-15448</guid>
		<description>@Babu,

I ended up changing some of the code. Changes are delimited by comments with &quot;MW Add&quot;.
Note that this only works for UIComponent objects.
 Here&#039;s the changed setter for &#039;content&#039; (and a new function it uses):
&lt;pre&gt;
		
		/**
		 * @private
		 */
		public function set content(value:UIComponent):void {
			if (_content == value) {
				return;
			}

// MW Add start:	
			// We want to catch content size changes by listening to resize events. We can only do that
			// for UIComponent objects, though (not perfect, but better than nothing). Before we handle 
			// the new content, check if we need to remove the event listener on the previous content.
			if (_content != null &amp;&amp; value is UIComponent) {
				_content.removeEventListener(ResizeEvent.RESIZE, invalidateContent);
			}
// MW Add end.
			
			_content = value;
			contentChanged = true;

// MW Add start:		
			if (_content is UIComponent) {
				_content.addEventListener(ResizeEvent.RESIZE, invalidateContent);
			}
// MW Add end.

			invalidateProperties();
			invalidateDisplayList();
			invalidateSize();			
		}

// MW Add start:		
		public function invalidateContent(e:Event=null):void {
			contentChanged = true;
			invalidateProperties();
			invalidateDisplayList();
			invalidateSize();			
		}
// MW Add end.
&lt;/pre&gt;


And here&#039;s the changed show() and hide() functions and a new function they use:
&lt;pre&gt;
		
		/**
		 * Pops up the callout using the PopUpManager.
		 * 
		 * @param parent DisplayObject to be used for determining which SystemManager&#039;s layers
		 * to use.
		 */
		public function show(owner:DisplayObjectContainer):void {
//MW Add start:				
			if (isPopUp) {
				if (owner != this.owner) {
					// Callout is already shown but we have a new owner - get rid of old popup and then show new one.
					hide();
				} else {
					// No need to do anything - we&#039;re already showing callout
					return;
				}
			}
//MW Add end.				

			this.owner = owner;
//MW Add start:				
			if (this.owner is UIComponent) {
				// listen to move and resize events on the owner to readjust callout positioning
				this.owner.addEventListener(MoveEvent.MOVE, readjustPositioning);
				this.owner.addEventListener(ResizeEvent.RESIZE, readjustPositioning);
			}
//MW Add end.				
			PopUpManager.addPopUp(this, owner);
		}
		
		/**
		 * Hides the callout.
		 */
		public function hide():void {
			if (isPopUp) {
//MW Add start:				
				if (this.owner is UIComponent) {
					this.owner.removeEventListener(MoveEvent.MOVE, readjustPositioning);
					this.owner.removeEventListener(ResizeEvent.RESIZE, readjustPositioning);
				}
//MW Add end.				

				PopUpManager.removePopUp(this);
			}
		}

//MW Add start:				
		/**
		 * @protected
		 * Readjusts callout position and tail position based on owner&#039;s resize or move.
		 * 
		 * @param e Event.
		 */
		protected function readjustPositioning(e:Event):void {
			// We cheat a bit by setting anchorPointChanged to true - it hasn&#039;t really changed but
			// we need to trigger a re-evaluation of the tail position
			contentChanged = true;
			callLater(invalidateProperties);
			callLater(invalidateDisplayList);
		}
//MW Add end.				
&lt;/pre&gt;


BTW, I also had a problem in getAnchorPointByTailPosition() and replaced the call to getBounds() with the following:
&lt;pre&gt;
//Original:				ownerBounds = owner.getBounds(stage);
//MW Add start: (getBounds sometimes returns rect that is way bigger than object, for some reason.
//				 for UIComponent objects, we could use getVisibleRect(), but the following works for all objects
				var p:Point = owner.localToGlobal(new Point(0, 0));
				ownerBounds = new Rectangle(p.x, p.y, owner.width, owner.height);
//MW Add end.				
&lt;/pre&gt;


Hope this helps. 
Micah</description>
		<content:encoded><![CDATA[<p>@Babu,</p>
<p>I ended up changing some of the code. Changes are delimited by comments with &#8220;MW Add&#8221;.<br />
Note that this only works for UIComponent objects.<br />
 Here&#8217;s the changed setter for &#8216;content&#8217; (and a new function it uses):</p>
<pre>

		/**
		 * @private
		 */
		public function set content(value:UIComponent):void {
			if (_content == value) {
				return;
			}

// MW Add start:
			// We want to catch content size changes by listening to resize events. We can only do that
			// for UIComponent objects, though (not perfect, but better than nothing). Before we handle
			// the new content, check if we need to remove the event listener on the previous content.
			if (_content != null &amp;&amp; value is UIComponent) {
				_content.removeEventListener(ResizeEvent.RESIZE, invalidateContent);
			}
// MW Add end.

			_content = value;
			contentChanged = true;

// MW Add start:
			if (_content is UIComponent) {
				_content.addEventListener(ResizeEvent.RESIZE, invalidateContent);
			}
// MW Add end.

			invalidateProperties();
			invalidateDisplayList();
			invalidateSize();
		}

// MW Add start:
		public function invalidateContent(e:Event=null):void {
			contentChanged = true;
			invalidateProperties();
			invalidateDisplayList();
			invalidateSize();
		}
// MW Add end.
</pre>
<p>And here&#8217;s the changed show() and hide() functions and a new function they use:</p>
<pre>

		/**
		 * Pops up the callout using the PopUpManager.
		 *
		 * @param parent DisplayObject to be used for determining which SystemManager's layers
		 * to use.
		 */
		public function show(owner:DisplayObjectContainer):void {
//MW Add start:
			if (isPopUp) {
				if (owner != this.owner) {
					// Callout is already shown but we have a new owner - get rid of old popup and then show new one.
					hide();
				} else {
					// No need to do anything - we're already showing callout
					return;
				}
			}
//MW Add end.				

			this.owner = owner;
//MW Add start:
			if (this.owner is UIComponent) {
				// listen to move and resize events on the owner to readjust callout positioning
				this.owner.addEventListener(MoveEvent.MOVE, readjustPositioning);
				this.owner.addEventListener(ResizeEvent.RESIZE, readjustPositioning);
			}
//MW Add end.
			PopUpManager.addPopUp(this, owner);
		}

		/**
		 * Hides the callout.
		 */
		public function hide():void {
			if (isPopUp) {
//MW Add start:
				if (this.owner is UIComponent) {
					this.owner.removeEventListener(MoveEvent.MOVE, readjustPositioning);
					this.owner.removeEventListener(ResizeEvent.RESIZE, readjustPositioning);
				}
//MW Add end.				

				PopUpManager.removePopUp(this);
			}
		}

//MW Add start:
		/**
		 * @protected
		 * Readjusts callout position and tail position based on owner's resize or move.
		 *
		 * @param e Event.
		 */
		protected function readjustPositioning(e:Event):void {
			// We cheat a bit by setting anchorPointChanged to true - it hasn't really changed but
			// we need to trigger a re-evaluation of the tail position
			contentChanged = true;
			callLater(invalidateProperties);
			callLater(invalidateDisplayList);
		}
//MW Add end.
</pre>
<p>BTW, I also had a problem in getAnchorPointByTailPosition() and replaced the call to getBounds() with the following:</p>
<pre>
//Original:				ownerBounds = owner.getBounds(stage);
//MW Add start: (getBounds sometimes returns rect that is way bigger than object, for some reason.
//				 for UIComponent objects, we could use getVisibleRect(), but the following works for all objects
				var p:Point = owner.localToGlobal(new Point(0, 0));
				ownerBounds = new Rectangle(p.x, p.y, owner.width, owner.height);
//MW Add end.
</pre>
<p>Hope this helps.<br />
Micah</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Babu</title>
		<link>http://aaronhardy.com/flex/advanced-callout-component/comment-page-1/#comment-15416</link>
		<dc:creator>Babu</dc:creator>
		<pubDate>Tue, 25 Jan 2011 15:32:04 +0000</pubDate>
		<guid isPermaLink="false">http://aaronhardy.com/?p=175#comment-15416</guid>
		<description>@Micah

Can you explain how to callout readjust its position when its owner is resized and/or moved? I couldn&#039;t fix it.

Thank you in advance!

Babu</description>
		<content:encoded><![CDATA[<p>@Micah</p>
<p>Can you explain how to callout readjust its position when its owner is resized and/or moved? I couldn&#8217;t fix it.</p>
<p>Thank you in advance!</p>
<p>Babu</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Babu</title>
		<link>http://aaronhardy.com/flex/advanced-callout-component/comment-page-1/#comment-15376</link>
		<dc:creator>Babu</dc:creator>
		<pubDate>Mon, 24 Jan 2011 19:53:46 +0000</pubDate>
		<guid isPermaLink="false">http://aaronhardy.com/?p=175#comment-15376</guid>
		<description>Thank you for the great component. I am using it for my map application but I got problem with resizing the browser and moving the map. The callout doesn&#039;t move with the change. I tried to implement the solution suggested by the Micah but couldn&#039;t help.

Any assistance would be really appreciated.</description>
		<content:encoded><![CDATA[<p>Thank you for the great component. I am using it for my map application but I got problem with resizing the browser and moving the map. The callout doesn&#8217;t move with the change. I tried to implement the solution suggested by the Micah but couldn&#8217;t help.</p>
<p>Any assistance would be really appreciated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: li</title>
		<link>http://aaronhardy.com/flex/advanced-callout-component/comment-page-1/#comment-9251</link>
		<dc:creator>li</dc:creator>
		<pubDate>Mon, 15 Nov 2010 09:52:51 +0000</pubDate>
		<guid isPermaLink="false">http://aaronhardy.com/?p=175#comment-9251</guid>
		<description>I find the Hide() function doesnot work easyly,
so ,I add a event named &quot;On_TooltipClose_Event&quot;, and add a listener function at the construct function,in the listen function execute the hide() method.
and I change the class to a singlton class ,so the tip window only show One at a time.
sorry for change your code 
public static var On_TooltipClose_Event:String= &quot;On_TooltipClose_Event&quot;;
        
        private static var _Callout:Callout= null;
        public static function get getInstance():Callout
        {
            if (_Callout==null)
            {
                _Callout = new Callout();
                
            }
            return _Callout;
        }
        public function Callout():void
        {
            this.addEventListener(On_TooltipClose_Event, onHideHandler);
        }
        private function onHideHandler(event:Event):void
        {
            hide();
        }</description>
		<content:encoded><![CDATA[<p>I find the Hide() function doesnot work easyly,<br />
so ,I add a event named &#8220;On_TooltipClose_Event&#8221;, and add a listener function at the construct function,in the listen function execute the hide() method.<br />
and I change the class to a singlton class ,so the tip window only show One at a time.<br />
sorry for change your code<br />
public static var On_TooltipClose_Event:String= &#8220;On_TooltipClose_Event&#8221;;</p>
<p>        private static var _Callout:Callout= null;<br />
        public static function get getInstance():Callout<br />
        {<br />
            if (_Callout==null)<br />
            {<br />
                _Callout = new Callout();</p>
<p>            }<br />
            return _Callout;<br />
        }<br />
        public function Callout():void<br />
        {<br />
            this.addEventListener(On_TooltipClose_Event, onHideHandler);<br />
        }<br />
        private function onHideHandler(event:Event):void<br />
        {<br />
            hide();<br />
        }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Micah Waldman</title>
		<link>http://aaronhardy.com/flex/advanced-callout-component/comment-page-1/#comment-8783</link>
		<dc:creator>Micah Waldman</dc:creator>
		<pubDate>Fri, 29 Oct 2010 23:35:02 +0000</pubDate>
		<guid isPermaLink="false">http://aaronhardy.com/?p=175#comment-8783</guid>
		<description>@Dameon,

I wonder if you have a similar issue as I ran into and for which I added the invalidateContent() function I posted a few comments above. It&#039;s easy enough to check - just call it after you catch a change in your image.

@Aaron,

Thanks for incorporating the fix. I&#039;ll check it out and report.

It would certainly be nice to have the callout readjust on a change in content size. One other related feature is to have the callout readjust its position when its owner is resized and/or moved. Not sure how common my use case is, but on each change in the callout content I also invoke a navigation change in the app. Since I use SWFAddress, the navigation takes longer than the callout content change and so I ended up using callLater to invoke my added invalidateContent() function. If the callout would catch position and size changes of its owner, this could be hanled automatically.

I&#039;m not sure how to do that, though. If the owner is a UIComponent then I guess you can listen to the resize and move events, but you currently assume that the owner is a DisplayObjectContainer. Maybe only handle this case if the owner is a UIComponent? I&#039;m not a Flex expert ...

As far as new features: I&#039;m still using Flex 3, and not a skin expert either so no need for me to go crazy there. The only feature that would be very useful to me is to be able to position the tail on one of the sides but not in the center.

For example, suppose I have two panels showing side by side with a button in the left panel about a third down from the top. I might want to show a callout that would be to its right (so &#039;left&#039; tail position) so as to cover some or all of the right panel, and have the tail at a third down from the callout&#039;s top. This would align nicely the callout with the button and the panels.

Now that I&#039;m thinking about it, it could also be nice to be able to specify something similar for the owner of the callout. In the example above, maybe I want to have the left panel be the owner but position the tail to point at some position on its side other than center.

I&#039;m not sure how best to parameterize this, but will chime in if any great idea comes to mind. Have you heard this request before?

Anyway, thanks again for a great component. One can always add more, but it has helped me greatly as it is.

Micah</description>
		<content:encoded><![CDATA[<p>@Dameon,</p>
<p>I wonder if you have a similar issue as I ran into and for which I added the invalidateContent() function I posted a few comments above. It&#8217;s easy enough to check &#8211; just call it after you catch a change in your image.</p>
<p>@Aaron,</p>
<p>Thanks for incorporating the fix. I&#8217;ll check it out and report.</p>
<p>It would certainly be nice to have the callout readjust on a change in content size. One other related feature is to have the callout readjust its position when its owner is resized and/or moved. Not sure how common my use case is, but on each change in the callout content I also invoke a navigation change in the app. Since I use SWFAddress, the navigation takes longer than the callout content change and so I ended up using callLater to invoke my added invalidateContent() function. If the callout would catch position and size changes of its owner, this could be hanled automatically.</p>
<p>I&#8217;m not sure how to do that, though. If the owner is a UIComponent then I guess you can listen to the resize and move events, but you currently assume that the owner is a DisplayObjectContainer. Maybe only handle this case if the owner is a UIComponent? I&#8217;m not a Flex expert &#8230;</p>
<p>As far as new features: I&#8217;m still using Flex 3, and not a skin expert either so no need for me to go crazy there. The only feature that would be very useful to me is to be able to position the tail on one of the sides but not in the center.</p>
<p>For example, suppose I have two panels showing side by side with a button in the left panel about a third down from the top. I might want to show a callout that would be to its right (so &#8216;left&#8217; tail position) so as to cover some or all of the right panel, and have the tail at a third down from the callout&#8217;s top. This would align nicely the callout with the button and the panels.</p>
<p>Now that I&#8217;m thinking about it, it could also be nice to be able to specify something similar for the owner of the callout. In the example above, maybe I want to have the left panel be the owner but position the tail to point at some position on its side other than center.</p>
<p>I&#8217;m not sure how best to parameterize this, but will chime in if any great idea comes to mind. Have you heard this request before?</p>
<p>Anyway, thanks again for a great component. One can always add more, but it has helped me greatly as it is.</p>
<p>Micah</p>
]]></content:encoded>
	</item>
</channel>
</rss>

