PDA

View Full Version : How to use lzSetCanvasAttribute with multiple swfs on the same page?


harunhasdal
01-30-2006, 03:24 AM
How can I tell lzSetCanvasAttribute which canvas to work on? Any ideas?

function changeCanvasColor(color){
lzSetCanvasAttribute('colorchange', color);
}

lzEmbed({url: 'swf2.lzx?lzt=swf', bgcolor:'#ffffff', width: '350', height: '350'});


lzEmbed({url:'swf1.lzx?lzt=swf',bgcolor:'#ffffff', width: '350', height: '350'});

d~l
01-30-2006, 06:43 AM
To target multiple swf's in same HTML wrapper .. each embedded object must have a unique name/id ..

But embed.js .. found in lps\includes\embed.js .. defines fixed name/id ('lzapp') for the embedded object

You can see this by uncommenting

// alert(o)

in embed.js and viewing embed script (alert window) in browser.
And inspect objectAttributes and embedAttributes.

...

My choice is to use flashobject.js in lieu of embed.js .. and set vars which then set attributes.

Search this forum for "flashobject" to read the threads on embedding multiple objects ..

Links:

flashobject (http://blog.deconcept.com/flashobject/)

Another script for embedding lzx?lzt=swf (http://www.laszlosystems.com/developers/community/forums/showthread.php?threadid=3811)

...

I read somewhere that latest version of OpenLaszlo allows canvas attribute "id" to be defined in canvas tag.

harunhasdal
01-31-2006, 12:19 AM
Thanks for the reply, i have learned much. But both embed.js and flashobject does not seem to work on firefox for me. In general noone seems to have a solution to work on firefox. am i wrong?

d~l
01-31-2006, 04:13 AM
Yes you are wrong .. embed.js and flashobject.js both work in Firefox

What version of Firefox do you have installed?

Can you post here your test HTML wrapper code for both embed.js and flashobject.js ?

harunhasdal
01-31-2006, 10:52 PM
Sorry i saw your post late.

Attached file is my test with embed.js and My firefox version is 1.0.6.

I could not find the flashobject test now. I hope you can tell what I m doing wrong.

Thanks.

d~l
02-01-2006, 02:49 AM
I'll take a look at it .. but what version of openlaszlo are you using?

meanwhile, I suggest that you update to Firefox 1.5

then go to Tools > Javascript Console

and run your app in Firefox browser

you will see javascript errors in the console.

And (as suggested earlier) if in embed.js you uncomment

// alert(o)

you will see that the default name/id "burned in" by embed.js is 'lzapp' which I suspect overrides your id attributes.

Bottom line .. embed.js seems not to be designed for embedding multiple swf's.