Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

working internet

  • Loading branch information...
commit b4c255b03ae99aaa1508f6670d4e438b1ecc7aeb 1 parent 3107a07
@spotco authored
View
BIN  bin/NewProject.swf
Binary file not shown
View
25 src/FloatButtonLabel.as
@@ -1,6 +1,7 @@
package
{
import flash.display.Sprite;
+ import flash.events.MouseEvent;
import flash.geom.Rectangle;
import flash.text.AntiAliasType;
import flash.text.TextField;
@@ -11,10 +12,21 @@ package
var vy:Number = 0;
public var mouseover:Boolean = false;
public var text:TextField;
+ public var json_data:JsonEntry;
- public function FloatButtonLabel(text:String, priority:Number, info:Object = null) {
- this.text = make_text(text, priority);
+ public function FloatButtonLabel(j:JsonEntry) {
+ this.json_data = j;
+ this.text = make_text(j.rel+" "+j.arg2, 40);
+ this.text.textColor = 0x161616;
this.addChild(this.text);
+
+ this.addEventListener(MouseEvent.CLICK, function() {
+ //MouseWindow.create_tooltip(json_data.arg1 + " " + json_data.rel + " " + json_data.arg2, json_data.content,"");
+ MouseWindow.create_tooltip(json_data.title, json_data.content,"");
+ });
+ Common.add_mouse_over(this);
+ this.addEventListener(MouseEvent.MOUSE_OVER, function() { mouseover = true; } );
+ this.addEventListener(MouseEvent.MOUSE_OUT, function() { mouseover = false; } );
}
public function update_scale() {
@@ -25,6 +37,15 @@ package
}
public function update() {
+ if (this.mouseover) {
+ trace("mov");
+ this.scaleX = 1;
+ this.scaleY = 1;
+ this.alpha = 1.0;
+ this.parent.setChildIndex(this, parent.numChildren - 1);
+ return;
+ }
+ this.alpha = 0.85;
this.x += vx;
this.y += vy;
this.vx *= 0.2;
View
62 src/JsonEntry.as
@@ -0,0 +1,62 @@
+package {
+
+ public class JsonEntry {
+
+ public var arg1:String;
+ public var rel:String;
+ public var arg2:String;
+
+ public var title:String;
+ public var url:String
+ public var date:String;
+ public var content:String;
+
+ public var confidence:Number;
+
+ public function JsonEntry(o:Object) {
+ //var first = data[0];
+ //trace(first["arg1"]);
+ //trace(first["rel"]);
+ //trace(first["arg2"]);
+ //trace(first["confidence"]);
+ //
+ //var first_info = first["info"];
+ //trace(first_info["title"]);
+ //trace(first_info["content"]);
+
+ this.arg1 = o["arg1"];
+ this.rel = o["rel"];
+ this.arg2 = o["arg2"];
+ this.confidence = Number(o["confidence"]);
+
+ o = o["info"];
+ this.title = o["title"];
+ this.url = o["info"];
+ this.date = o["date"];
+ this.content = o["content"];
+
+ if (arg1 == null) {
+ arg1 = "";
+ trace("arg1 null");
+ }
+ if (rel == null) {
+ rel = "";
+ trace("rel null");
+ }
+ if (arg2 == null) {
+ arg2 = "";
+ trace("arg2 null");
+ }
+ if (title == null) {
+ title = "";
+ trace("title null");
+ }
+ if (content == null) {
+ title = "";
+ trace("title null");
+ }
+ }
+
+ }
+
+}
View
77 src/MouseWindow.as
@@ -0,0 +1,77 @@
+package
+{
+ import flash.events.MouseEvent;
+ import flash.events.TextEvent;
+ import flash.text.TextField;
+ import flash.ui.Mouse;
+ import flash.display.*;
+ public class MouseWindow extends Sprite {
+
+ public static var globalTooltip:MouseWindow;
+
+ public function MouseWindow() {
+ globalTooltip = this;
+ }
+
+ public static function create_tooltip(header:String, body:String, misc:String) {
+ while (globalTooltip.numChildren != 0) {
+ globalTooltip.removeChildAt(0);
+ }
+ globalTooltip.visible = true;
+ globalTooltip.addChild(create_textbox(header, body, misc));
+ }
+
+ private static function create_textbox(header:String, body:String, misc:String):Sprite {
+ var header_text:TextField = FloatButtonLabel.make_text(header, 30);
+ var body_text:TextField = FloatButtonLabel.make_text(body, 15);
+ var misc_text:TextField = FloatButtonLabel.make_text(misc, 15);
+
+ header_text.selectable = true;
+
+ body_text.width = Math.min(400, body_text.width);
+ body_text.height = 165;
+ body_text.wordWrap = true;
+ body_text.border = false;
+ body_text.selectable = true;
+
+ var bodysp:Sprite = new Sprite;
+ bodysp.graphics.beginFill(0xCFCFCF, 0.8);
+ bodysp.graphics.lineStyle(5, 0x555555);
+ //bodysp.graphics.drawRoundRect(0, 0, Math.max(body_text.textWidth,header_text.textWidth), body_text.textHeight + header_text.textHeight, 20);
+ header_text.x = 5;
+ header_text.y = 5;
+ bodysp.addChild(header_text);
+
+ body_text.x = 5;
+ body_text.y = header_text.y + header_text.textHeight;
+ bodysp.addChild(body_text);
+
+ bodysp.graphics.drawRoundRect(0, 0, Math.max(body_text.textWidth, header_text.textWidth) + 40, body_text.y + body_text.textHeight+5, 20);
+ bodysp.x = Common.WID - bodysp.width;
+ bodysp.y = Common.HEI - (body_text.y + body_text.textHeight + 10);
+
+ var closebutton:Sprite = new Sprite;
+ closebutton.addChild(new PinButton.CROIX_IMG as Bitmap);
+ closebutton.addEventListener(MouseEvent.CLICK, function() {
+ MouseWindow.globalTooltip.visible = false;
+ });
+ closebutton.width = 25;
+ closebutton.height = 25;
+ closebutton.x = bodysp.width - 34;
+ closebutton.y = 5;
+ Common.add_mouse_over(closebutton);
+ bodysp.addChild(closebutton);
+ bodysp.alpha = 0.8;
+ bodysp.addEventListener(MouseEvent.MOUSE_OVER, function() {
+ bodysp.alpha = 1;
+ });
+ bodysp.addEventListener(MouseEvent.MOUSE_OUT, function() {
+ bodysp.alpha = 0.8;
+ });
+ return bodysp;
+ }
+
+
+ }
+
+}
View
39 src/PinButton.as
@@ -27,7 +27,7 @@ package {
private var testdraw:Sprite = new Sprite;
private var kill:Number = -1;
- public function PinButton(text:String ) {
+ public function PinButton(v:Vector.<JsonEntry>) {
this.addChild(testdraw);
@@ -43,7 +43,8 @@ package {
this.scaleX = 0;
this.scaleY = 0;
- label_text_list = ["MSG1MSG1MSG1MSG1", "MSG2MSG2MSG2MSG2", "MSG3MSG3MSG3MSG3", "MSG4MSG4MSG4MSG4", "MSG3MSG3MSG3MSG3", "MSG4MSG4MSG4MSG4", "MSG3MSG3MSG3MSG3", "MSG4MSG4MSG4MSG4"];
+ //label_text_list = ["MSG1MSG1MSG1MSG1", "MSG2MSG2MSG2MSG2", "MSG3MSG3MSG3MSG3", "MSG4MSG4MSG4MSG4", "MSG3MSG3MSG3MSG3", "MSG4MSG4MSG4MSG4", "MSG3MSG3MSG3MSG3", "MSG4MSG4MSG4MSG4"];
+ label_text_list = v;
closebutton.addChild(new CROIX_IMG as Bitmap);
closebutton.x = -20;
@@ -57,30 +58,30 @@ package {
}
private var add_counter:Number = 0;
- private var label_text_list:Array;
+ private var label_text_list:Vector.<JsonEntry>;
private function add_text_label() {
- var fbl:FloatButtonLabel = new FloatButtonLabel(label_text_list.pop(), 60);
+ var fbl:FloatButtonLabel = new FloatButtonLabel(label_text_list.pop());
floatlabels.push(fbl);
this.addChild(fbl);
fbl.update_scale();
}
- private function make_text_cloud(sts:Array) {
- for (var i = sts.length-1; i >= 0; i--) {
- var fbl:FloatButtonLabel = new FloatButtonLabel(sts[i], 40);
- floatlabels.push(fbl);
- this.addChild(fbl);
-
- fbl.x = Math.random() * 200 - 100;
- fbl.y = Math.random() * 200 - 100;
-
- fbl.graphics.beginFill(0xFF0000);
- fbl.graphics.drawCircle( -fbl.x, -fbl.y, 5);
-
- fbl.update_scale();
- }
- }
+ //private function make_text_cloud(sts:Array) {
+ //for (var i = sts.length-1; i >= 0; i--) {
+ //var fbl:FloatButtonLabel = new FloatButtonLabel(sts[i], 40);
+ //floatlabels.push(fbl);
+ //this.addChild(fbl);
+ //
+ //fbl.x = Math.random() * 200 - 100;
+ //fbl.y = Math.random() * 200 - 100;
+ //
+ //fbl.graphics.beginFill(0xFF0000);
+ //fbl.graphics.drawCircle( -fbl.x, -fbl.y, 5);
+ //
+ //fbl.update_scale();
+ //}
+ //}
private function update_labels() {
//testdraw.graphics.clear();
View
59 src/PinMain.as
@@ -27,6 +27,7 @@ package {
animTimer.start();
falltext_strings = ["Falltext 1", "Falltext 2", "Falltext 3", "Falltext 4"];
+ this.addChild(new MouseWindow);
}
public function search(e:Event) {
@@ -38,25 +39,25 @@ package {
searchbar.field2.textfield.text = "";
searchbar.field3.textfield.text = "";
- make_button(s1 + " " + s2 + " " + s3);
+ //make_button(s1 + " " + s2 + " " + s3);
envoyer_requet(s1, s2, s3);
}
public function anim_update(e:Event) {
if (falltext_ct <= 0) {
if (falltext_strings.length > 0) {
- var s:FloatButtonLabel = new FloatButtonLabel(falltext_strings.pop(), Math.random()*40+30);
- s.text.textColor = 0xFFFFFF;
- this.addChild(s);
- falltext_labels.push(s);
- s.x = Math.random() * Common.WID;
- s.vy = Math.random() * 2 + 2;
- s.addEventListener(MouseEvent.MOUSE_OVER, function() {
- s.mouseover = true;
- });
- s.addEventListener(MouseEvent.MOUSE_OUT, function() {
- s.mouseover = false;
- });
+ //var s:FloatButtonLabel = new FloatButtonLabel(falltext_strings.pop(), Math.random()*40+30);
+ //s.text.textColor = 0xFFFFFF;
+ //this.addChild(s);
+ //falltext_labels.push(s);
+ //s.x = Math.random() * Common.WID;
+ //s.vy = Math.random() * 2 + 2;
+ //s.addEventListener(MouseEvent.MOUSE_OVER, function() {
+ //s.mouseover = true;
+ //});
+ //s.addEventListener(MouseEvent.MOUSE_OUT, function() {
+ //s.mouseover = false;
+ //});
}
falltext_ct = Math.random()*40+30;
@@ -87,30 +88,35 @@ package {
}
}
- public function make_button(text:String) {
- var nb:PinButton = new PinButton(text);
+ public function make_button(v:Vector.<JsonEntry>) {
+ var nb:PinButton = new PinButton(v);
buttons.push(nb);
this.addChild(nb);
}
public function envoyer_requet(s1:String, s2:String, s3:String) {
- var urlRequest:URLRequest = new URLRequest('http://spotcos.com/misc/yahoo/test.php');
- urlRequest.data = makeUrlVars();
+ var urlRequest:URLRequest = new URLRequest('http://spotcos.com/misc/yahoo/search_extract.php');
+ urlRequest.data = makeUrlVars(s1,s2,s3);
var urlLoader:URLLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE, idRecieved);
urlLoader.load(urlRequest);
configureErrors(urlLoader);
- trace("requete envoyé");
+ trace("requête envoyé");
}
public function idRecieved(e:Event) {
trace(e.target.data);
- //var data:Object = JSON.decode(e.target.data);
- //var i:int = 0;
- //while (data[i]) {
- //trace(data[i]);
- //i++;
- //}
+ var data:Object = JSON.decode(e.target.data);
+
+ //make_button(s1 + " " + s2 + " " + s3);
+ var v:Vector.<JsonEntry> = new Vector.<JsonEntry>();
+ var i:int = 0;
+ while (data[i]) {
+ var j:JsonEntry = new JsonEntry(data[i]);
+ v.push(j);
+ i++;
+ }
+ make_button(v);
}
private function configureErrors(dispatcher:IEventDispatcher) {
@@ -124,8 +130,11 @@ package {
trace("erreur reseau");
}
- public static function makeUrlVars():URLVariables {
+ public static function makeUrlVars(s1:String, s2:String, s3:String):URLVariables {
var v:URLVariables = new URLVariables;
+ v.arg1 = s1;
+ v.rel = s2;
+ v.arg2 = s3;
v.nocache = new Date().getTime();
return v;
}
View
1  src/PinSearchBar.as
@@ -58,7 +58,6 @@ package
this.addChild(l);
l = FloatButtonLabel.make_text("Fill in the _ _ _", 30);
-
l.textColor = 0xCFCFCF;
l.x = 15; l.y = 90;
this.addChild(l);
Please sign in to comment.
Something went wrong with that request. Please try again.