Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > Flash/Flex > Flex
Flex Forum d'entraide sur la programmation Adobe Flex : applications Internet riches (RIA)
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 22/02/2011, 10h03   #1
Invité de passage
 
Inscription : février 2005
Messages : 29
Détails du profil
Informations forums :
Inscription : février 2005
Messages : 29
Points : 3
Points : 3
Par défaut Tooltip avec texte + image

Bonjour,

J'ai besoin de créer un tooltip contenant du texte et quelque part dans le texte une image. Je n'obtiens pas complètement ce que je souhaite : un tooltip vide se superpose à montexte +image.

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
xmlns:s="library://ns.adobe.com/flex/spark" 
xmlns:mx="library://ns.adobe.com/flex/mx" 
minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import com.monTooltip;         
import mx.events.ToolTipEvent;
private function onCreateToolTip(e:ToolTipEvent):void
{
   var tooltip:monTooltip = new monTooltip;
   e.toolTip = tooltip;
}
]]>
</fx:Script>
<s:TextArea
toolTip=" "
toolTipCreate="onCreateToolTip(event)" />
</s:Application>
Code :
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
 
package com
{
import mx.controls.ToolTip;
import flash.display.Sprite;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.elements.InlineGraphicElement;
import flashx.textLayout.elements.InlineGraphicElementStatus;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.events.StatusChangeEvent;
 
public class monTooltip extends ToolTip
{
private var _textFlow:TextFlow;
private var _inlineGraphic:InlineGraphicElement;
private var graphicHeight:Number;
public function monTooltip()
{
super();
_textFlow = new TextFlow();
_textFlow.fontSize = 12;
graphicHeight = 20
var p:ParagraphElement = new ParagraphElement();
_textFlow.addChild(p);
var span:SpanElement = new SpanElement();
span.text = "Text ";
p.addChild(span);
_inlineGraphic = new InlineGraphicElement();
_inlineGraphic.source = "pharma.png";
p.addChild(_inlineGraphic);
var span2:SpanElement = new SpanElement();
span2.text = " Flow";
p.addChild(span2);
_textFlow.addEventListener(StatusChangeEvent.INLINE_GRAPHIC_STATUS_CHANGE,
statusChangeHandler);
_textFlow.flowComposer.addController(new ContainerController(this,400,200));
_textFlow.flowComposer.updateAllControllers();
}
private function statusChangeHandler(e:StatusChangeEvent):void
{
// if the graphic has loaded update the display
// set the loaded graphic's height to match text height
if (e.status == InlineGraphicElementStatus.READY || e.status == 
InlineGraphicElementStatus.SIZE_PENDING)
{
_inlineGraphic.height = graphicHeight;
_textFlow.flowComposer.updateAllControllers();
}
}
}
}
Merci pour votre aide.
magoer est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 11h10.


 
 
 
 
Partenaires

Hébergement Web