[Laszlo-dev] error compiling user class in swf9

Donald Anderson dda at ddanderson.com
Thu Mar 27 13:06:00 PDT 2008


I'm looking at the generated code now.
There's a few things that pop out right away.

1) we generate this:

    dynamic class $lzc$class_foobar extends $lzc$class_view {

I'm guessing that this should be extends 'LzView' ?
That's what you need the LFC dictionary for?
So I changed the three occurrences of $lzc$class_view to LzView.

2) it looks like there are some static stuff in the user class like  
this:

static var tagname = "foobar";static var children =  
LzNode.mergeChildren([{attrs: {bgcolor: 16711000, height: 100, width:  
100}, name: "view"}, {attrs: {bgcolor: 255, height: 150, width: 200,  
x: 175, y: 100}, name: "view"}], $lzc$class_view["children"]);static  
var attributes = new LzInheritedHash($lzc$class_view.attributes);

Is there some what that the name "foobar" gets registered to the  
application to know about this class?
Is it some side effect of this static code? (if so, we need a way to  
get the class initialized).
But I don't see the string "foobar" anywhere, except in the tagname.

After all, the main code has this:
   LzInstantiateView({attrs: {x: 100}, name: "foobar"}, 3);

So it's got to find the name "foobar" someplace?

3) there are compilation errors in $lzc$class_foobar.as, and we don't  
see them because
$lzc$class_foobar is never referenced anywhere.  My temporary  
workaround was to insert
a dummy function in $lzc$class_foobar:

    static function $init$() { }

And insert code into the LzApplication's constuctor():

    $lzc$class_foobar.$init$();

(This is all done manually for debugging).

Now when I compile I start getting errors:

/Users/clients/laszlo/lib/jakarta-tomcat-5.0.30/temp/lzswf9/ 
lzgen23563/$lzc$class_foobar.as(6): col: 89 Error: Type was not found  
or was not a compile-time constant: boolean.

function $lzc$class_foobar (parent:LzNode, attrs:Object,  
children:Object? = null, async:boolean = null)

So boolean = null should be Boolean = false  (is this something  
generated by tag compiler?)

4) fixing that gets a clean compile, but same behavior (blank canvas).
I suspect it's something to do with 2) above - somehow we need
to register the 'foobar' class so it can be instantiated at runtime as  
needed.

Henry - I think these issues need your expertise, but if there's  
something
I can assist with, shout.  BTW, my cell is 617-306-2057, feel free to  
call.
I'll be reading email too.

- Don



On Mar 27, 2008, at 1:20 PM, Henry Minsky wrote:

> with this test case
>
> <canvas width="1000" height="600" bgcolor="#eeeeff">
>   <class name="foobar" >
>     <view width="50" height="50" bgcolor='red'/>
>     <view y="50" x="75" width="100" height="50" bgcolor='blue'/>
>   </class>
>
>   <foobar x="100"/>
>   <foobar x="200" y="200"/>
>   <foobar x="300" y="400"/>
>
>
> </canvas>
>
> I get this compiler error in swf9
>
> lzc --runtime=swf9 hello-classes.lzx
> Compiling: hello-classes.lzx to hello-classes.lzr=swf9.swf
> Compilation errors occurred:
> : org.openlaszlo.sc.CompilerError: $lzc$class_foobar: class or mixin  
> name may conflict with internally generated names
> badtzmaru:swf9 hqm$
>
>
> -- 
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
>


--

Don Anderson
Java/C/C++, Berkeley DB, systems consultant

voice: 617-547-7881
email: dda at ddanderson.com
www: http://www.ddanderson.com




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20080327/2d85299c/attachment-0001.html


More information about the Laszlo-dev mailing list