-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathFrame.as
128 lines (112 loc) · 3.88 KB
/
Frame.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/* ,----,
* ,/ .`|
* ,---, .--.--. ,` .' :,-.----. ,---, ,---,
* ' .' \ / / '. ; ; /\ / \ ,`--.' | .' .' `\
* / ; '. | : /`. /.'___,/ ,' ; : \ | : :,---.' \
* : : \ ; | |--` | : | | | .\ : : | '| | .`\ |
* : | /\ \| : ;_ ; |.'; ; . : |: | | : |: : | ' |
* | : ' ;. :\ \ `.`----' | | | | \ : ' ' ;| ' ' ; :
* | | ;/ \ \`----. \ ' : ; | : . / | | |' | ; . |
* ' : | \ \ ,'__ \ \ | | | ' ; | | \ ' : ;| | : | '
* | | ' '--' / /`--' / ' : | | | ;\ \| | '' : | / ;
* | : : '--'. / ; |.' : ' | \.'' : || | '` ,/
* | | ,' `--'---' '---' : : :-' ; |.' ; : .'
* `--'' | |.' '---' | ,.' Tyler
* ActionScript tested rapid iterative dev `---' Copyright2010'---' Larson
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* http://www.gnu.org/licenses
*/
package framework.view.htmlwrapper
{
import flash.events.Event;
import framework.net.Asset;
/*
features
left=pixels The left position of the window
top=pixels The top position of the window
width=pixels The width of the window. Min. value is 100
height=pixels The height of the window. Min. value is 100
scrollbars=yes|no|1|0 Whether or not to display scroll bars. Default is yes
*/
public class Frame extends Element
{
private var _layers:Array = [];
private var _url:String;
private var _features:Object;
public function Frame( document:Document, url:String=null, name:String=null, features:Object=null )
{
super( document );
style.width = "100%";
style.height = "100%";
if( name ) this.name = "_layer"+name;
else this.name = "_layer";
if( url ) this.url = url;
_features = features;
document.window.addChild(this);
addLayer(0);
}
public function get url():String
{
return _url;
}
public function set url(value:String):void
{
if (value !== _url) {
_url = value;
var asset:Asset = document.assets.add( _url );
asset.addEventListener(Event.COMPLETE, onLocationChanged);
document.assets.load()
}
}
public function get features():Object
{
return _features;
}
public function get layers():Array
{
return _layers;
}
public function set layers( value:Array ):void
{
if (value !== _layers)
{
_layers = value;
}
}
public function getLayer( zIndex:uint ):Layer
{
var result:Layer
for each(var layer:Layer in layers){
if( layer.zIndex == zIndex ) {
result = layer;
break;
}
}
return result
}
public function addLayer( zIndex:uint ):Layer
{
var result:Layer = getLayer( zIndex );
if( !result )
result = new Layer( document, zIndex );
_layers.push( result );
addChild( result );
return result
}
private function onLocationChanged( event:Event ):void
{
// // Log.info("onLocationChanged", _url)
event.target.removeEventListener(Event.COMPLETE, onLocationChanged);
getLayer(0).innerHTML = document.window.navigator.controller.assets.fetch(_url);
}
}
}