Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-22-2012, 02:12 PM   #11
Mighty Flash Gordon
Member
 
Join Date: Apr 2012
Posts: 91
Default

Oh right sorry if I miss understood. I can see how your example works but dont know how to apply that to the tooltip, which isnt exactly what I was looking for but was just trying to make it dynamic.

I dont see your toolTipSystem anywhere??

Have you posted it and if not can you post it???

and how does your tooltip work?
Mighty Flash Gordon is offline   Reply With Quote
Old 05-22-2012, 06:04 PM   #12
arkitx
Senior Member
 
Join Date: Jan 2011
Posts: 703
Default

ActionScript Code:
/*  *************************************  * ToolTip  * [url]http://www.FlepStudio.org[/url]           * © Author: Filippo Lughi             * version 1.0                         *************************************  */ package org.FlepStudio {     import flash.display.*;     import flash.events.*;     import flash.text.*;     import caurina.transitions.Tweener;         public class ToolTip extends MovieClip     {         private var BG_COLOR:uint;         private var TOOL_TEXT:String;         private var CSS_STYLE:StyleSheet=new StyleSheet();                 private var field_txt:TextField;                 private var ratio:int=10;                 private var holder_mc:MovieClip;         private var bg_mc:MovieClip;         private var father:MovieClip;                 private var left_point:Number;         private var top_point:Number;         private var right_point:Number;         private var bottom_point:Number;                 public function ToolTip(bc:uint,tt:String,css:*)         {             BG_COLOR=bc;             TOOL_TEXT=tt;             CSS_STYLE.parseCSS(css);                         addEventListener(Event.ADDED_TO_STAGE,init);                         mouseEnabled=false;             alpha=0;         }                 private function init(evt:Event):void         {             removeEventListener(Event.ADDED_TO_STAGE,init);                         father=parent as MovieClip;                         left_point=0;             top_point=0;             right_point=stage.stageWidth;             bottom_point=stage.stageHeight;                         createHolder();             createTextField();             createBackground();             fixPosition();             fadeIn();             addEventListener(Event.ENTER_FRAME,addMovement);         }                 private function createHolder():void         {             holder_mc=new MovieClip();             addChild(holder_mc);         }                 private function createTextField():void         {                         field_txt=new TextField();             field_txt.multiline=true;             field_txt.selectable=false;             field_txt.styleSheet=CSS_STYLE;             field_txt.antiAliasType=AntiAliasType.ADVANCED;             field_txt.autoSize=TextFieldAutoSize.LEFT;             field_txt.htmlText=TOOL_TEXT+"  ";             field_txt.width=field_txt.textWidth+10;             field_txt.height=field_txt.textHeight+20;             holder_mc.addChild(field_txt);         }            private function createBackground():void         {             bg_mc=new MovieClip();             bg_mc.graphics.beginFill(BG_COLOR,1);             bg_mc.graphics.drawRoundRect(-ratio,-ratio,field_txt.width+ratio*2,field_txt.height+ratio*2,ratio,ratio);             holder_mc.addChild(bg_mc);                         holder_mc.swapChildren(field_txt,bg_mc);         }                 private function fixPosition():void         {             if(father.mouseX<stage.stageWidth/2)                 x=father.mouseX;             else                 x=father.mouseX-width;             if(father.mouseY<stage.stageHeight/2)                 y=father.mouseY+height-ratio*2;             else                 y=father.mouseY-height;         }                 private function fadeIn():void         {             Tweener.addTween(this,{alpha:1,time:1,transition:"regular"});         }                 private function addMovement(evt:Event):void         {             if(father.mouseX<stage.stageWidth/2)                 x=father.mouseX;             else                 x=father.mouseX-width+ratio*2;             if(father.mouseY<stage.stageHeight/2)                 y=father.mouseY+height-ratio*2;             else                 y=father.mouseY-height;                             if(x>stage.stageWidth-width)                 x=stage.stageWidth-width;             if(x<ratio*2)                 x=ratio*2;         }                 public function destroy():void         {             removeEventListener(Event.ENTER_FRAME,addMovement);             father.removeChild(this);         }     } }

ActionScript Code:
package {     import flash.display.Sprite;     import flash.net.URLLoader;     import flash.net.URLRequest;     import flash.events.Event;     import flash.events.EventDispatcher;     import flash.text.StyleSheet;     public class DATALoader extends Sprite {         public static  const XML_LOADED:String="xmlLoaded";         public static  const CSS_LOADED:String="cssLoaded";         public var content:XMLList;         public var sheet:*;         private var urlLoader:URLLoader;         public function DATALoader(url:String) {             urlLoader = new URLLoader();             urlLoader.load(new URLRequest(url));             urlLoader.addEventListener(Event.COMPLETE, xmlLoadedHandler);         }         private function xmlLoadedHandler(e:Event):void {             urlLoader.removeEventListener(Event.COMPLETE, xmlLoadedHandler);             content =XML(e.target.data).children();             dispatchEvent(new Event(DATALoader.XML_LOADED));             for (var i:int=0; i<content.length(); i++) {                 urlLoader = new URLLoader();                                urlLoader.addEventListener(Event.COMPLETE, cssLoadedHandler);                 urlLoader.load(new URLRequest(content[i].@css));             }         }         private function cssLoadedHandler(e:Event):void {             sheet=(e.target.data);             dispatchEvent(new Event(DATALoader.CSS_LOADED));         }     } }

ActionScript Code:
/*  *************************************  * ToolTip            * © Author: Filippo Lughi             * version 1.0                         *************************************  */ package {     import flash.display.*;     import flash.events.*;     import flash.text.*;     import org.FlepStudio.ToolTip;     public class Main extends MovieClip {         private var dataLoader:DATALoader;                 private var xmlList:XMLList;         private var tool_tip:ToolTip;         private var clips_array:Array;         private var css_array:Array=new Array();         public function Main() {             addEventListener(Event.ADDED_TO_STAGE,init);         }         private function init(evt:Event):void {             removeEventListener(Event.ADDED_TO_STAGE,init);             stage.frameRate=31;                         dataLoader=new DATALoader("toolTip.xml");             dataLoader.addEventListener(DATALoader.XML_LOADED,xmlLoaded);             dataLoader.addEventListener(DATALoader.CSS_LOADED,cssLoaded);         }                 private function xmlLoaded(evt:Event):void{             xmlList=(evt.target.content);             clips_array=new Array(clip_1_mc,clip_2_mc,clip_3_mc,clip_4_mc);             for (var i:int=0; i<clips_array.length; i++) {                 clips_array[i].mouseChildren=false;                 clips_array[i].buttonMode=true;                 clips_array[i].addEventListener(MouseEvent.MOUSE_OVER,onClipOver);                 clips_array[i].addEventListener(MouseEvent.MOUSE_OUT,onClipOut);             }         }         private function cssLoaded(evt:Event):void{             css_array.push(evt.target.sheet);         }         private function onClipOver(evt:MouseEvent):void {             var index=clips_array.indexOf(evt.target);             tool_tip=new ToolTip(uint(xmlList[index].@bg),xmlList[index],css_array[index]);             addChild(tool_tip);         }         private function onClipOut(evt:MouseEvent):void {             if (tool_tip!=null) {                 tool_tip.destroy();                 tool_tip=null;             }         }     } }

PHP Code:
<?xml version="1.0" encoding="UTF-8"?>
<tooltip>

     <tooltiptitle bg="0xcccccc" css="style/toolTipStyle01.css"><![CDATA[<h1>Lorem ipsum</h1> <span class='bluetext'>dolor sit amet, consectetuer.</span><br>Morbi a lorem quis sapien tincidunt adipiscing. Proin vel sapien.]]>
     </tooltiptitle>
         <tooltiptitle bg="0x616161" css="style/toolTipStyle02.css"><![CDATA[<span class='whitetext'><h1>Lorem ipsum</h1> dolor sit amet, consectetuer.<br>Morbi a lorem quis sapien tincidunt adipiscing. Proin vel sapien.</span>]]>
         </tooltiptitle>
         <tooltiptitle bg="0xFF0000" css="style/toolTipStyle01.css"><![CDATA[<p><span class='whitetext'>Lorem ipsum</span></p><span class='bluetext'> dolor sit amet, consectetuer.</span><br><span class='whitetext'>Morbi a lorem quis sapien tincidunt adipiscing. Proin vel sapien.</span>]]>
         </tooltiptitle>
         <tooltiptitle bg="0xFF0033" css="style/toolTipStyle01.css"><![CDATA[<h1>Lorem ipsum</h1> <span class='whitetext'><h1>dolor sit amet, consectetuer.</h1></span><br>Morbi a lorem quis sapien tincidunt adipiscing. Proin vel sapien.]]>
         </tooltiptitle>
    
</tooltip>
Code:
p {
    font-family: Times New Roman, Times, _serif;
    font-size: 24;
    font-Style: italic;
	margin-left: 10; 
   }
   h1 {
      font-family: Arial, Helvetica, _sans;
      font-size: 12;
      font-weight: bold;
   }
   .whitetext {
	color: #FFFFFF;
   }
   .bluetext {
      color: #0033CC;
   }
   .redtext {
      color: #CC0000;
   }
Code:
p {
      font-family: Times New Roman, Times, _serif;
      font-size: 14;
       font-Style: italic;
	    margin-left: 10;  
   }
   h1 {
      font-family: Arial, Helvetica, _sans;
      font-size: 20;
      font-weight: bold;
   }
   .whitetext {
	color: #FFFFFF;
   }
   .bluetext {
      color: #0033CC;
   }
   .redtext {
      color: #990033;
   }


__________________
Regards

arkitx

Last edited by arkitx; 05-22-2012 at 06:36 PM.
arkitx is offline   Reply With Quote
Old 05-24-2012, 10:08 AM   #13
arkitx
Senior Member
 
Join Date: Jan 2011
Posts: 703
Default

Are this worked for YOU?


__________________
Regards

arkitx
arkitx is offline   Reply With Quote
Old 05-24-2012, 11:01 AM   #14
Mighty Flash Gordon
Member
 
Join Date: Apr 2012
Posts: 91
Default

Hi arkitx,

Thank you I have been excited about your code and have been playing around with it a little so I can understand what you did and how you did it, also beeen trying to make the whole tooltip dynamic through xml file e.g.

make the tooltip through xml so it is more flexible outside the fla and class

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

<tooltip bg=("0xff0099","false") tooltip bgGradColor = ("0x000000","666666", "true") tooltip stroke = "true" tooltip shape = "roundedRect" tooltip arrow = "true">      </maketooltip>
I know this isnt written correctly its just an example so it is flexible enough to change the color, shape, stroke and arrow e.t.c.

But like usual I cant get it to work and I think it is way way past my ability and I think Im trying to run before I can walk.
Mighty Flash Gordon is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:51 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.