Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

InfoBubble-1.3.3

added getting text from path
  • Loading branch information...
commit 663b5e3e679a606215576a1ef23fa0e012a97c2f 1 parent 46b5c88
Marek Standio authored March 17, 2013
2  ant/config/compiled_files.txt
@@ -38,7 +38,7 @@ InfoBox.as  = src/com/panozona/modules/infobox/InfoBox.as
38 38
 InfoBox.swf = bin/modules/infobox/InfoBox-1.0.swf
39 39
 
40 40
 InfoBubble.as  = src/com/panozona/modules/infobubble/InfoBubble.as
41  
-InfoBubble.swf = bin/modules/infobubble/InfoBubble-1.3.2.swf
  41
+InfoBubble.swf = bin/modules/infobubble/InfoBubble-1.3.3.swf
42 42
 
43 43
 JSGateway.as  = src/com/panozona/modules/jsgateway/JSGateway.as
44 44
 JSGateway.swf = bin/modules/jsgateway/JSGateway-1.3.2.swf
2  src/com/panozona/modules/infobubble/InfoBubble.as
@@ -33,7 +33,7 @@ package com.panozona.modules.infobubble{
33 33
 		private var bubbleController:BubbleController;
34 34
 		
35 35
 		public function InfoBubble(){
36  
-			super("InfoBubble", "1.3.2", "http://panozona.com/wiki/Module:InfoBubble");
  36
+			super("InfoBubble", "1.3.3", "http://panozona.com/wiki/Module:InfoBubble");
37 37
 			
38 38
 			moduleDescription.addFunctionDescription("show", String);
39 39
 			moduleDescription.addFunctionDescription("hide");
36  src/com/panozona/modules/infobubble/controller/BubbleController.as
@@ -30,13 +30,17 @@ package com.panozona.modules.infobubble.controller {
30 30
 	import flash.display.Loader;
31 31
 	import flash.events.Event;
32 32
 	import flash.events.IOErrorEvent;
  33
+	import flash.net.URLLoader;
  34
+	import flash.net.URLLoaderDataFormat;
33 35
 	import flash.net.URLRequest;
  36
+	import flash.utils.ByteArray;
34 37
 	
35 38
 	public class BubbleController {
36 39
 		
37 40
 		private var _bubbleView:BubbleView;
38 41
 		private var _module:Module;
39 42
 		
  43
+		private var textLoader:URLLoader;
40 44
 		private var imageLoader:Loader;
41 45
 		
42 46
 		private var ellipseAxisX:Number;
@@ -54,6 +58,11 @@ package com.panozona.modules.infobubble.controller {
54 58
 			imageLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, imageLost, false, 0, true);
55 59
 			imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded, false, 0, true);
56 60
 			
  61
+			textLoader = new URLLoader();
  62
+			textLoader.dataFormat = URLLoaderDataFormat.BINARY;
  63
+			textLoader.addEventListener(IOErrorEvent.IO_ERROR, textLost);
  64
+			textLoader.addEventListener(Event.COMPLETE, textLoaded);
  65
+			
57 66
 			_bubbleView.infoBubbleData.bubbleData.addEventListener(BubbleEvent.CHANGED_ENABLED, handleEnabledChange);
58 67
 			_bubbleView.infoBubbleData.bubbleData.addEventListener(BubbleEvent.CHANGED_CURRENT_ID, handleCurrentIdChange);
59 68
 			_bubbleView.infoBubbleData.bubbleData.addEventListener(BubbleEvent.CHANGED_IS_SHOWING, handleIsShowingChange);
@@ -75,7 +84,7 @@ package com.panozona.modules.infobubble.controller {
75 84
 			}
76 85
 		}
77 86
 		
78  
-		private function handleCurrentIdChange(e:Event):void {
  87
+		private function handleCurrentIdChange(e:Event = null):void {
79 88
 			while (_bubbleView.numChildren) _bubbleView.removeChildAt(0);
80 89
 			try{
81 90
 				imageLoader.unload();
@@ -88,8 +97,13 @@ package com.panozona.modules.infobubble.controller {
88 97
 						imageLoader.load(new URLRequest((bubble as Image).path));
89 98
 						return;
90 99
 					}else if (bubble is Text) {
91  
-						buildText(bubble as Text);
92  
-						return;
  100
+						if ((bubble as Text).path != null) {
  101
+							textLoader.load(new URLRequest((bubble as Text).path));
  102
+							return;
  103
+						}else {
  104
+							buildText(bubble as Text);
  105
+							return;
  106
+						}
93 107
 					}
94 108
 				}
95 109
 			}
@@ -104,6 +118,22 @@ package com.panozona.modules.infobubble.controller {
104 118
 			addDisplayObject(imageLoader.content);
105 119
 		}
106 120
 		
  121
+		private function textLost(error:IOErrorEvent):void {
  122
+			_module.printError(error.text);
  123
+		}
  124
+		
  125
+		private function textLoaded(e:Event):void {
  126
+			var input:ByteArray = e.target.data;
  127
+			try { input.uncompress(); } catch (error:Error) { };
  128
+			for each (var bubble:Bubble in _bubbleView.infoBubbleData.bubbles.getChildrenOfGivenClass(Bubble)){
  129
+				if (bubble.id == _bubbleView.infoBubbleData.bubbleData.currentId && bubble is Text) {
  130
+					(bubble as Text).text = input.toString();
  131
+					buildText(bubble as Text);
  132
+					return;
  133
+				}
  134
+			}
  135
+		}
  136
+		
107 137
 		private function buildText(text:Text):void {
108 138
 			if(text.style != null){
109 139
 				for each(var style:Style in _bubbleView.infoBubbleData.styles.getChildrenOfGivenClass(Style)){
1  src/com/panozona/modules/infobubble/model/structure/Text.as
@@ -21,6 +21,7 @@ package com.panozona.modules.infobubble.model.structure{
21 21
 	public class Text extends Bubble {
22 22
 		
23 23
 		public var text:String = "";
  24
+		public var path:String = null;
24 25
 		public var style:String = null;
25 26
 	}
26 27
 }
2  src/com/panozona/modules/menuscroller/MenuScroller.as
@@ -34,7 +34,7 @@ package com.panozona.modules.menuscroller {
34 34
 		private var windowController:WindowController;
35 35
 		
36 36
 		public function MenuScroller(){
37  
-			super("MenuScroller", "1.3.1", "http://panozona.com/wiki/Module:MenuScroller");
  37
+			super("MenuScroller", "1.3.2", "http://panozona.com/wiki/Module:MenuScroller");
38 38
 			moduleDescription.addFunctionDescription("setOpen", Boolean);
39 39
 			moduleDescription.addFunctionDescription("toggleOpen");
40 40
 			moduleDescription.addFunctionDescription("setGroup", String);

0 notes on commit 663b5e3

Please sign in to comment.
Something went wrong with that request. Please try again.