troubles with tooltips


hello,

 

i want show quite bit on info in tooltip trigger buttoms programmatically created , placed.

i stuck cannot work.

 

to create tooltip formatted want it, created component called nicetooltip. here code:

 

<?xml version="1.0" encoding="utf-8"?>

<s:panel xmlns:fx="http://ns.adobe.com/mxml/2009"

                     xmlns:s="library://ns.adobe.com/flex/spark"

                     xmlns:mx="library://ns.adobe.com/flex/mx"

                     width="200"

                     alpha=".8"

                     backgroundcolor="0xcccccc"

                     bordercolor="black"

                     title="" bordervisible="true" cornerradius="6" borderalpha="1.0"

                     color="#111"

                     fontfamily="verdana">

 

 

<fx:script>

                    <![cdata[

                              [bindable]

                              public var bodytext:string = "";

                              [bindable]

                              public var ddrspeed:string = "";

                              [bindable]

                              public var ddrtype:string = "";

 

                    ]]>

</fx:script>

<fx:declarations>

  <!-- place non-visual elements (e.g., services, value objects) here -->

</fx:declarations>

 

          <mx:text text="{bodytext}" percentwidth="100"/>

          <mx:text text="{ddrspeed}" percentwidth="100" x="0" y="23"/>

          <mx:text text="{ddrtype}" percentwidth="100" x="0" y="46"/>

 

</s:panel>

 

then, in application code pasted below, have 1 button standard tooltip. created instance of nicetooltip. question : how can trigger nicetooltip shown when hover on button.

 

many thanks

 

roestigraben

 

<?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" creationcomplete="application1_creationcompletehandler(event)">

 

<fx:style>

  @namespace s "library://ns.adobe.com/flex/spark";

  @namespace mx "library://ns.adobe.com/flex/mx";

 

  mx|tooltip{

  backgroundalpha: 1.0;

  backgroundcolor: black;

                    color: white;

  cornerradius: 2;

  fontsize: 24;

                    }

 

</fx:style>

 

<fx:script>

                    <![cdata[

                              import components.nicetooltip;

 

                              import mx.events.flexevent;

                              import mx.events.tooltipevent;

                              import spark.components.button;

 

 

                              protected function application1_creationcompletehandler(event:flexevent):void

                              {

                                        var c2:button = new button();

                                        c2.x = 200;

                                        c2.y = 350;

                                        c2.tooltip = "sdfsdf";

                                        this.contentgroup.addelement(c2);

 

 

                                        var xxx:nicetooltip =  new nicetooltip();

                                        xxx.title = "this title";

                                        xxx.bodytext = " body";

                                        xxx.ddrspeed = " 500mhz";

                                        xxx.ddrtype = " lpddr3";

                                        xxx.x = 300;

                                        xxx.y = 450;

                                        this.contentgroup.addelement(xxx);

 

                              }

                    ]]>

</fx:script>

 

 

</s:application>



More discussions in Using Flash Builder


adobe

Comments