-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.as
56 lines (47 loc) · 1.72 KB
/
Main.as
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package {
import flash.display.Sprite;
import flash.display.Loader;
import flash.display.StageScaleMode;
import flash.display.StageAlign;
import flash.display.Shape;
import flash.text.TextField;
import flash.net.URLRequest;
import flash.events.*;
import flash.external.*;
import flash.system.*;
public class Main extends Sprite {
Security.allowDomain('*');
public var queries:Object = root.loaderInfo.parameters;
public var link:URLRequest = new URLRequest(queries["link"]);
public var adUrl:URLRequest = new URLRequest(queries["src"]);
public var loader:Loader = new Loader();
public function Main() {
loader.load(adUrl);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loaded);
addChild(loader);
//var tf:TextField = new TextField();
//tf.text = 'skate';
//addChild(tf);
}
public function openLink (e:MouseEvent):void{
ExternalInterface.call('open', queries['link']);
}
public function loaded (e:Event):void{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.stageWidth = loader.contentLoaderInfo.width;
stage.stageHeight = loader.contentLoaderInfo.height;
var button:Sprite = new Sprite();
button.graphics.beginFill(0,0);
button.graphics.drawRect(0, 0, loader.contentLoaderInfo.width,loader.contentLoaderInfo.height); // (x spacing, y spacing, width, height)
button.graphics.endFill();
button.buttonMode = true;
button.mouseChildren = false;
button.addEventListener(MouseEvent.CLICK, openLink);
addChild(button);
//var flashVersion:String = loader.contentLoaderInfo.swfVersion;
var callback:String = this.queries['callback'];
ExternalInterface.call(callback,this.queries['value']);
}
}
}