[Laszlo-user] swf parameter help

Dave Miller dwmiller at umich.edu
Mon Apr 21 08:55:12 PDT 2008


On Apr 20, 2008, at 8:46 AM, billy cokalopolous wrote:

> Hi,
>
> I've been having a real tough time finding documentation on how to  
> do the following:
>
> I am creating a openlaszlo program , profile.lzx. I plan to compile  
> to swf.  My trouble is learning how to capture parameters passed to  
> the lzx file and use those variables in the app.
>
> So:
>
> profile.lzx?profile_id=4 (this would eventually pass to profile.swf? 
> profile_id=4)
>
> In the app, I want to take that ID of 4 and pass it to the following:
>
> <dataset name="dset"
>            request="true" type="http"
>            src="http://somedomain.com/flash_profile.php? 
> profile_id=4"/>
>
> How do I set a variable for profile_id, then how to I pass the value  
> to the dataset tag?
>
> Thanks,
> BC
>


I've done this. The HTML serving up your SWF would contain something  
like this:

<script type="text/javascript">
	Lz.swfEmbed({url: 'main.lzx.lzr=swf8.swf? 
&lzproxied=false&profile_id_param=4', bgcolor: '#ffffff', width:  
'100%', height: '100%', id: 'lzapp', accessible: 'false'});
</script>

And then in your app 'profile_id_param' will be a global variable.

For the dataset use this:

<dataset name="dset" request="false" type="http" src="http://placeholder.com 
"/>

And then use a script to set the real src and params:

<script>
	var d = canvas.datasets.dset;
	d.src = 'http://somedomain.com';
	var p = new LzParam();
	p.addValue('profile_id', profile_id_param, true);
	d.setQueryString(p);
	d.sendRequest();
</script>

This is untested email code, but I think that's the gist of it.

Dave







-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-user/attachments/20080421/1598f2e0/attachment.html


More information about the Laszlo-user mailing list