2 * Copyright (C) 2007 Benjamin Otte <otte@gnome.org>
3 * 2007 Pekka Lampila <pekka.lampila@iki.fi>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301 USA
23 ASSetPropFlags
= ASnative
(1, 0);
24 ASSetNative
= ASnative
(4, 0);
25 ASSetNativeAccessor
= ASnative
(4, 1);
30 /* Only Flash extensions here, rest to swfdec_as_initialize.as */
32 Object.registerClass
= ASnative
(101, 8);
33 ASSetPropFlags
(Object, null, 7);
35 // so we can use it in this script
36 ASSetPropFlags
(Object, "addProperty", 0, 128);
40 function Error (msg
) {
41 if (typeof (msg
) != "undefined")
44 Error.prototype
.name
= Error.prototype
.message
= "Error";
45 Error.prototype
.toString
= function () {
49 /*** ASBROADCASTER ***/
51 function AsBroadcaster
() { };
53 AsBroadcaster
.broadcastMessage
= ASnative
(101, 12);
55 AsBroadcaster
.addListener
= function (x
) {
56 this.removeListener
(x
);
57 this._listeners
.push
(x
);
61 AsBroadcaster
.removeListener
= function (x
) {
62 var l
= this._listeners
;
65 for (var i
= 0; i
< l
.length
; i
++) {
74 AsBroadcaster
.initialize
= function (o
) {
75 o
.broadcastMessage
= ASnative
(101, 12);
76 o
.addListener
= AsBroadcaster
.addListener
;
77 o
.removeListener
= AsBroadcaster
.removeListener
;
79 ASSetPropFlags
(o
, "broadcastMessage,addListener,removeListener,_listeners", 131);
82 Key
= { ALT
: 18, BACKSPACE
: 8, CAPSLOCK
: 20, CONTROL
: 17, DELETEKEY
: 46,
83 DOWN
: 40, END
: 35, ENTER
: 13, ESCAPE
: 27, HOME
: 36, INSERT
: 45, LEFT
: 37,
84 PGDN
: 34, PGUP
: 33, RIGHT
: 39, SHIFT
: 16, SPACE
: 32, TAB
: 9, UP
: 38 };
85 ASSetNative
(Key
, 800, "getAscii,getCode,isDown,isToggled,isAccessible");
86 AsBroadcaster
.initialize
(Key
);
87 ASSetPropFlags
(Key
, null, 7);
92 Mouse.show
= ASnative
(5, 0);
93 Mouse.hide
= ASnative
(5, 1);
94 AsBroadcaster
.initialize
(Mouse);
95 ASSetPropFlags
(Mouse, null, 7);
100 AsBroadcaster
.initialize
(Stage);
101 ASSetNativeAccessor
(Stage, 666, "scaleMode,align,width,height,showMenu,displayState", 1);
103 /*** NetConnection ***/
105 // FIXME: this should actually be a non-native function that calls the ASnative
107 NetConnection = ASconstructor
(2100, 200);
109 ASSetNative
(NetConnection.prototype
, 2100, "6connect,6close,6call,6addHeader");
110 NetConnection.prototype
.addProperty
("connectedProxyType", ASnative
(2100, 4), null);
111 NetConnection.prototype
.proxyType
= "none";
112 NetConnection.prototype
.addProperty
("usingTLS", ASnative
(2100, 5), null);
113 ASSetPropFlags
(NetConnection.prototype
, null, 3);
117 NetStream.prototype
.publish
= function () {
118 var o
= {}; o
["Implement NetStream.publish"] ();
121 NetStream.prototype
.receiveAudio
= function (flag
) {
122 var o
= {}; o
["Implement NetStream.receiveAudio"] ();
125 NetStream.prototype
.receiveVideo
= function (flag
) {
126 var o
= {}; o
["Implement NetStream.receiveVideo"] ();
129 ASSetNative
(NetStream.prototype
, 2101, "6close,6attachAudio,6attachVideo,6send,6setBufferTime");
130 ASSetPropFlags
(NetStream.prototype
, null, 3);
134 function LoadVars
() { };
136 LoadVars
.prototype
.contentType
= "application/x-www-form-urlencoded";
138 LoadVars
.prototype
.load
= ASnative
(301, 0);
139 LoadVars
.prototype
.send
= ASnative
(301, 1);
140 LoadVars
.prototype
.sendAndLoad
= ASnative
(301, 2);
141 LoadVars
.prototype
.decode
= ASnative
(301, 3);
143 LoadVars
.prototype
.onLoad
= function () {
146 LoadVars
.prototype
.onData
= function (src
) {
156 LoadVars
.prototype
.toString
= function () {
158 for (var x
in this) {
160 str
= escape
(x
) + "=" + escape
(this[x
]);
162 str
+= "&" + escape
(x
) + "=" + escape
(this[x
]);
168 LoadVars
.prototype
.getBytesLoaded
= function () {
169 return this._bytesLoaded
;
172 LoadVars
.prototype
.getBytesTotal
= function () {
173 return this._bytesTotal
;
176 LoadVars
.prototype
.addRequestHeader
= function () {
178 var o
= {}; o
["Implement LoadVars.addRequestHeader"] ();
181 ASSetPropFlags
(LoadVars
.prototype
, null, 131);
185 Sound = ASconstructor
(500, 16);
186 ASSetNative
(Sound.prototype
, 500, "getPan,getTransform,getVolume,setPan,setTransform,setVolume,stop,attachSound,start,6getDuration,6setDuration,6getPosition,6setPosition,6loadSound,6getBytesLoaded,6getBytesTotal,9areSoundsInaccessible");
187 ASSetNativeAccessor
(Sound.prototype
, 500, "checkPolicyFile", 18);
188 ASSetPropFlags
(Sound.prototype
, null, 7);
192 XMLNode = ASconstructor
(253, 0);
194 XMLNode.prototype
.cloneNode
= ASnative
(253, 1);
195 XMLNode.prototype
.removeNode
= ASnative
(253, 2);
196 XMLNode.prototype
.insertBefore
= ASnative
(253, 3);
197 XMLNode.prototype
.appendChild
= ASnative
(253, 4);
198 XMLNode.prototype
.hasChildNodes
= ASnative
(253, 5);
199 XMLNode.prototype
.toString
= ASnative
(253, 6);
200 XMLNode.prototype
.getNamespaceForPrefix
= ASnative
(253, 7);
201 XMLNode.prototype
.getPrefixForNamespace
= ASnative
(253, 8);
205 XML = ASconstructor
(253, 9);
207 XML.prototype
= new XMLNode (1, "");
208 delete XML.prototype
.constructor
;
209 ASSetPropFlags
(XML, "prototype", 3);
211 XML.prototype
.load
= ASnative
(301, 0);
212 XML.prototype
.send
= ASnative
(301, 1);
213 XML.prototype
.sendAndLoad
= ASnative
(301, 2);
214 XML.prototype
.createElement
= ASnative
(253, 10);
215 XML.prototype
.createTextNode
= ASnative
(253, 11);
216 XML.prototype
.parseXML
= ASnative
(253, 12);
218 XML.prototype
.onLoad
= function () {
221 // Note: handling of loaded is different here than in LoadVars
222 XML.prototype
.onData
= function (src
) {
233 XML.prototype
.getBytesLoaded
= function () {
234 return this._bytesLoaded
;
237 XML.prototype
.getBytesTotal
= function () {
238 return this._bytesTotal
;
241 XML.prototype
.addRequestHeader
= function () {
243 var o
= {}; o
["Implement XML.addRequestHeader"] ();
250 System.capabilities
= {};
251 System.capabilities
.Query
= ASnative
(11, 0);
252 System.capabilities
.Query
();
253 delete System.capabilities
.Query
;
255 System.setClipboard
= ASnative
(1066, 0);
256 System.showSettings
= ASnative
(2107, 0);
257 ASSetNativeAccessor
(System, 2107, "exactSettings,useCodepage", 1);
258 ASSetPropFlags
(System, "exactSettings,useCodePage", 128);
260 /*** System.security */
262 System.security
= new Object();
263 delete System.security
.constructor
;
264 ASSetNative
(System.security
, 12, "allowDomain,7allowInsecureDomain,loadPolicyFile,chooseLocalSwfPath,escapeDomain");
265 ASSetNativeAccessor
(System.security
, 12, "sandboxType", 5);
267 /*** System.Product ***/
269 System.Product
= function () {
270 var o
= {}; o
["Implement System.Product"] ();
273 System.Product
.prototype
.isRunning
= function () {
274 var o
= {}; o
["Implement System.Product.isRunning"] ();
277 System.Product
.prototype
.isInstalled
= function () {
278 var o
= {}; o
["Implement System.Product.isInstalled"] ();
281 System.Product
.prototype
.launch
= function () {
282 var o
= {}; o
["Implement System.Product.launch"] ();
285 System.Product
.prototype
.download
= function () {
286 var o
= {}; o
["Implement System.Product.download"] ();
289 System.Product
.prototype
.installedVersion
= function () {
290 var o
= {}; o
["Implement System.Product.installedVersion"] ();
293 ASSetPropFlags
(System.Product
.prototype
, null, 3);
298 ALPHANUMERIC_FULL
: "ALPHANUMERIC_FULL",
299 ALPHANUMERIC_HALF
: "ALPHANUMERIC_HALF",
301 JAPANESE_HIRAGANA
: "JAPANESE_HIRAGANA",
302 JAPANESE_KATAKANA_FULL
: "JAPANESE_KATAKANA_FULL",
303 JAPANESE_KATAKANA_HALF
: "JAPANESE_KATAKANA_HALF",
308 AsBroadcaster
.initialize
(System.IME);
310 ASSetNative
(System.IME, 13, "8getEnabled,8setEnabled,8getConversionMode,8setConversionMode,8setCompositionString,8doConversion");
311 ASSetPropFlags
(System.IME, null, 7);
315 Color = function (target
) {
316 this.target
= target
;
317 ASSetPropFlags
(this, null, 7);
319 ASSetNative
(Color.prototype
, 700, "setRGB,setTransform,getRGB,getTransform");
320 ASSetPropFlags
(Color.prototype
, null, 7);
324 TextSnapshot = ASconstructor
(1067, 0);
325 ASSetNative
(TextSnapshot.prototype
, 1067, "6getCount,6setSelected,6getSelected,6getText,6getSelectedText,6hitTestTextNearPos,6findText,6setSelectColor,6getTextRunInfo", 1);
329 MovieClip.prototype
.useHandCursor
= true;
330 MovieClip.prototype
.enabled
= true;
332 MovieClip.prototype
.meth
= function (method
) {
333 var lower
= method
.toLowerCase
();
334 if (lower
== "post") {
336 } else if (lower
== "get") {
343 MovieClip.prototype
.getURL
= function (url
, target
, method
) {
344 if (typeof (target
) == "undefined")
345 target
= ""; // undefined to empty string, even in version >= 7
347 var type
= this.meth
(method
);
349 getURL
(url
, target
);
350 } else if (type
== 1) {
351 getURL
(url
, target
, "GET");
353 getURL
(url
, target
, "POST");
357 // work around ming bug, causing loadVariables to be lower cased
358 MovieClip.prototype
["loadVariables"] = function (url
, method
) {
359 var type
= this.meth
(method
);
362 loadVariables
(url
, this._target
);
363 } else if (type
== 1) {
364 loadVariables
(url
, this._target
, "GET");
366 loadVariables
(url
, this._target
, "POST");
371 // work around ming bug, causing loadMovie to be lower cased
372 MovieClip.prototype
["loadMovie"] = function (url
, method
) {
373 var type
= this.meth
(method
);
376 loadMovie
(url
, this._target
);
377 } else if (type
== 1) {
378 loadMovie
(url
, this._target
, "GET");
380 loadMovie
(url
, this._target
, "POST");
385 MovieClip.prototype
.unloadMovie
= function () {
387 loadMovie
("", this._target
);
391 MovieClip.prototype
.getTextSnapshot
= function () {
392 return new TextSnapshot(this);
394 ASSetPropFlags
(MovieClip.prototype
, "getTextSnapshot", 128);
397 ASSetNative
(MovieClip.prototype
, 900, "attachMovie,swapDepths,localToGlobal,globalToLocal,hitTest,getBounds,getBytesTotal,getBytesLoaded,6attachAudio,6attachVideo,6getDepth,6setMask,play,stop,nextFrame,prevFrame,gotoAndPlay,gotoAndStop,duplicateMovieClip,removeMovieClip,startDrag,stopDrag,7getNextHighestDepth,7getInstanceAtDepth,getSWFVersion,8attachBitmap,8getRect");
398 ASSetNativeAccessor
(MovieClip.prototype
, 900, "tabIndex", 200);
399 ASSetNativeAccessor
(MovieClip.prototype
, 900, "_lockroot", 300);
400 ASSetNativeAccessor
(MovieClip.prototype
, 900, "8cacheAsBitmap,8opaqueBackground,8scrollRect", 401);
401 ASSetNativeAccessor
(MovieClip.prototype
, 900, "8filters,8transform", 417);
402 ASSetNativeAccessor
(MovieClip.prototype
, 900, "8blendMode", 500);
404 ASSetNative
(MovieClip.prototype
, 901, "6createEmptyMovieClip,6beginFill,6beginGradientFill,6moveTo,6lineTo,6curveTo,6lineStyle,6endFill,6clear,8lineGradientStyle,8beginMeshFill,8beginBitmapFill");
405 ASSetNativeAccessor
(MovieClip.prototype
, 901, "8scale9Grid", 12);
407 MovieClip.prototype
.createTextField
= ASnative
(104, 200);
409 ASSetPropFlags
(MovieClip.prototype
, null, 3);
411 /* MovieClipLoader */
413 MovieClipLoader
= ASconstructor
(112, 0);
414 ASSetNative
(MovieClipLoader
.prototype
, 112, "7loadClip,7getProgress,7unloadClip", 100);
415 AsBroadcaster
.initialize
(MovieClipLoader
.prototype
);
416 ASSetPropFlags
(MovieClipLoader
.prototype
, null, 1027);
420 TextField = ASconstructor
(104, 0);
421 TextField.getFontList
= ASnative
(104, 201);
423 ASSetNative
(TextField.prototype
, 104, "6replaceSel,6getTextFormat,6setTextFormat,6removeTextField,6getNewTextFormat,6setNewTextFormat,6getDepth,7replaceText", 100);
424 AsBroadcaster
.initialize
(TextField.prototype
);
426 ASSetPropFlags
(TextField.prototype
, null, 131);
428 ASSetNativeAccessor
(TextField.prototype
, 104, "8gridFitType,8antiAliasType,8thickness,8sharpness,8filters", 300);
429 // FIXME: this should be done inside the TextField constructor
430 ASSetNativeAccessor
(TextField.prototype
, 900, "8tabIndex", 200);
432 ASSetPropFlags
(TextField, null, 131);
436 TextFormat = ASconstructor
(110, 0);
438 /* TextField.Stylesheet */
440 TextField.StyleSheet = ASconstructor
(113, 0);
442 TextField.StyleSheet.prototype
._copy
= function (o
) {
443 if (typeof (o
) != "object")
447 for (var prop
in o
) {
448 o_new
[prop
] = o
[prop
];
453 TextField.StyleSheet.prototype
.clear
= function () {
459 TextField.StyleSheet.prototype
.getStyle
= function (name
) {
460 return (this._copy
(this._css
[name
]));
463 TextField.StyleSheet.prototype
.setStyle
= function (name
, style
) {
467 this._css
[name
] = this._copy
(style
);
468 this.doTransform
(name
);
472 TextField.StyleSheet.prototype
.getStyleNames
= function () {
473 var tmp
= this._css
; /* ming bug? */
475 for (var prop
in tmp
) {
481 TextField.StyleSheet.prototype
.doTransform
= function (name
) {
485 this._styles
[name
] = this.transform
(this._css
[name
]);
488 TextField.StyleSheet.prototype
.transform
= function (style
) {
492 var format
= new TextFormat ();
495 format
.align
= style
.textAlign
;
497 if (style
.fontWeight
== "bold") {
499 } else if (style
.fontWeight
== "normal") {
504 var tmp
= this.parseColor
(style
.color
);
509 format
.display
= style
.display
;
511 if (style
.fontFamily
)
512 format
.font
= this.parseCSSFontFamily
(style
.fontFamily
);
514 if (style
.textIndent
)
515 format
.indent
= parseInt
(style
.textIndent
);
517 if (style
.fontStyle
== "italic") {
518 format
.italic
= true;
519 } else if (style
.fontStyle
== "normal") {
520 format
.italic
= false;
523 if (style
.kerning
== "true") {
524 format
.kerning
= true;
525 } else if (style
.kerning
== "false") {
526 format
.kerning
= false;
528 format
.kerning
= parseInt
(style
.kerning
);
532 format
.leading
= parseInt
(style
.leading
);
534 if (style
.marginLeft
)
535 format
.leftMargin
= parseInt
(style
.marginLeft
);
537 if (style
.letterSpacing
)
538 format
.letterSpacing
= parseInt
(style
.letterSpacing
);
540 if (style
.marginRight
)
541 format
.rightMargin
= parseInt
(style
.marginRight
);
543 if (style
.fontSize
) {
544 var tmp
= parseInt
(style
.fontSize
);
549 if (style
.textDecoration
== "underline") {
550 format
.underline
= true;
551 } else if (style
.textDecoration
== "none") {
552 format
.underline
= false;
558 TextField.StyleSheet.prototype
.parseCSS
= function (css
) {
559 var result
= this.parseCSSInternal
(css
);
560 if (typeof (result
) == "null")
566 for (var prop
in result
) {
567 this._css
[prop
] = this._copy
(result
[prop
]);
568 this.doTransform
(prop
);
575 TextField.StyleSheet.prototype
.parse
= TextField.StyleSheet.prototype
.parseCSS
;
577 TextField.StyleSheet.prototype
.load
= ASnative
(301, 0);
579 TextField.StyleSheet.prototype
.onLoad
= function () {
582 TextField.StyleSheet.prototype
.onData
= function (src
) {
584 var result
= this.parse
(src
);
585 this.loaded
= result
;
586 this.onLoad
(result
);
592 ASSetNative
(TextField.StyleSheet.prototype
, 113, "7update,7parseCSSInternal,7parseCSSFontFamily,7parseColor", 100);
593 ASSetPropFlags
(TextField.StyleSheet.prototype
, null, 1027);
594 ASSetPropFlags
(TextField, "StyleSheet", 1027);
599 ASSetNative
(Accessibility, 1999, "6isActive,6sendEvent,6updateProperties");
600 ASSetPropFlags
(Accessibility, null, 6);
607 Camera.get = function (index
) {
608 var get_func
= ASnative
(2102, 200);
609 return get_func
(index
);
611 Camera.addProperty
("names", ASnative
(2102, 201), null);
612 ASSetNative
(Camera.prototype
, 2102, "6setMode,6setQuality,6setKeyFrameInterval,6setMotionLevel,6setLoopback,6setCursor");
613 ASSetPropFlags
(Camera.prototype
, null, 3);
617 function ContextMenu (callback
) {
618 this.onSelect
= callback
;
619 this.customItems
= new Array ();
620 this.builtInItems
= {
632 ContextMenu.prototype
.copy
= function () {
633 var o
= new ContextMenu ();
635 o
.onSelect
= this.onSelect
;
637 o
.customItems
= new Array ();
638 for (var i
= 0; i
< this.customItems
.length
; i
++) {
639 o
.customItems
.push
(this.customItems
[i
].copy
());
642 o
.builtInItems
= this.builtInItems
;
647 ContextMenu.prototype
.hideBuiltInItems
= function () {
648 this.builtInItems
= {
660 ASSetPropFlags
(ContextMenu.prototype
, null, 1027);
662 /* ContextMenuItem */
664 function ContextMenuItem (caption
, callback
, separatorBefore
, enabled
, visible
)
666 this.caption
= caption
;
667 this.onSelect
= callback
;
668 if (separatorBefore
== undefined) {
669 this.separatorBefore
= false;
671 this.separatorBefore
= separatorBefore
;
673 if (enabled
== undefined) {
676 this.enabled
= enabled
;
678 if (visible
== undefined) {
681 this.visible
= visible
;
685 ContextMenuItem.prototype
.copy
= function () {
686 var o
= new ContextMenuItem ();
688 o
.caption
= this.caption
;
689 o
.onSelect
= this.onSelect
;
690 o
.separatorBefore
= this.separatorBefore
;
691 o
.enabled
= this.enabled
;
692 o
.visible
= this.visible
;
697 ASSetPropFlags
(ContextMenuItem.prototype
, null, 1027);
702 flash
.net
.FileReference = function () {
703 var c
= ASnative
(2204, 200);
705 this._listeners
= [];
708 AsBroadcaster
.initialize
(flash
.net
.FileReference.prototype
);
709 ASSetNative
(flash
.net
.FileReference.prototype
, 2204, "8browse,8upload,8download,8cancel");
710 ASSetPropFlags
(flash
.net
.FileReference.prototype
, null, 3);
712 /* FileReferenceList */
714 flash
.net
.FileReferenceList = function () {
715 this.fileList
= new Array();
716 this._listeners
= [];
719 AsBroadcaster
.initialize
(flash
.net
.FileReferenceList.prototype
);
720 ASSetNative
(flash
.net
.FileReferenceList.prototype
, 2205, "8browse");
721 ASSetPropFlags
(flash
.net
.FileReferenceList.prototype
, null, 3);
723 /* LocalConnection */
725 function LocalConnection () {
728 ASSetNative
(LocalConnection.prototype
, 2200, "6connect,6send,6close,6domain");
729 ASSetPropFlags
(LocalConnection.prototype
, null, 3);
733 function Microphone () {
736 Microphone.get = function (index
) {
737 var get_func
= ASnative
(2104, 200);
738 return get_func
(index
);
740 Microphone.addProperty
("names", ASnative
(2104, 201), null);
741 ASSetNative
(Microphone.prototype
, 2104, "6setSilenceLevel,6setRate,6setGain,6setUseEchoSuppression");
742 ASSetPropFlags
(Microphone.prototype
, null, 3);
746 PrintJob = ASconstructor
(111, 0);
747 ASSetNative
(PrintJob.prototype
, 111, "7start,7addPage,7send", 100);
748 ASSetPropFlags
(PrintJob.prototype
, null, 1027);
753 ASSetNative
(Selection
, 600, "getBeginIndex,getEndIndex,getCaretIndex,getFocus,setFocus,setSelection");
754 AsBroadcaster
.initialize
(Selection
);
755 ASSetPropFlags
(Selection
, null, 7);
760 flash
.text
.TextRenderer = ASconstructor
(2150, 0);
762 ASSetNative
(flash
.text
.TextRenderer, 2150, "8setAdvancedAntialiasingTable", 1);
763 ASSetNativeAccessor
(flash
.text
.TextRenderer, 2150, "8maxLevel", 4);
764 ASSetNativeAccessor
(flash
.text
.TextRenderer, 2150, "8displayMode", 10);
766 textRenderer
= flash
.text
.TextRenderer; // awesome
770 function XMLSocket () {
773 XMLSocket.prototype
.onData
= function (src
) {
774 this.onXML
(new XML (src
));
777 ASSetNative
(XMLSocket.prototype
, 400, "connect,send,close");
778 ASSetPropFlags
(XMLSocket.prototype
, null, 3);
784 flash
.geom
.Point = function () {
785 if (arguments.length
== 0) {
789 // Note: we don't check for length == 1
790 this.x
= arguments[0];
791 this.y
= arguments[1];
795 flash
.geom
.Point.distance
= function (a
, b
) {
796 return a
.subtract
(b
).length
;
799 flash
.geom
.Point.interpolate
= function (a
, b
, value
) {
800 return new flash
.geom
.Point (b
.x
+ value
* (a
.x
- b
.x
),
801 b
.y
+ value
* (a
.y
- b
.y
));
804 flash
.geom
.Point.polar
= function (length
, angle
) {
805 return new flash
.geom
.Point (length
* Math.cos
(angle
),
806 length
* Math.sin
(angle
));
809 flash
.geom
.Point.prototype
.addProperty
("length",
810 function () { return Math.sqrt
(this.x
* this.x
+ this.y
* this.y
); },
813 flash
.geom
.Point.prototype
.add
= function (other
) {
814 return new flash
.geom
.Point (this.x
+ other
.x
, this.y
+ other
.y
);
817 flash
.geom
.Point.prototype
.clone
= function () {
818 return new flash
.geom
.Point (this.x
, this.y
);
821 flash
.geom
.Point.prototype
.equals
= function (other
) {
822 if (!other instanceOf flash
.geom
.Point)
825 return (other
.x
== this.x
&& other
.y
== this.y
);
828 flash
.geom
.Point.prototype
.normalize
= function (length
) {
829 if (this.length
<= 0)
832 var factor
= length
/ this.length
;
833 this.x
= this.x
* factor
;
834 this.y
= this.y
* factor
;
837 flash
.geom
.Point.prototype
.subtract
= function (other
) {
838 return new flash
.geom
.Point (this.x
- other
.x
, this.y
- other
.y
);
841 flash
.geom
.Point.prototype
.offset
= function (x
, y
) {
846 flash
.geom
.Point.prototype
.toString
= function () {
847 return "(x=" + this.x
+ ", y=" + this.y
+ ")";
852 flash
.geom
.Rectangle = function () {
853 var o
= {}; o
["Implement Rectangle"] ();
856 flash
.geom
.Rectangle.prototype
.clone
= function () {
857 var o
= {}; o
["Implement Rectangle.clone"] ();
860 flash
.geom
.Rectangle.prototype
.setEmpty
= function () {
861 var o
= {}; o
["Implement Rectangle.setEmpty"] ();
864 flash
.geom
.Rectangle.prototype
.isEmpty
= function () {
865 var o
= {}; o
["Implement Rectangle.isEmpty"] ();
868 flash
.geom
.Rectangle.prototype
.addProperty
("left",
869 function () { var o
= {}; o
["Implement Rectangle.left (get)"] (); },
870 function () { var o
= {}; o
["Implement Rectangle.left (set)"] (); });
872 flash
.geom
.Rectangle.prototype
.addProperty
("right",
873 function () { var o
= {}; o
["Implement Rectangle.right (get)"] (); },
874 function () { var o
= {}; o
["Implement Rectangle.right (set)"] (); });
876 flash
.geom
.Rectangle.prototype
.addProperty
("top",
877 function () { var o
= {}; o
["Implement Rectangle.top (get)"] (); },
878 function () { var o
= {}; o
["Implement Rectangle.top (set)"] (); });
880 flash
.geom
.Rectangle.prototype
.addProperty
("bottom",
881 function () { var o
= {}; o
["Implement Rectangle.bottom (get)"] (); },
882 function () { var o
= {}; o
["Implement Rectangle.bottom (set)"] (); });
884 flash
.geom
.Rectangle.prototype
.addProperty
("topLeft",
885 function () { var o
= {}; o
["Implement Rectangle.topLeft (get)"] (); },
886 function () { var o
= {}; o
["Implement Rectangle.topLeft (set)"] (); });
888 flash
.geom
.Rectangle.prototype
.addProperty
("bottomRight",
889 function () { var o
= {}; o
["Implement Rectangle.bottomRight (get)"] (); },
890 function () { var o
= {}; o
["Implement Rectangle.bottomRight (set)"] (); });
892 flash
.geom
.Rectangle.prototype
.addProperty
("size",
893 function () { var o
= {}; o
["Implement Rectangle.size (get)"] (); },
894 function () { var o
= {}; o
["Implement Rectangle.size (set)"] (); });
896 flash
.geom
.Rectangle.prototype
.inflate
= function () {
897 var o
= {}; o
["Implement Rectangle.inflate"] ();
900 flash
.geom
.Rectangle.prototype
.inflatePoint
= function () {
901 var o
= {}; o
["Implement Rectangle.inflatePoint"] ();
904 flash
.geom
.Rectangle.prototype
.offset
= function () {
905 var o
= {}; o
["Implement Rectangle.offset"] ();
908 flash
.geom
.Rectangle.prototype
.offsetPoint
= function () {
909 var o
= {}; o
["Implement Rectangle.offsetPoint"] ();
912 flash
.geom
.Rectangle.prototype
.contains
= function () {
913 var o
= {}; o
["Implement Rectangle.contains"] ();
916 flash
.geom
.Rectangle.prototype
.containsPoint
= function () {
917 var o
= {}; o
["Implement Rectangle.containsPoint"] ();
920 flash
.geom
.Rectangle.prototype
.containsRectangle
= function () {
921 var o
= {}; o
["Implement Rectangle.containsRectangle"] ();
924 flash
.geom
.Rectangle.prototype
.intersection
= function () {
925 var o
= {}; o
["Implement Rectangle.intersection"] ();
928 flash
.geom
.Rectangle.prototype
.intersects
= function () {
929 var o
= {}; o
["Implement Rectangle.intersects"] ();
932 flash
.geom
.Rectangle.prototype
.union
= function () {
933 var o
= {}; o
["Implement Rectangle.union"] ();
936 flash
.geom
.Rectangle.prototype
.equals
= function () {
937 var o
= {}; o
["Implement Rectangle.equals"] ();
940 flash
.geom
.Rectangle.prototype
.toString
= function () {
941 var o
= {}; o
["Implement Rectangle.toString"] ();
946 flash
.geom
.Matrix = function () {
947 var o
= {}; o
["Implement Matrix"] ();
950 flash
.geom
.Matrix.prototype
.clone
= function () {
951 var o
= {}; o
["Implement Matrix.clone"] ();
954 flash
.geom
.Matrix.prototype
.concat
= function () {
955 var o
= {}; o
["Implement Matrix.concat"] ();
958 flash
.geom
.Matrix.prototype
.createBox
= function () {
959 var o
= {}; o
["Implement Matrix.createBox"] ();
962 flash
.geom
.Matrix.prototype
.createGradientBox
= function () {
963 var o
= {}; o
["Implement Matrix.createGradientBox"] ();
966 flash
.geom
.Matrix.prototype
.deltaTransformPoint
= function () {
967 var o
= {}; o
["Implement Matrix.deltaTransformPoint"] ();
970 flash
.geom
.Matrix.prototype
.identity
= function () {
971 var o
= {}; o
["Implement Matrix.identity"] ();
974 flash
.geom
.Matrix.prototype
.invert
= function () {
975 var o
= {}; o
["Implement Matrix.invert"] ();
978 flash
.geom
.Matrix.prototype
.rotate
= function () {
979 var o
= {}; o
["Implement Matrix.rotate"] ();
982 flash
.geom
.Matrix.prototype
.scale
= function () {
983 var o
= {}; o
["Implement Matrix.scale"] ();
986 flash
.geom
.Matrix.prototype
.transformPoint
= function () {
987 var o
= {}; o
["Implement Matrix.transformPoint"] ();
990 flash
.geom
.Matrix.prototype
.translate
= function () {
991 var o
= {}; o
["Implement Matrix.translate"] ();
994 flash
.geom
.Matrix.prototype
.toString
= function () {
995 var o
= {}; o
["Implement Matrix.toString"] ();
1000 flash
.geom
.ColorTransform = ASconstructor
(1105, 0);
1002 flash
.geom
.ColorTransform.prototype
.toString
= function () {
1003 var o
= {}; o
["Implement ColorTransform.toString"] ();
1006 ASSetNative
(flash
.geom
.ColorTransform.prototype
, 1105, "8concat", 1);
1007 ASSetNativeAccessor
(flash
.geom
.ColorTransform.prototype
, 1105, "8alphaMultiplier,8redMultiplier,8greenMultiplier,8blueMultiplier,8alphaOffset,8redOffset,8greenOffset,8blueOffset,8rgb", 101);
1011 flash
.geom
.Transform = ASconstructor
(1106, 0);
1013 ASSetNativeAccessor
(flash
.geom
.Transform.prototype
, 1106, "8matrix,8concatenatedMatrix,8colorTransform,8concatenatedColorTransform,8pixelBounds", 101);
1018 flash
.display
.BitmapData = ASconstructor
(1100, 0);
1020 flash
.display
.BitmapData.RED_CHANNEL
= 1;
1021 flash
.display
.BitmapData.GREEN_CHANNEL
= 2;
1022 flash
.display
.BitmapData.BLUE_CHANNEL
= 4;
1023 flash
.display
.BitmapData.ALPHA_CHANNEL
= 8;
1025 ASSetNative
(flash
.display
.BitmapData, 1100, "8loadBitmap", 40);
1027 ASSetNative
(flash
.display
.BitmapData.prototype
, 1100, "8getPixel,8setPixel,8fillRect,8copyPixels,8applyFilter,8scroll,8threshold,8draw,8pixelDissolve,8getPixel32,8setPixel32,8floodFill,8getColorBoundsRect,8perlinNoise,8colorTransform,8hitTest,8paletteMap,8merge,8noise,8copyChannel,8clone,8dispose,8generateFilterRect,8compare", 1);
1028 ASSetNativeAccessor
(flash
.display
.BitmapData.prototype
, 1100, "8width,8height,8rectangle,8transparent", 100);
1030 /* ExternalInterface */
1032 flash
.external
= {};
1034 flash
.external
.ExternalInterface = function () {
1037 flash
.external
.ExternalInterface.addCallback
= function () {
1038 var o
= {}; o
["Implement ExternalInterface.addCallback (static)"] ();
1041 flash
.external
.ExternalInterface.call
= function () {
1042 var o
= {}; o
["Implement ExternalInterface.call (static)"] ();
1045 flash
.external
.ExternalInterface._callIn
= function () {
1046 var o
= {}; o
["Implement ExternalInterface._callIn (static)"] ();
1049 flash
.external
.ExternalInterface._toXML
= function () {
1050 var o
= {}; o
["Implement ExternalInterface._toXML (static)"] ();
1053 flash
.external
.ExternalInterface._objectToXML
= function () {
1054 var o
= {}; o
["Implement ExternalInterface._objectToXML (static)"] ();
1057 flash
.external
.ExternalInterface._arrayToXML
= function () {
1058 var o
= {}; o
["Implement ExternalInterface._arrayToXML (static)"] ();
1061 flash
.external
.ExternalInterface._argumentsToXML
= function () {
1062 var o
= {}; o
["Implement ExternalInterface._argumentsToXML (static)"] ();
1065 flash
.external
.ExternalInterface._toAS
= function () {
1066 var o
= {}; o
["Implement ExternalInterface._toAS (static)"] ();
1069 flash
.external
.ExternalInterface._objectToAS
= function () {
1070 var o
= {}; o
["Implement ExternalInterface._objectToAS (static)"] ();
1073 flash
.external
.ExternalInterface._arrayToAS
= function () {
1074 var o
= {}; o
["Implement ExternalInterface._arrayToAS (static)"] ();
1077 flash
.external
.ExternalInterface._argumentsToAS
= function () {
1078 var o
= {}; o
["Implement ExternalInterface._argumentsToAS (static)"] ();
1081 flash
.external
.ExternalInterface._toJS
= function () {
1082 var o
= {}; o
["Implement ExternalInterface._toJS (static)"] ();
1085 flash
.external
.ExternalInterface._objectToJS
= function () {
1086 var o
= {}; o
["Implement ExternalInterface._objectToJS (static)"] ();
1089 flash
.external
.ExternalInterface._arrayToJS
= function () {
1090 var o
= {}; o
["Implement ExternalInterface._arrayToJS (static)"] ();
1093 ASSetNative
(flash
.external
.ExternalInterface, 14, "8_initJS,8_objectID,8_addCallback,8_evalJS,8_callOut,8_escapeXML,8_unescapeXML,8_jsQuoteString");
1094 ASSetNativeAccessor
(flash
.external
.ExternalInterface, 14, "8available", 100);
1096 ASSetPropFlags
(flash
.external
.ExternalInterface, null, 4103);
1100 function SharedObject () {
1103 SharedObject.deleteAll
= function () {
1104 var o
= {}; o
["Implement SharedObject.deleteAll (static)"] ();
1107 SharedObject.getDiskUsage
= function () {
1108 var o
= {}; o
["Implement SharedObject.getDiskUsage (static)"] ();
1111 SharedObject.getLocal
= function () {
1112 var o
= {}; o
["Implement SharedObject.getLocal (static)"] ();
1115 SharedObject.getRemote
= function () {
1116 var o
= {}; o
["Implement SharedObject.getRemote (static)"] ();
1119 ASSetPropFlags
(SharedObject, "deleteAll,getDiskUsage", 1);
1121 ASSetNative
(SharedObject.prototype
, 2106, "6connect,6send,6flush,6close,6getSize,6setFps,6clear");
1122 ASSetPropFlags
(SharedObject.prototype
, null, 3);
1126 /* This function added new Error classes in Flash player 7, in Flash player 9
1127 * it seems to be just broken, we just call new Error based on the number of
1128 * ,-characters in the given string */
1129 function AsSetupError
(names
) {
1130 var count
= names
.split
(",").length
;
1131 for (var i
= 0; i
< count
; i
++) {
1132 var tmp
= new Error ();
1136 /* RemoteLSOUsage */
1138 function RemoteLSOUsage
() {
1141 RemoteLSOUsage
.getURLPageSupport
= function () {
1142 var o
= {}; o
["Implement RemoteLSOUsage.getURLPageSupport (static)"] ();
1144 ASSetPropFlags
(RemoteLSOUsage
, "getURLPageSupport", 1);
1148 Button = ASconstructor
(105, 0);
1150 Button.prototype
.useHandCursor
= true;
1151 Button.prototype
.enabled
= true;
1153 Button.prototype
.getDepth
= ASnative
(105, 3);
1154 ASSetNativeAccessor
(Button.prototype
, 105, "8scale9Grid,8filters,8cacheAsBitmap,8blendMode", 4);
1155 // FIXME: this should be done inside the Button constructor
1156 ASSetNativeAccessor
(Button.prototype
, 900, "8tabIndex", 200);
1162 flash
.filters
.BitmapFilter = ASconstructor
(1112, 0);
1164 ASSetNative
(flash
.filters
.BitmapFilter.prototype
, 1112, "8clone", 1);
1168 flash
.filters
.BevelFilter = ASconstructor
(1107, 0);
1169 flash
.filters
.BevelFilter.prototype
= new flash
.filters
.BitmapFilter ();
1170 delete flash
.filters
.BevelFilter.prototype
.constructor
;
1172 ASSetNativeAccessor
(flash
.filters
.BevelFilter.prototype
, 1107, "8distance,8angle,8highlightColor,8highlightAlpha,8shadowColor,8shadowAlpha,8quality,8strength,8knockout,8blurX,8blurY,8type", 1);
1176 flash
.filters
.BlurFilter = ASconstructor
(1102, 0);
1177 flash
.filters
.BlurFilter.prototype
= new flash
.filters
.BitmapFilter ();
1178 delete flash
.filters
.BlurFilter.prototype
.constructor
;
1180 ASSetNativeAccessor
(flash
.filters
.BlurFilter.prototype
, 1102, "8blurX,8blurY,8quality", 1);
1182 /* ColorMatrixFilter */
1184 flash
.filters
.ColorMatrixFilter = ASconstructor
(1110, 0);
1185 flash
.filters
.ColorMatrixFilter.prototype
= new flash
.filters
.BitmapFilter ();
1186 delete flash
.filters
.ColorMatrixFilter.prototype
.constructor
;
1188 ASSetNativeAccessor
(flash
.filters
.ColorMatrixFilter.prototype
, 1110, "8matrix", 1);
1190 /* ConvolutionFilter */
1192 flash
.filters
.ConvolutionFilter = ASconstructor
(1109, 0);
1193 flash
.filters
.ConvolutionFilter.prototype
= new flash
.filters
.BitmapFilter ();
1194 delete flash
.filters
.ConvolutionFilter.prototype
.constructor
;
1196 ASSetNativeAccessor
(flash
.filters
.ConvolutionFilter.prototype
, 1109, "8matrixX,8matrixY,8matrix,8divisor,8bias,8preserveAlpha,8clamp,8color,8alpha", 1);
1198 /* DisplacementMapFilter */
1200 flash
.filters
.DisplacementMapFilter = ASconstructor
(1111, 0);
1201 flash
.filters
.DisplacementMapFilter.prototype
= new flash
.filters
.BitmapFilter ();
1202 delete flash
.filters
.DisplacementMapFilter.prototype
.constructor
;
1204 ASSetNativeAccessor
(flash
.filters
.DisplacementMapFilter.prototype
, 1111, "8mapBitmap,8mapPoint,8componentX,8componentY,8scaleX,8scaleY,8mode,8color,8alpha", 1);
1206 /* DropShadowFilter */
1208 flash
.filters
.DropShadowFilter = ASconstructor
(1101, 0);
1209 flash
.filters
.DropShadowFilter.prototype
= new flash
.filters
.BitmapFilter();
1210 delete flash
.filters
.DropShadowFilter.prototype
.constructor
;
1212 ASSetNativeAccessor
(flash
.filters
.DropShadowFilter.prototype
, 1101, "8distance,8angle,8color,8alpha,8quality,8inner,8knockout,8blurX,8blurY,8strength,8hideObject", 1);
1216 flash
.filters
.GlowFilter = ASconstructor
(1103, 0);
1217 flash
.filters
.GlowFilter.prototype
= new flash
.filters
.BitmapFilter ();
1218 delete flash
.filters
.GlowFilter.prototype
.constructor
;
1220 ASSetNativeAccessor
(flash
.filters
.GlowFilter.prototype
, 1103, "8color,8alpha,8quality,8inner,8knockout,8blurX,8blurY,8strength", 1);
1222 /* GradientBevelFilter */
1224 flash
.filters
.GradientBevelFilter = ASconstructor
(1108, 1000);
1225 flash
.filters
.GradientBevelFilter.prototype
= new flash
.filters
.BitmapFilter ();
1226 delete flash
.filters
.GradientBevelFilter.prototype
.constructor
;
1228 ASSetNativeAccessor
(flash
.filters
.GradientBevelFilter.prototype
, 1108, "8distance,8angle,8colors,8alphas,8ratios,8blurX,8blurY,8quality,8strength,8knockout,8type", 1);
1230 /* GradientGlowFilter */
1232 flash
.filters
.GradientGlowFilter = ASconstructor
(1108, 0);
1233 flash
.filters
.GradientGlowFilter.prototype
= o
= new flash
.filters
.BitmapFilter ();
1234 delete flash
.filters
.GradientGlowFilter.prototype
.constructor
;
1235 ASSetNativeAccessor
(flash
.filters
.GradientGlowFilter.prototype
, 1108, "8distance,8angle,8colors,8alphas,8ratios,8blurX,8blurY,8quality,8strength,8knockout,8type", 1);
1237 /* Global Functions */
1239 setInterval
= ASnative
(250, 0);
1240 clearInterval
= ASnative
(250, 1);
1241 setTimeout
= ASnative
(250, 2);
1242 clearTimeout
= clearInterval
;
1243 showRedrawRegions
= ASnative
(1021, 1);
1244 trace
= ASnative
(100, 4);
1245 updateAfterEvent
= ASnative
(9, 0);
1247 /*** OH THE HUMANITY ***/
1251 /*** Set propflags that would have interfered with running this script */
1253 ASSetPropFlags
(this, "flash", 4096);
1254 ASSetPropFlags
(Object, "addProperty", 128);
1255 ASSetPropFlags
(AsBroadcaster
, null, 131);
1257 /*** GLOBAL PROPFLAGS */
1259 ASSetPropFlags
(this, null, 1, 6);