[Laszlo-checkins] r13291 - openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9
bargull@openlaszlo.org
bargull at openlaszlo.org
Sat Mar 14 18:44:08 PDT 2009
Author: bargull
Date: 2009-03-14 18:44:05 -0700 (Sat, 14 Mar 2009)
New Revision: 13291
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzInputTextSprite.as
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as
Log:
Change 20090315-bargull-UDr by bargull at dell--p4--2-53 on 2009-03-15 02:40:11
in /home/Admin/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: clean-up for AS3 import statements - PART 3
New Features:
Bugs Fixed: LPP-7904 (SWF9: unnecessary imports)
Technical Reviewer: (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
Tests:
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzInputTextSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzInputTextSprite.as 2009-03-15 00:31:26 UTC (rev 13290)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzInputTextSprite.as 2009-03-15 01:44:05 UTC (rev 13291)
@@ -14,7 +14,7 @@
*/
public class LzInputTextSprite extends LzTextSprite {
- #passthrough (toplevel:true) {
+ #passthrough (toplevel:true) {
import flash.display.InteractiveObject;
import flash.events.Event;
import flash.events.FocusEvent;
@@ -25,16 +25,15 @@
#passthrough {
- function LzInputTextSprite (newowner = null, args = null) {
+ function LzInputTextSprite (newowner:LzView = null, args:Object = null) {
super(newowner);
}
- var __handlelostFocusdel;
- var enabled = true;
- var focusable = true;
- var hasFocus = false;
+ var enabled :Boolean = true;
+ var focusable :Boolean = true;
+ var hasFocus :Boolean = false;
- override public function __initTextProperties (args:Object) {
+ override public function __initTextProperties (args:Object) :void {
super.__initTextProperties(args);
// We do not support html in input fields.
if (this.enabled) {
@@ -157,7 +156,7 @@
* Sets whether user can modify input text field
* @param Boolean enabled: true if the text field can be edited
*/
- function setEnabled (enabled) :void {
+ function setEnabled (enabled:Boolean) :void {
this.enabled = enabled;
if (enabled) {
textfield.type = 'input';
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as 2009-03-15 00:31:26 UTC (rev 13290)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as 2009-03-15 01:44:05 UTC (rev 13291)
@@ -12,24 +12,35 @@
dynamic public class LzSprite extends Sprite {
#passthrough (toplevel:true) {
- import flash.display.*;
- import flash.events.*;
- import flash.ui.*;
- import flash.geom.*;
- import flash.utils.*;
- import mx.controls.Button;
- import flash.net.*;
- import flash.utils.*;
- import flash.system.Security;
- import flash.system.SecurityDomain;
- import flash.system.ApplicationDomain;
- import flash.system.LoaderContext;
+ import flash.display.AVM1Movie;
+ import flash.display.Bitmap;
+ import flash.display.DisplayObject;
+ import flash.display.DisplayObjectContainer;
+ import flash.display.Graphics;
+ import flash.display.InteractiveObject;
+ import flash.display.Loader;
+ import flash.display.LoaderInfo;
+ import flash.display.MovieClip;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+ import flash.display.Sprite;
+ import flash.display.SWFVersion;
+ import flash.events.Event;
+ import flash.events.ErrorEvent;
+ import flash.events.IOErrorEvent;
+ import flash.events.MouseEvent;
+ import flash.events.ProgressEvent;
+ import flash.events.SecurityErrorEvent;
+ import flash.geom.ColorTransform;
+ import flash.geom.Rectangle;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundMixer;
import flash.media.SoundTransform;
import flash.media.SoundLoaderContext;
import flash.media.ID3Info;
+ import flash.net.URLRequest;
+ import flash.system.LoaderContext;
}#
#passthrough {
@@ -125,7 +136,7 @@
};
var capabilities = LzSprite.capabilities;
- public function LzSprite (newowner = null, isroot = null) {
+ public function LzSprite (newowner:LzView = null, isroot:Object = null) {
// owner:*, isroot:Boolean
this.owner = newowner;
if (owner == null) return;
@@ -163,7 +174,7 @@
}
- public function predestroy(){
+ public function predestroy() :void {
this.bringToFront();
}
@@ -320,7 +331,7 @@
}
this.__isinternalresource = false;
this.resource = url;
- var res = this.imgLoader;
+ var res:Loader = this.imgLoader;
if (res) {
res.scaleX = res.scaleY = 1.0;
}
@@ -670,28 +681,27 @@
public function __mouseEvent( e:MouseEvent ) :void {
var skipevent:Boolean = false;
+ var stopevent:Boolean = true;
var eventname:String = 'on' + e.type.toLowerCase();
if (eventname == 'onmousedown') {
- // cancel mousedown event bubbling...
- e.stopPropagation();
+ LzMouseKernel.__lastMouseDown = this;
this.__mousedown = true;
- LzMouseKernel.__lastMouseDown = this;
} else if (eventname == 'onmouseup') {
if (LzMouseKernel.__lastMouseDown === this) {
- // cancel mousedown event bubbling...
LzMouseKernel.__lastMouseDown = null;
- e.stopPropagation();
this.__mousedown = false;
} else {
skipevent = true;
+ stopevent = false;
}
} else if (eventname == 'onmouseupoutside') {
this.__mousedown = false;
- } else {
- e.stopPropagation();
}
+ // cancel mouse event bubbling...
+ if (stopevent) e.stopPropagation();
+
//Debug.write('__mouseEvent', eventname, this.owner);
if (skipevent == true || ! this.owner.mouseevent) return;
@@ -720,7 +730,6 @@
if (this.clickable && this.clickbutton) {
this.clickbutton.useHandCursor = (showhandcursor == null) ? LzMouseKernel.showhandcursor : showhandcursor;
}
-
}
/** setClickable( Boolean:clickable )
@@ -747,7 +756,7 @@
}
cb.useHandCursor = (showhandcursor == null) ? LzMouseKernel.showhandcursor : showhandcursor;
cb.tabEnabled = false;
- var cr = new Shape();
+ var cr:Shape = new Shape();
this.clickregion = cr;
cr.graphics.beginFill(0xffffff);
cr.graphics.drawRect(0, 0, 1, 1);
@@ -875,7 +884,7 @@
/** Returns the foreground color of the sprite. This isn't known so
0 is returned.
*/
- public function getColor (){
+ public function getColor () :Number {
// Only applicable for text
return 0;
}
@@ -894,8 +903,8 @@
* o.aa: percentage overall alpha (-100 to 100);
* o.ab: overall offset (-255 to 255);
*/
- public function getColorTransform ():*{
- var ct = this.transform.colorTransform;
+ public function getColorTransform ():Object {
+ var ct:ColorTransform = this.transform.colorTransform;
return {ra: ct.redMultiplier * 100, rb: ct.redOffset,
ga: ct.greenMultiplier * 100, gb: ct.greenOffset,
ba: ct.blueMultiplier * 100 , bb: ct.blueOffset,
@@ -916,7 +925,7 @@
* o.aa: percentage overall alpha (-100 to 100);
* o.ab: overall offset (-255 to 255);
*/
- function setColorTransform ( o:* ){
+ function setColorTransform ( o:* ) :void {
this.transform.colorTransform = new ColorTransform(o.ra / 100.0,
o.ga / 100.0,
o.ba / 100.0,
@@ -1111,7 +1120,7 @@
}
/** Callback resets resources after they have loaded and displayed */
- public function __resetframe(ignore=null):void {
+ public function __resetframe(ignore:*=null):void {
LzIdleKernel.removeCallback(this, '__resetframe');
this.stop(this.frame);
}
@@ -1182,7 +1191,7 @@
}
public function applyStretchResource():void {
- var res = this.resourceContainer;
+ var res:DisplayObject = this.resourceContainer;
// Don't try to do anything while an image is loading
if (res == null) return;
@@ -1320,7 +1329,7 @@
}
}
- public function unload() {
+ public function unload() :void {
if (this.owner != null) {
this.owner.resourceevent('loadratio', 0);
this.owner.resourceevent('framesloadratio', 0);
@@ -1356,19 +1365,19 @@
this.resourceCache = null;
}
- public function setAccessible(accessible:*) {
+ public function setAccessible(accessible:*) :void {
trace('LzSprite.setAccessible not yet implemented');
}
- public function getMCRef () {
+ public function getMCRef () :LzSprite {
return this;
}
- public function getContext () {
+ public function getContext () :Graphics {
return this.graphics;
}
- public function setBitmapCache(cache) {
+ public function setBitmapCache(cache) :void {
this.cacheAsBitmap = cache;
this.updateBackground();
}
@@ -1434,7 +1443,7 @@
}
- function sendResourceLoad(skiponload = false) {
+ function sendResourceLoad(skiponload:Boolean = false) :void {
// skiponload is true for resources/setResource() calls
if (this.owner != null) {
this.owner.resourceload({width: this.resourcewidth, height: this.resourceheight, resource: this.resource, skiponload: skiponload});
@@ -1446,7 +1455,7 @@
/**
* CURSOR is a string naming the resource to be used as the mouse pointer
*/
- function setCursor ( cursor:String=null ){
+ function setCursor ( cursor:String=null ) :void {
if (cursor == null) return;
if (cursor != '') {
this.cursorResource = cursor;
@@ -1463,13 +1472,13 @@
}
/** @access private */
- function cursorGotMouseover (event:MouseEvent) {
+ function cursorGotMouseover (event:MouseEvent) :void {
LzMouseKernel.setCursorLocal(this.cursorResource);
}
/** @access private */
- function cursorGotMouseout (event:MouseEvent) {
+ function cursorGotMouseout (event:MouseEvent) :void {
// If we get a mouseout event, but the cursor is still on
// top of this sprite, then that assume a "ghost event", due
// to the addChild() call when cursor resource is being set.
@@ -1549,31 +1558,31 @@
/**
*
*/
- function setShowHandCursor ( s:* ){
+ function setShowHandCursor ( s:* ) :void {
this.showhandcursor = s;
}
- function setAAActive(s) {
+ function setAAActive(s:*) :void {
trace('LzSprite.setAAActive not yet implemented');
}
- function setAAName(s) {
+ function setAAName(s:*) :void {
trace('LzSprite.setAAName not yet implemented');
}
- function setAADescription(s) {
+ function setAADescription(s:*) :void {
trace('LzSprite.setAADescription not yet implemented');
}
- function setAATabIndex(s) {
+ function setAATabIndex(s:*) :void {
trace('LzSprite.setAATabIndex not yet implemented');
}
- function setAASilent(s) {
+ function setAASilent(s:*) :void {
trace('LzSprite.setAASilent not yet implemented');
}
- function updateResourceSize(skipsend = null){
+ function updateResourceSize(skipsend:* = null) :void {
this.setWidth(this._setrescwidth?this.width:this.resourcewidth);
this.setHeight(this._setrescheight?this.height:this.resourceheight);
@@ -1586,6 +1595,3 @@
}#
}
-
-
-
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as 2009-03-15 00:31:26 UTC (rev 13290)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as 2009-03-15 01:44:05 UTC (rev 13291)
@@ -1,4 +1,3 @@
-
/**
* LzTextSprite.as
*
@@ -9,20 +8,21 @@
* @subtopic swf9
* @author Henry Minsky <hminsky at laszlosystems.com>
*/
-
-
-
-
-
public class LzTextSprite extends LzSprite {
- #passthrough (toplevel:true) {
- import flash.display.*;
- import flash.events.*;
- import flash.text.*;
- import flash.net.URLRequest;
+ #passthrough (toplevel:true) {
+ import flash.display.DisplayObject;
+ import flash.events.Event;
+ import flash.events.MouseEvent;
+ import flash.events.TextEvent;
+ import flash.net.URLRequest;
+ import flash.text.AntiAliasType;
+ import flash.text.TextField;
+ import flash.text.TextFieldAutoSize;
+ import flash.text.TextFormat;
+ import flash.text.TextLineMetrics;
}#
- #passthrough {
+ #passthrough {
public var textfield:TextField = null;
@@ -30,7 +30,7 @@
public static const PAD_TEXTHEIGHT:Number = 4;
public static const DEFAULT_SIZE:Number = 11;
- var font = null;
+ var font:LzFont = null;
/**
* @access private
@@ -53,7 +53,7 @@
*/
public var lineheight:Number = 1;
- public var textcolor = 0;
+ public var textcolor:Number = 0;
public var text:String = "";
public var resize:Boolean = true;
@@ -70,11 +70,11 @@
public var scrollheight:Number = 0;
public var html:Boolean = true;
- public function LzTextSprite (newowner = null, args = null) {
+ public function LzTextSprite (newowner:LzView = null, args:Object = null) {
super(newowner,false);
// owner:*, isroot:Boolean
this.textfield = createTextField(0,0,400,20);
- }
+ }
override public function setClickable( c:Boolean ):void {
if (this.clickable == c) return;
@@ -85,13 +85,13 @@
this.clickable = c;
if (c) {
attachMouseEvents(this.textfield);
- } else {
+ } else {
removeMouseEvents(this.textfield);
}
}
public function addScrollEventListener():void {
- this.textfield.addEventListener(flash.events.Event.SCROLL, __handleScrollEvent);
+ this.textfield.addEventListener(Event.SCROLL, __handleScrollEvent);
}
function __handleScrollEvent(e:Event = null) :void {
@@ -163,7 +163,7 @@
this.owner.ontextlink.sendEvent(e.text);
}
- public function makeTextLink(str, value) {
+ public function makeTextLink(str:String, value:String) :String {
return '<a href="event:'+value+'">'+str+'</a>';
}
@@ -185,7 +185,7 @@
private function createTextField(nx:Number, ny:Number, w:Number, h:Number):TextField {
var tfield:TextField = new TextField();
- tfield.antiAliasType = flash.text.AntiAliasType.ADVANCED;
+ tfield.antiAliasType = AntiAliasType.ADVANCED;
tfield.x = nx;
tfield.y = ny;
tfield.width = w;
@@ -198,7 +198,7 @@
return tfield;
}
- public function __initTextProperties (args:Object) {
+ public function __initTextProperties (args:Object) :void {
this.password = args.password ? true : false;
var textclip:TextField = this.textfield;
textclip.displayAsPassword = this.password;
@@ -297,14 +297,14 @@
o Sets the name of the font
o Can be a comma-separated list of font names
*/
- public function setFontName ( fname:String , prop=null):void{
+ public function setFontName ( fname:String , prop:*=null):void{
this.fontname = fname;
this.__setFormat();
// force recompute of height if needed
this.setText( this.text );
}
- function setFontInfo () {
+ function setFontInfo () :void {
this.font = LzFontManager.getFont( this.fontname , this.fontstyle );
//Debug.write('setFontInfo this.font = ', this.font, 'this.fontname = ', this.fontname, this.fontstyle);
}
@@ -393,7 +393,7 @@
*/
public function __setFormat ():void {
this.setFontInfo();
- var cfontname = LzFontManager.__fontnameCacheMap[this.fontname];
+ var cfontname:String = LzFontManager.__fontnameCacheMap[this.fontname];
if (cfontname == null) {
cfontname = LzFontManager.__findMatchingFont(this.fontname);
LzFontManager.__fontnameCacheMap[this.fontname] = cfontname;
@@ -431,7 +431,7 @@
var lm:TextLineMetrics = this.textfield.getLineMetrics(0);
this.textfield[this.html ? 'htmlText' : 'text'] = text;
- var lh = lm.ascent + lm.descent + lm.leading;
+ var lh:Number = lm.ascent + lm.descent + lm.leading;
if (lh !== this.lineheight) {
this.lineheight = lh;
// Tell the owner the linescale has changed
@@ -478,7 +478,7 @@
return this.textfield.textHeight;
}
- public function getTextfieldHeight ( ) {
+ public function getTextfieldHeight ( ) :Number {
var textclip:TextField = this.textfield;
var tca:String = textclip.autoSize;
var tcw:Number = textclip.width;
@@ -508,12 +508,12 @@
}
-function setHScroll(s:Number) {
+function setHScroll(s:Number) :void {
this.textfield.scrollH = this.hscroll = s;
}
function setAntiAliasType( aliasType:String ):void {
- var atype:String = (aliasType == 'advanced') ? flash.text.AntiAliasType.ADVANCED : flash.text.AntiAliasType.NORMAL;
+ var atype:String = (aliasType == 'advanced') ? AntiAliasType.ADVANCED : AntiAliasType.NORMAL;
this.textfield.antiAliasType = atype;
}
@@ -561,27 +561,27 @@
}
}
-function setSelection(start:Number, end:Number) {
+function setSelection(start:Number, end:Number) :void {
this.textfield.setSelection(start, end);
this.textfield.alwaysShowSelection = true;
}
-function setResize ( val:Boolean ) {
+function setResize ( val:Boolean ) :void {
this.resize = val;
}
-function setScroll ( h:Number ) {
+function setScroll ( h:Number ) :void {
this.textfield.scrollV = this.scroll = h;
}
-function getScroll() {
+function getScroll() :Number {
return this.textfield.scrollV;
}
-function getMaxScroll() {
+function getMaxScroll() :Number {
return this.textfield.maxScrollV;
}
-function getBottomScroll() {
+function getBottomScroll() :Number {
return this.textfield.bottomScrollV;
}
@@ -593,22 +593,22 @@
return Math.floor((n / lineheight) + 1);
}
-function setYScroll ( n ){
+function setYScroll (n:Number) :void {
this.textfield.scrollV = this.scroll = this.pixelToLineNo((- n));
}
-function setXScroll ( n ){
+function setXScroll (n:Number) :void {
this.textfield.scrollH = this.hscroll = (- n);
}
-function setWordWrap ( wrap ){
+function setWordWrap (wrap:Boolean) :void {
Debug.warn("LzTextSprite.setWordWrap not yet implemented");
}
-function getSelectionPosition() {
+function getSelectionPosition() :int {
return this.textfield.selectionBeginIndex;
}
-function getSelectionSize() {
+function getSelectionSize() :int {
return this.textfield.selectionEndIndex - this.textfield.selectionBeginIndex;
}
More information about the Laszlo-checkins
mailing list