IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Flex Discussion :

Création custom tooltip


Sujet :

Flex

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Février 2005
    Messages
    29
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2005
    Messages : 29
    Points : 22
    Points
    22
    Par défaut Création custom tooltip
    Bonjour,

    J'ai construit un tooltip qui ne fonctionne pas. Pourquoi ?
    Merci par avance.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    <?xml version="1.0" encoding="utf-8"?>
    <!--  TestToolTip.mxml -->
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
     layout="vertical"
     backgroundGradientAlphas="[1.0, 1.0]"
     backgroundGradientColors="[#7C2B2B, #370B0B]" >
     
    <mx:Script>
     <![CDATA[
         import mx.containers.Tile;
     import mx.controls.Alert;
     import mx.collections.ArrayCollection;
     import mx.events.ToolTipEvent;
     import com.composants.CustomToolTip;
     import mx.rpc.http.HTTPService;
     import mx.rpc.events.ResultEvent;
     import mx.rpc.events.FaultEvent;
     
     [Bindable]
     private var mesData : ArrayCollection = new ArrayCollection([
     {terme:"Groupement",definition:"Nom du groupement ..."},
     {terme:"Utilisateur",definition:"Nom de l'utilisateur connecté ..."}
     ]);
     
    private function createCustomToolTip(event:ToolTipEvent):void {
      var toolTip:CustomToolTip = new CustomToolTip();
      toolTip.mesData = event.target.data;
      event.toolTip = toolTip;
    }
     
     ]]>
     </mx:Script>
     
     <mx:Label text="DONNEES" color="#FFFFFF"
     fontWeight="bold" fontFamily="Arial" fontSize="25"
     toolTip=" " toolTipCreate="createCustomToolTip(event)"/>
     
    </mx:Application>

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    <?xml version="1.0" encoding="utf-8"?>
    <!-- CustomToolTip.mxml -->
        <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
         implements="mx.core.IToolTip"
         borderThickness="5"
         backgroundColor="#FFFFFF"
         borderColor="black"
         borderStyle="solid"
         cornerRadius="10" horizontalAlign="center" paddingTop="10">
     
         <mx:Script>
         <![CDATA[
         [Bindable]
         public var mesData:Object;
     
         //  Implement required methods of the IToolTip interface;
          //  these methods are not used in this example, though.
         public var _text:String;
     
         public function get text():String {
         return _text;
         }
         public function set text(value:String):void {
         }
     
         ]]>
         </mx:Script>
     
        <mx:Form paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10">
            <mx:FormItem label="{mesData.terme} : ">
                <mx:Label text="{mesData.definition}"/>
            </mx:FormItem>
        </mx:Form>
     
    </mx:VBox>

  2. #2
    Membre régulier Avatar de ouaqa
    Profil pro
    Développeur Web
    Inscrit en
    Avril 2009
    Messages
    95
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Avril 2009
    Messages : 95
    Points : 100
    Points
    100
    Par défaut
    Bonjour,

    Voici un exemple de création d'un tooltip personnalisé :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
     
    public class VisuCanvasCommons extends Canvas
    {
     
    	private var tagTip : VisuCanvasCommonsTagListTooltip ;
     
     
    	/**
    	 * Constructor
    	 */ 
    	/**ATONIS*/
    	public function VisuCanvasCommons () 
    	{
    		this.addEventListener(ToolTipEvent.TOOL_TIP_CREATE , createTagListToolTip );
     
    		this.addEventListener(ToolTipEvent.TOOL_TIP_SHOW , showToolTip)
     
    		this.toolTip = "image";
    		this.tagTip = new VisuCanvasCommonsTagListTooltip() ;
     
    	}
    	/**ATONIS*/
     
     
    	private function createTagListToolTip (AEvent : ToolTipEvent) : void
    	{
    		if (this.repAtom.name != null)
    		{ this.tagTip.title = this.repAtom.name.substr(0,25) ; }
    		else
    		{ this.tagTip.title = "empty" ; }
     
    		if (this.repAtom.prop_arr != null)
    		{ 
    			var tagProvider : ArrayCollection = new ArrayCollection;
    			for each (var property : Property in this.repAtom.prop_arr)
    			{ tagProvider.addItem( property.name) }
    			this.tagTip.tagListSource = tagProvider ;  
    		}
    		AEvent.toolTip = this.tagTip ;			
    	}
     
    	private function showToolTip (AEvent : ToolTipEvent) : void
    	{ }
    et mon toolTip :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
     
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Panel 
    	xmlns:mx="http://www.adobe.com/2006/mxml"
    	implements="mx.core.IToolTip"
    	borderThickness="1"
    	dropShadowEnabled="true"
    	horizontalAlign="center"
    	verticalAlign="middle"
    	roundedBottomCorners="true"
    	cornerRadius="10"
    	resizeEffect="{resizeEffect}"
    	width="100%"
    	height="100%"
    	maxWidth="200"
    	horizontalScrollPolicy="off"
    	verticalScrollPolicy="off">
    	<mx:Script>
    		<![CDATA[
    			import mx.collections.ArrayCollection;
    			import mx.binding.utils.BindingUtils;
    			import mx.core.IToolTip;
     
    			public var _text : String;
     
    			[Bindable]
    			public var tagListSource : ArrayCollection ;
     
     
    			[Bindable]
    			public function get text() : String
    			{ return _text ; }
     
    			public function set text(value : String) : void
    			{ _text = value }
     
    			public function init() : void
    			{}
    		]]>
    	</mx:Script>
    	<mx:Resize id="resizeEffect"
    		duration="50">		
    	</mx:Resize>
    	<mx:TileList
    		id="tagList"
    		dataProvider="{tagListSource}"
    		direction="vertical"
    		width="100%"
    		height="100%"
    		textAlign="left"
    		horizontalScrollPolicy="off"
    		verticalScrollPolicy="off">	
    	</mx:TileList>
    </mx:Panel>
    Voila.
    Sinon, essaie s'il te plaît d'être un peu un peu plus verbeux lorsque tu as un problème. D'un côté, le lecteur en sait un peu plus sur le pourquoi du comment du bug, et de l'autre il aura un peu plus envie de t'aider .

    Merci

Discussions similaires

  1. Création Custom fields
    Par glucas59 dans le forum SharePoint
    Réponses: 2
    Dernier message: 02/03/2009, 09h13
  2. Création de tooltips paramétrables sous flex
    Par hemgui dans le forum Flex
    Réponses: 2
    Dernier message: 03/10/2007, 10h24
  3. [JSF] Création de validateurs custom
    Par mymyma dans le forum JSF
    Réponses: 3
    Dernier message: 28/06/2006, 15h32
  4. Création d'une infobulle / tooltip
    Par Poutchou dans le forum Général JavaScript
    Réponses: 15
    Dernier message: 05/04/2006, 17h46
  5. [MFC] Création d'un 'custom control'
    Par r0d dans le forum MFC
    Réponses: 5
    Dernier message: 03/02/2006, 10h23

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo