Henry,
I think you can use
var ip:LzView = (this.immediateparent cast LzView);
I had forgotten that Tucker put this in recently, and should solve the
issue! It's different from 'as' in that 'cast' will throw an exception
if the conversion is not possible. So no big need for 'as'.
(It's good to read cvs logs now and then...)
- Don
On Mar 24, 2008, at 8:52 AM, Donald Anderson wrote:
Do you want me to add this to the parser in trunk?
It shouldn't take long. Seems like casting is pretty necessary
if we're going to start using real typing.
On Mar 23, 2008, at 8:41 PM, P T Withington wrote:
Our JS1 translator is not recognizing calling a class as a function
to mean cast. In fact, this is only a 'convention' in JS2, you are
allowed to have calling a class as a function do anything you want.
So, Don is right, we probably want to use the cast operator, which
is named `as`.
On 2008-03-22, at 21:29 EDT, Donald Anderson wrote:
LzView(x) is probably not recognized as a cast,
but as a normal function call. I wonder if we
should support the 'as' directive so we can
recognize and elide casts.
var ip:LzView = (this.immediateparent as LzView);
The semantics are similar, except that 'as' can return
null in cases where casts would throw an exception.
The alternative is to recognize all class names.
On Mar 22, 2008, at 7:14 PM, Henry Minsky wrote:
The difference is in the line
$
2
);this
.__LZdelayedSetters
=
LzView
.__LZdelayedSetters;this.earlySetters=LzView.earlySetters;var
$3=LzView(this.immediateparent);$3=this.immediateparent;this.mask=
$3.mask;this.__makeSprite($2);if("width" in $2){
^^^^^^^^^^^
$
2
);this
.__LZdelayedSetters
=
LzView
.__LZdelayedSetters;this.earlySetters=LzView.earlySetters;var
$3=this.immediateparent;$3=this.immediateparent;this.mask=
$3.mask;this.__makeSprite($2);if("width" in $2){
So the type cast "LzView(...)" is getting sent through to the
output, which must be confusing JS1.
On Sat, Mar 22, 2008 at 7:10 PM, Henry Minsky <[EMAIL PROTECTED]
> wrote:
I have been having trouble merging the the changes to LzView from
swf9 back to swf8/dhtml, I keep getting a runtime
error in DHTML with even the simplest app that has a view in it
this.$lzsc$initialize has no properties
nc()LFCdhtml.js (line 39)
(?)(This is the canvas hasdatapath=true datapath=Object, Object
pixellock=true selectable=false clip=true)LFCdhtml.js (line 2556)
(?)(This is the canvas hasdatapath=true datapath=Object, Object
pixellock=true selectable=false clip=true)LFCdhtml.js (line 3303)
(?)(This is the canvas hasdatapath=true datapath=Object, Object
bgcolor=13434828 font=Verdana,Vera,sans-serif, null,
true)LFCdhtml.js (line 400)
(?)(This is the canvas hasdatapath=true datapath=Object, Object
bgcolor=13434828 font=Verdana,Vera,sans-serif, null,
true)LFCdhtml.js (line 2554)
nc()LFCdhtml.js (line 39)
(?)(Object attrs=Object name=text, true)LFCdhtml.js (line 577)
(?)([This is the canvas hasdatapath=true datapath=Object, [Object
attrs=Object name=view]], 500)LFCdhtml.js (line 6654)
(?)()LFCdhtml.js (line 6642)
(?)(132)LFCdhtml.js (line 925)
__idleupdate()LFCdhtml.js (line 7387)
__update()LFCdhtml.js (line 953)
this.$lzsc$initialize.apply(this,arguments)
I tracked it down to this line in LzView's construct method
var ip:LzView = LzView(this.immediateparent);
If I change that to not use type casting, it works:
//var ip = this.immediateparent;
Here's the diff in the DHTML LFC file which is produced by this
change:
*** /tmp/good 2008-03-22 19:01:37 -0400
--- /tmp/bad 2008-03-22 19:02:01 -0400
***************
*** 2553,2560 ****
$4=null
};(arguments.callee.superclass?
arguments.callee.superclass.prototype["$lzsc
$initialize"]:this.nextMethod(arguments.callee,"$lzsc
$initialize")).call(this,$1,$2,$3,$4)
},"animators",void 0,"_height",void 0,"_width",void 0,"_y",void
0,"_x",void 0,"_resource",void 0,"__LZhaser",void
0,"onaddsubview",LzDeclaredEvent,"onbgcolor",LzDeclaredEvent,"onblu
r",LzDeclaredEvent,"onclick",LzDeclaredEvent,"onclickable",LzDeclar
edEvent,"onfocus",LzDeclaredEvent,"onframe",LzDeclaredEvent,"onheig
ht",LzDeclaredEvent,"onimload",LzDeclaredEvent,"onkeyup",LzDeclared
Event,"onkeydown",LzDeclaredEvent,"onlastframe",LzDeclaredEvent,"on
load",LzDeclaredEvent,"onloadperc",LzDeclaredEvent,"onerror",LzDeclaredEvent,"ontimeout",LzDeclaredEvent,"onmousedown",LzDeclaredEvent,"onmouseout",LzDeclaredEvent,"onmouseover",LzDeclaredEvent,"onmousetrackover",LzDeclaredEvent,"onmousetrackup",LzDeclaredEvent,"onmouseup",LzDeclaredEvent,"onopacity",LzDeclaredEvent,"onplay",LzDeclaredEvent,"onremovesubview",LzDeclaredEvent,"onresource",LzDeclaredEvent,"onresourceheight",LzDeclaredEvent,"onresourcewidth",LzDeclaredEvent,"onrotation",LzDeclaredEvent,"onstop",LzDeclaredEvent,"ontotalframes",LzDeclaredEvent,"onunstretchedheight",LzDeclaredEvent,"onunstretchedwidth",LzDeclaredEvent,"onvisible",LzDeclaredEvent,"onvisibility",LzDeclaredEvent,"onwidth",LzDeclaredEvent,"onx",LzDeclaredEvent,"onxoffset",LzDeclaredEvent,"ony",LzDeclaredEvent,"onyoffset",LzDeclaredEvent,"ondblclick",LzDeclaredEvent,"DOUBLE_CLICK_TIME",500,"capabilities",LzSprite.prototype.capabilities,"construct",function($1,$2){
! (arguments.callee.superclass?
arguments
.callee
.superclass
.prototype
["construct
"]:this.nextMethod(arguments.callee,"construct")).call(this,$1?
$1:canvas,
$
2
);this
.__LZdelayedSetters
=
LzView
.__LZdelayedSetters;this.earlySetters=LzView.earlySetters;var
$3=this.immediateparent;$3=this.immediateparent;this.mask=
$3.mask;this.__makeSprite($2);if("width" in $2){
this.hassetwidth=true;this.__LZcheckwidth=false
};if("height" in $2){
this.hassetheight=true;this.__LZcheckheight=false
--- 2553,2560 ----
$4=null
};(arguments.callee.superclass?
arguments.callee.superclass.prototype["$lzsc
$initialize"]:this.nextMethod(arguments.callee,"$lzsc
$initialize")).call(this,$1,$2,$3,$4)
},"animators",void 0,"_height",void 0,"_width",void 0,"_y",void
0,"_x",void 0,"_resource",void 0,"__LZhaser",void
0,"onaddsubview",LzDeclaredEvent,"onbgcolor",LzDeclaredEvent,"onblu
r",LzDeclaredEvent,"onclick",LzDeclaredEvent,"onclickable",LzDeclar
edEvent,"onfocus",LzDeclaredEvent,"onframe",LzDeclaredEvent,"onheig
ht",LzDeclaredEvent,"onimload",LzDeclaredEvent,"onkeyup",LzDeclared
Event,"onkeydown",LzDeclaredEvent,"onlastframe",LzDeclaredEvent,"on
load",LzDeclaredEvent,"onloadperc",LzDeclaredEvent,"onerror",LzDeclaredEvent,"ontimeout",LzDeclaredEvent,"onmousedown",LzDeclaredEvent,"onmouseout",LzDeclaredEvent,"onmouseover",LzDeclaredEvent,"onmousetrackover",LzDeclaredEvent,"onmousetrackup",LzDeclaredEvent,"onmouseup",LzDeclaredEvent,"onopacity",LzDeclaredEvent,"onplay",LzDeclaredEvent,"onremovesubview",LzDeclaredEvent,"onresource",LzDeclaredEvent,"onresourceheight",LzDeclaredEvent,"onresourcewidth",LzDeclaredEvent,"onrotation",LzDeclaredEvent,"onstop",LzDeclaredEvent,"ontotalframes",LzDeclaredEvent,"onunstretchedheight",LzDeclaredEvent,"onunstretchedwidth",LzDeclaredEvent,"onvisible",LzDeclaredEvent,"onvisibility",LzDeclaredEvent,"onwidth",LzDeclaredEvent,"onx",LzDeclaredEvent,"onxoffset",LzDeclaredEvent,"ony",LzDeclaredEvent,"onyoffset",LzDeclaredEvent,"ondblclick",LzDeclaredEvent,"DOUBLE_CLICK_TIME",500,"capabilities",LzSprite.prototype.capabilities,"construct",function($1,$2){
! (arguments.callee.superclass?
arguments
.callee
.superclass
.prototype
["construct
"]:this.nextMethod(arguments.callee,"construct")).call(this,$1?
$1:canvas,
$
2
);this
.__LZdelayedSetters
=
LzView
.__LZdelayedSetters;this.earlySetters=LzView.earlySetters;var
$3=LzView(this.immediateparent);$3=this.immediateparent;this.mask=
$3.mask;this.__makeSprite($2);if("width" in $2){
this.hassetwidth=true;this.__LZcheckwidth=false
};if("height" in $2){
this.hassetheight=true;this.__LZcheckheight=false
--
Henry Minsky
Software Architect
[EMAIL PROTECTED]
--
Henry Minsky
Software Architect
[EMAIL PROTECTED]
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
voice: 617-547-7881
email: [EMAIL PROTECTED]
www: http://www.ddanderson.com
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
voice: 617-547-7881
email: [EMAIL PROTECTED]
www: http://www.ddanderson.com
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
voice: 617-547-7881
email: [EMAIL PROTECTED]
www: http://www.ddanderson.com