Permalink
Browse files

InfoBubble-1.3.3

added getting text from path
  • Loading branch information...
mstandio committed Mar 17, 2013
1 parent 46b5c88 commit 663b5e3e679a606215576a1ef23fa0e012a97c2f
@@ -38,7 +38,7 @@ InfoBox.as = src/com/panozona/modules/infobox/InfoBox.as
InfoBox.swf = bin/modules/infobox/InfoBox-1.0.swf
InfoBubble.as = src/com/panozona/modules/infobubble/InfoBubble.as
-InfoBubble.swf = bin/modules/infobubble/InfoBubble-1.3.2.swf
+InfoBubble.swf = bin/modules/infobubble/InfoBubble-1.3.3.swf
JSGateway.as = src/com/panozona/modules/jsgateway/JSGateway.as
JSGateway.swf = bin/modules/jsgateway/JSGateway-1.3.2.swf
@@ -33,7 +33,7 @@ package com.panozona.modules.infobubble{
private var bubbleController:BubbleController;
public function InfoBubble(){
- super("InfoBubble", "1.3.2", "http://panozona.com/wiki/Module:InfoBubble");
+ super("InfoBubble", "1.3.3", "http://panozona.com/wiki/Module:InfoBubble");
moduleDescription.addFunctionDescription("show", String);
moduleDescription.addFunctionDescription("hide");
@@ -30,13 +30,17 @@ package com.panozona.modules.infobubble.controller {
import flash.display.Loader;
import flash.events.Event;
import flash.events.IOErrorEvent;
+ import flash.net.URLLoader;
+ import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
+ import flash.utils.ByteArray;
public class BubbleController {
private var _bubbleView:BubbleView;
private var _module:Module;
+ private var textLoader:URLLoader;
private var imageLoader:Loader;
private var ellipseAxisX:Number;
@@ -54,6 +58,11 @@ package com.panozona.modules.infobubble.controller {
imageLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, imageLost, false, 0, true);
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded, false, 0, true);
+ textLoader = new URLLoader();
+ textLoader.dataFormat = URLLoaderDataFormat.BINARY;
+ textLoader.addEventListener(IOErrorEvent.IO_ERROR, textLost);
+ textLoader.addEventListener(Event.COMPLETE, textLoaded);
+
_bubbleView.infoBubbleData.bubbleData.addEventListener(BubbleEvent.CHANGED_ENABLED, handleEnabledChange);
_bubbleView.infoBubbleData.bubbleData.addEventListener(BubbleEvent.CHANGED_CURRENT_ID, handleCurrentIdChange);
_bubbleView.infoBubbleData.bubbleData.addEventListener(BubbleEvent.CHANGED_IS_SHOWING, handleIsShowingChange);
@@ -75,7 +84,7 @@ package com.panozona.modules.infobubble.controller {
}
}
- private function handleCurrentIdChange(e:Event):void {
+ private function handleCurrentIdChange(e:Event = null):void {
while (_bubbleView.numChildren) _bubbleView.removeChildAt(0);
try{
imageLoader.unload();
@@ -88,8 +97,13 @@ package com.panozona.modules.infobubble.controller {
imageLoader.load(new URLRequest((bubble as Image).path));
return;
}else if (bubble is Text) {
- buildText(bubble as Text);
- return;
+ if ((bubble as Text).path != null) {
+ textLoader.load(new URLRequest((bubble as Text).path));
+ return;
+ }else {
+ buildText(bubble as Text);
+ return;
+ }
}
}
}
@@ -104,6 +118,22 @@ package com.panozona.modules.infobubble.controller {
addDisplayObject(imageLoader.content);
}
+ private function textLost(error:IOErrorEvent):void {
+ _module.printError(error.text);
+ }
+
+ private function textLoaded(e:Event):void {
+ var input:ByteArray = e.target.data;
+ try { input.uncompress(); } catch (error:Error) { };
+ for each (var bubble:Bubble in _bubbleView.infoBubbleData.bubbles.getChildrenOfGivenClass(Bubble)){
+ if (bubble.id == _bubbleView.infoBubbleData.bubbleData.currentId && bubble is Text) {
+ (bubble as Text).text = input.toString();
+ buildText(bubble as Text);
+ return;
+ }
+ }
+ }
+
private function buildText(text:Text):void {
if(text.style != null){
for each(var style:Style in _bubbleView.infoBubbleData.styles.getChildrenOfGivenClass(Style)){
@@ -21,6 +21,7 @@ package com.panozona.modules.infobubble.model.structure{
public class Text extends Bubble {
public var text:String = "";
+ public var path:String = null;
public var style:String = null;
}
}
@@ -34,7 +34,7 @@ package com.panozona.modules.menuscroller {
private var windowController:WindowController;
public function MenuScroller(){
- super("MenuScroller", "1.3.1", "http://panozona.com/wiki/Module:MenuScroller");
+ super("MenuScroller", "1.3.2", "http://panozona.com/wiki/Module:MenuScroller");
moduleDescription.addFunctionDescription("setOpen", Boolean);
moduleDescription.addFunctionDescription("toggleOpen");
moduleDescription.addFunctionDescription("setGroup", String);

0 comments on commit 663b5e3

Please sign in to comment.