[flexcoders] Re: Custom Tooltips in actionscript - Correction

2006-11-25 Thread richmcgillicuddy
John,


Thanks for the tips. I think I got it between your help and one spot
in the UIComponent help. So the code I was getting caught up in was
the line

toolTipCreate="event.toolTip=this.createTip()

Where createTip created a custom tooltip as described in a number of
posts I've seen before. What I failed to understand was that the code
is really a small function and equivalent to:



onInit(): void{
...
chkbox1.addEventListener(ToolTipEvent.TOOL_TIP_CREATE, onToolTipCreate);
}


 private function onToolTipCreate(thisEvent : ToolTipEvent): void {
thisEvent.toolTip = this.createTip();
trace("ToolTipCreate");
 }


So I was able to get this model to display my custom tooltips for my
subset of items. On the TOOL_TIP_SHOW event, I can initialize the
tooltip components.


Thanks for your help,


Rich

--- In flexcoders@yahoogroups.com, John Kirby <[EMAIL PROTECTED]> wrote:
>
> Correction here.  Replace in  
> wToolTip.setComponentClass(AreaCodeSearchWindow) with 
> wToolTip.setComponentObject(AreaCodeSearchWindow);
> 
> John Kirby said the following:
> >
> > Below is how I handle custom components in a tooltip.
> >
> > weather.WeatherToolTipManager extends ToolTipManager. WeatherToolTip 
> > Extend ToolTip .  Just create a WeatherToolTip object and use the 
> > setComponentClass(UiComponent) to store the custom componet. Then
pass 
> > the tooltip to the create custom tooltip to allow you to view your 
> > component inside a tooltip.
> >
> >
> > 
> >  > backgroundColor="0xFF" xmlns:mx="http://www.adobe.com/2006/mxml";  
> > layout="absolute" >
> >
> > 
> >
> > 
> > 
> >
> >
> > There is a destroy method to close/remove the tooltip.  This could be 
> > called by a button component inside the tooltip or handled via a 
> > rollover/out event.
> >
> >
> > public class WeatherToolTipManager extends ToolTipManager{
> >
> >public static var toolTipOpen:Boolean = false;
> >public static var currentToolTip:IToolTip;
> >   
> >  
> >public static function createCustomToolTip(x:Number, y:Number,
> >  wToolTip:ToolTip,
> >  errorTipBorderStyle:String = 
> > null,
> >  context:IUIComponent = 
> > null):void{
> >
> >var sm:ISystemManager = context ?
> >context.systemManager :
> >   
Application.application.systemManager;
> >
> >  
> >sm.toolTipChildren.addChild(wToolTip);
> >  
> >   
> >if (errorTipBorderStyle){
> >   wToolTip.setStyle("borderStyle", errorTipBorderStyle);
> >}
> >   
> >   
> >currentToolTip = wToolTip;
> >wToolTip.move(x, y);
> >toolTipOpen = true;
> >}
> >   
> >   
> >
> >public static function destroyToolTip(toolTip:IToolTip):void{
> >var sm:ISystemManager = toolTip.systemManager;
> >sm.toolTipChildren.removeChild(DisplayObject(toolTip));  
> >toolTipOpen = false;
> >
> >}
> > }
> >
> > public class WeatherToolTip extends ToolTip {
> >private var tipClass:Class;
> >private var tipX:int;
> >private var tipY:int;
> >  
> >private var classInstance:Object;
> >   
> >public function WeatherToolTip(){
> >super();
> >   // Make the ToolTip invisible to the mouse so that it
doesn't
> >   // interfere with the ToolTipManager's mouse-tracking.
> >   mouseEnabled = false;
> >}
> >   
> >public function getTipComponent():Object{
> >   return this.classInstance;
> >}
> >  
> >public function setComponentClass(tipClass:Class):void{ 
> >   this.tipClass = tipClass;
> >}
> >   
> >public function setComponentObject(objClass:Object):void{ 
> >   this.classInstance = objClass;
> >}
> >   
> >public function setCoordinates(x:int,y:int):void{
> > this.tipX = x;
> > this.tipY = y;
> >
> >}
> >  
> >override protected function createChildren():void {
> >   super.createChildren();
> >
> >   classInstance.parentTip = this;
> >   classInstance.x = this.tipX;
> >   classInstance.y = this.tipY;
> >   classInstance.addEventListener("closeTip",destroyTip);
> >   addChild(DisplayObject(classInstance));
> > }
> >
> > public function destroyTip():void {
> > WeatherToolTipManager.destroyToolTip(this);
> > }
> > }
> > }
> >
> >
> >
> >
> > richmcgillicuddy said the following:
> >
> >> John,
> >>
> >> Searched through the docs and it doesn't quite answer my que

Re: [flexcoders] Re: Custom Tooltips in actionscript - Correction

2006-11-24 Thread John Kirby
Correction here.  Replace in  
wToolTip.setComponentClass(AreaCodeSearchWindow) with 
wToolTip.setComponentObject(AreaCodeSearchWindow);


John Kirby said the following:


Below is how I handle custom components in a tooltip.

weather.WeatherToolTipManager extends ToolTipManager. WeatherToolTip 
Extend ToolTip .  Just create a WeatherToolTip object and use the 
setComponentClass(UiComponent) to store the custom componet. Then pass 
the tooltip to the create custom tooltip to allow you to view your 
component inside a tooltip.




backgroundColor="0xFF" xmlns:mx="http://www.adobe.com/2006/mxml";  
layout="absolute" >








There is a destroy method to close/remove the tooltip.  This could be 
called by a button component inside the tooltip or handled via a 
rollover/out event.



public class WeatherToolTipManager extends ToolTipManager{
   
   public static var toolTipOpen:Boolean = false;

   public static var currentToolTip:IToolTip;
  
 
   public static function createCustomToolTip(x:Number, y:Number,

 wToolTip:ToolTip,
 errorTipBorderStyle:String = 
null,
 context:IUIComponent = 
null):void{


   var sm:ISystemManager = context ?
   context.systemManager :
   Application.application.systemManager;
   
 
   sm.toolTipChildren.addChild(wToolTip);
 
  
   if (errorTipBorderStyle){

  wToolTip.setStyle("borderStyle", errorTipBorderStyle);
   }
  
  
   currentToolTip = wToolTip;

   wToolTip.move(x, y);
   toolTipOpen = true;
   }
  
  


   public static function destroyToolTip(toolTip:IToolTip):void{
   var sm:ISystemManager = toolTip.systemManager;
   sm.toolTipChildren.removeChild(DisplayObject(toolTip));  
   toolTipOpen = false;
   
   }

}

public class WeatherToolTip extends ToolTip {
   private var tipClass:Class;
   private var tipX:int;
   private var tipY:int;
 
   private var classInstance:Object;
  
   public function WeatherToolTip(){

   super();
  // Make the ToolTip invisible to the mouse so that it doesn't
  // interfere with the ToolTipManager's mouse-tracking.
  mouseEnabled = false;
   }
  
   public function getTipComponent():Object{

  return this.classInstance;
   }
 
   public function setComponentClass(tipClass:Class):void{ 
  this.tipClass = tipClass;

   }
  
   public function setComponentObject(objClass:Object):void{ 
  this.classInstance = objClass;

   }
  
   public function setCoordinates(x:int,y:int):void{

this.tipX = x;
this.tipY = y;
   
   }
 
   override protected function createChildren():void {

  super.createChildren();
   
  classInstance.parentTip = this;

  classInstance.x = this.tipX;
  classInstance.y = this.tipY;
  classInstance.addEventListener("closeTip",destroyTip);
  addChild(DisplayObject(classInstance));
}
   
public function destroyTip():void {

WeatherToolTipManager.destroyToolTip(this);
}
}
}




richmcgillicuddy said the following:


John,

Searched through the docs and it doesn't quite answer my question. So
I have a descendant of ITooltip that is a more complex toolTip with
multiple pieces of information on it. I only want this complex tooltip
to show up for certain types of objects, others I want the standard
tooltip to show up. These objects get created and placed dynamically.
I'll check the createToolTip event and see if that will override the
standard event but the examples I saw so far all created this
functionality using MXML which works great. I'd rather use the toolTip
functionality than try to override everything on a rollover, rollout
command.


s via email: Switch delivery to Daily Digest 
 
| Switch format to Traditional 
 

Visit Your Group 
 
| Yahoo! Groups Terms of Use  | 
Unsubscribe 

.



--
/Whether you think that you can, or that you can't, you are usually 
right./

 - Henry Ford
 


--
/Whether you think that you can, or that you can't, you are usually right./
- Henry Ford


Re: [flexcoders] Re: Custom Tooltips in actionscript -With effects

2006-11-24 Thread John Kirby
Some have asked me for the full blown with the sound effects.  This is 
similar to the Jamjar demo



backgroundColor="0xFF" xmlns:mx="http://www.adobe.com/2006/mxml";  
layout="absolute" >




source="@Embed(source='Sounds.swf',symbol='openPodSoundSymb')" />
source="@Embed(source='Sounds.swf',symbol='closePodSoundSymb')" />
heightTo="230"/>












John Kirby said the following:


Below is how I handle custom components in a tooltip.

weather.WeatherToolTipManager extends ToolTipManager. WeatherToolTip 
Extend ToolTip .  Just create a WeatherToolTip object and use the 
setComponentClass(UiComponent) to store the custom componet. Then pass 
the tooltip to the create custom tooltip to allow you to view your 
component inside a tooltip.




backgroundColor="0xFF" xmlns:mx="http://www.adobe.com/2006/mxml";  
layout="absolute" >








There is a destroy method to close/remove the tooltip.  This could be 
called by a button component inside the tooltip or handled via a 
rollover/out event.



public class WeatherToolTipManager extends ToolTipManager{
   
   public static var toolTipOpen:Boolean = false;

   public static var currentToolTip:IToolTip;
  
 
   public static function createCustomToolTip(x:Number, y:Number,

 wToolTip:ToolTip,
 errorTipBorderStyle:String = 
null,
 context:IUIComponent = 
null):void{


   var sm:ISystemManager = context ?
   context.systemManager :
   Application.application.systemManager;
   
 
   sm.toolTipChildren.addChild(wToolTip);
 
  
   if (errorTipBorderStyle){

  wToolTip.setStyle("borderStyle", errorTipBorderStyle);
   }
  
  
   currentToolTip = wToolTip;

   wToolTip.move(x, y);
   toolTipOpen = true;
   }
  
  


   public static function destroyToolTip(toolTip:IToolTip):void{
   var sm:ISystemManager = toolTip.systemManager;
   sm.toolTipChildren.removeChild(DisplayObject(toolTip));  
   toolTipOpen = false;
   
   }

}

public class WeatherToolTip extends ToolTip {
   private var tipClass:Class;
   private var tipX:int;
   private var tipY:int;
 
   private var classInstance:Object;
  
   public function WeatherToolTip(){

   super();
  // Make the ToolTip invisible to the mouse so that it doesn't
  // interfere with the ToolTipManager's mouse-tracking.
  mouseEnabled = false;
   }
  
   public function getTipComponent():Object{

  return this.classInstance;
   }
 
   public function setComponentClass(tipClass:Class):void{ 
  this.tipClass = tipClass;

   }
  
   public function setComponentObject(objClass:Object):void{ 
  this.classInstance = objClass;

   }
  
   public function setCoordinates(x:int,y:int):void{

this.tipX = x;
this.tipY = y;
   
   }
 
   override protected function createChildren():void {

  super.createChildren();
   
  classInstance.parentTip = this;

  classInstance.x = this.tipX;
  classInstance.y = this.tipY;
  classInstance.addEventListener("closeTip",destroyTip);
  addChild(DisplayObject(classInstance));
}
   
public function destroyTip():void {

WeatherToolTipManager.destroyToolTip(this);
}
}
}




richmcgillicuddy said the following:


John,

Searched through the docs and it doesn't quite answer my question. So
I have a descendant of ITooltip that is a more complex toolTip with
multiple pieces of information on it. I only want this complex tooltip
to show up for certain types of objects, others I want the standard
tooltip to show up. These objects get created and placed dynamically.
I'll check the createToolTip event and see if that will override the
standard event but the examples I saw so far all created this
functionality using MXML which works great. I'd rather use the toolTip
functionality than try to override everything on a rollover, rollout
command.


s via email: Switch delivery to Daily Digest 
 
| Switch format to Traditional 
 

Visit Your Group 
 
| Yahoo! Groups Terms of Use  | 
Unsubscribe 

.



--
/Whether you think that you can, or that you can't, you are usually 
right./

 - Henry Ford
 


--
/Whether you think that you can, or that you can't, you are usually right./
- H

Re: [flexcoders] Re: Custom Tooltips in actionscript

2006-11-23 Thread John Kirby

Below is how I handle custom components in a tooltip.

weather.WeatherToolTipManager extends ToolTipManager. WeatherToolTip 
Extend ToolTip .  Just create a WeatherToolTip object and use the 
setComponentClass(UiComponent) to store the custom componet. Then pass 
the tooltip to the create custom tooltip to allow you to view your 
component inside a tooltip.




backgroundColor="0xFF" xmlns:mx="http://www.adobe.com/2006/mxml";  
layout="absolute" >








There is a destroy method to close/remove the tooltip.  This could be 
called by a button component inside the tooltip or handled via a 
rollover/out event.



public class WeatherToolTipManager extends ToolTipManager{
  
  public static var toolTipOpen:Boolean = false;

  public static var currentToolTip:IToolTip;
 

  public static function createCustomToolTip(x:Number, y:Number,

wToolTip:ToolTip,
errorTipBorderStyle:String = null,
context:IUIComponent = null):void{

  var sm:ISystemManager = context ?
  context.systemManager :
  Application.application.systemManager;
  

  sm.toolTipChildren.addChild(wToolTip);

 
  if (errorTipBorderStyle){

 wToolTip.setStyle("borderStyle", errorTipBorderStyle);
  }
 
 
  currentToolTip = wToolTip;

  wToolTip.move(x, y);
  toolTipOpen = true;
  }
 
 


  public static function destroyToolTip(toolTip:IToolTip):void{
  var sm:ISystemManager = toolTip.systemManager;
  sm.toolTipChildren.removeChild(DisplayObject(toolTip));  
  toolTipOpen = false;
  
  }

   }

public class WeatherToolTip extends ToolTip {
  private var tipClass:Class;
  private var tipX:int;
  private var tipY:int;

  private var classInstance:Object;
 
  public function WeatherToolTip(){

  super();
 // Make the ToolTip invisible to the mouse so that it doesn't
 // interfere with the ToolTipManager's mouse-tracking.
 mouseEnabled = false;
  }
 
  public function getTipComponent():Object{

 return this.classInstance;
  }

  public function setComponentClass(tipClass:Class):void{ 
 this.tipClass = tipClass;

  }
 
  public function setComponentObject(objClass:Object):void{ 
 this.classInstance = objClass;

  }
 
  public function setCoordinates(x:int,y:int):void{

   this.tipX = x;
   this.tipY = y;
  
  }


  override protected function createChildren():void {
 super.createChildren();
  
 classInstance.parentTip = this;

 classInstance.x = this.tipX;
 classInstance.y = this.tipY;
 classInstance.addEventListener("closeTip",destroyTip);
 addChild(DisplayObject(classInstance));
   }
  
   public function destroyTip():void {

   WeatherToolTipManager.destroyToolTip(this);
   }
   }
}




richmcgillicuddy said the following:


John,

Searched through the docs and it doesn't quite answer my question. So
I have a descendant of ITooltip that is a more complex toolTip with
multiple pieces of information on it. I only want this complex tooltip
to show up for certain types of objects, others I want the standard
tooltip to show up. These objects get created and placed dynamically.
I'll check the createToolTip event and see if that will override the
standard event but the examples I saw so far all created this
functionality using MXML which works great. I'd rather use the toolTip
functionality than try to override everything on a rollover, rollout
command.


s via email: Switch delivery to Daily Digest 
 
| Switch format to Traditional 
 

Visit Your Group 
 
| Yahoo! Groups Terms of Use  | 
Unsubscribe 

Recent Activity

   *
   56
  New Members
  


Visit Your Group 
 


SPONSORED LINKS

* Software development tool
  


[flexcoders] Re: Custom Tooltips in actionscript

2006-11-23 Thread richmcgillicuddy
John,


Searched through the docs and it doesn't quite answer my question. So
I have a descendant of ITooltip that is a more complex toolTip with
multiple pieces of information on it. I only want this complex tooltip
to show up for certain types of objects, others I want the standard
tooltip to show up. These objects get created and placed dynamically.
I'll check the createToolTip event and see if that will override the
standard event but the examples I saw so far all created this
functionality using MXML which works great. I'd rather use the toolTip
functionality than try to override everything on a rollover, rollout
command.


Rich

--- In flexcoders@yahoogroups.com, John Kirby <[EMAIL PROTECTED]> wrote:
>
> Rich -
> 
> There is a good example in the Flex docs under "Using the ToolTip
Manager"
> 
> Basically you create an listener on the UIControl which catches the 
> toolTipShow event and fires a callback method.  Do what you need to do 
> in the call back
> 
> 
> 
> myButton.addEventListener("toolTipShow", myCallBack)
> 
> private function myCallBack(event:ToolTipEvent):void{
> 
> ToolTipManager.currentToolTip.text = "some custom text";
> 
> // Do some more custom stuff
> 
> 
> }
> 
> This will display "some custom text" when you hover over the button.
> 
> You can take this even further by using the 
> ToolTipManager.createToolTip() to really enhance the tip with fonts, 
> styles, etc.
> 
> There are examples of this in the Using the ToolTip Manager.
> 
> If you want to add components to your tooltip... let me know.  I have 
> created some classes which extend toolTip so you can add panels, 
> TitleWindows, etc to your tooltip.
> 
> .j
> 
> richmcgillicuddy said the following:
> >
> > I've looked at the various ways to create custom tooltips and they
> > work great if the custom tooltip is defined in the MXML code with a
> > format similar to:
> > toolTip=" " toolTipCreate="event.toolTip=this.createTip()"
> >
> > If I create an UIComponent via Actionscript and want to
> > use the custom toolTip, how would I do this? How do I associate the
> > toolTipCreate event in ActionScript?
> >
> > var myLabel : Label;
> > myLabel.toolTipCreate = 
> >
> > Any help would be greatly appreciated.
> >
> > Rich
> >
> >  
> 
> -- 
> /Whether you think that you can, or that you can't, you are usually
right./
>  - Henry Ford
>