Integrating swfobject.js Javascript with xforms

classic Classic list List threaded Threaded
8 messages Options
DL
Reply | Threaded
Open this post in threaded view
|

Integrating swfobject.js Javascript with xforms

DL
This post was updated on .
I haven't quite grasped the difference between (a) embedding raw javascript and (b) embedding xforms javascript in an xform view

I've read here ..

http://wiki.orbeon.com/forms/doc/developer-guide/xforms-javascript-integration

and here ..

http://wiki.orbeon.com/forms/doc/developer-guide/xforms-actions/actions-script-action

Now if I embed this javascript into my <head> in view.xhtml I can write (embed) flash object into div container "myContent" in <body>.

<script type="text/javascript" src="swfobject/swfobject.js"> </script><script type="text/javascript"> swfobject.embedSWF("swfobject/test.swf", "myContent", "300", "120", "9.0.0", "expressInstall.swf"); </script>     
But .. the xforms recommended way doesn't work .. just shows the expressInstall.swf object


[edit:
javascript code block below updated to latest attempt  ..
and changed <xforms:script (which was an error)
to <xxforms:script
but it still doesn't work]</i>



           
<xxforms:script type="text/javascript" src="swfobject/swfobject.js">
</xxforms:script>
<xxforms:script type="text/javascript">   
swfobject.embedSWF("swfobject/test.swf", "myContent", "300", "120", "9.0.0", "expressInstall.swf");
</xxforms:script>   
What steps am I missing?

DL
Reply | Threaded
Open this post in threaded view
|

Re: Integrating Javascript with xform

DL
This post was updated on .
I'll expand a bit further on my post above ..

There is a widely used javascript swfobject.js for embedding flash objects
The download link is here ..

http://code.google.com/p/swfobject/downloads/list

The uncompressed swfobject_src.js is probably easier to read ..

http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject_src.js

Now this works fine in html .. but as soon as I try to embed in a simple xform it fails.

...

I remember posting a question on the swfobject forum some time ago ...

http://groups.google.com/group/swfobject/browse_thread/thread/e38beaabaff58607/332b23793b963027?lnk=gst&q=xforms#332b23793b963027

and the answer was ..

SWFObject was designed to work with HTML and XHTML (HTML written in an XML syntax but served as "text/html", not "application/xhtml+xml").  XForms are not HTML.
However other orbeon users have managed to deploy swfobject.js .. e.g. here ..

http://orbeon-forms-ops-users.24843.n4.nabble.com/where-is-xforms-js-to-be-found-td3032609.html#a3034486

but I don't understand how swfobject works using xbl.

....

I can only guess that swfobject.js (as written for html) cannot access the xform DOM probably at the point where the flash object has to be written into the div container in the xform.

Any tips on using swfobject to embed flash components in xforms?

....

p.s. further troubleshooting info ..

If in firefox I navigate to the location of test.swf it displays o.k. .. full size in browser canvas ..

http://localhost:8080/orbeon/mytestapp/swfobject/test.swf

Reply | Threaded
Open this post in threaded view
|

Re: Re: Integrating Javascript with xform

Erik Bruchez
Administrator
> I haven't quite grasped the difference between embedding raw javascript and
> xforms javascript in an xform view

What we have is a JavaScript API to dispatch events and get/set
control values from the browser, and a way to call JavaScript upon
XForms events.

>> SWFObject was designed to work with HTML and XHTML (HTML written in an XML
>> syntax but served as "text/html", not "application/xhtml+xml").  XForms
>> are not HTML.

That's a pretty uninformed answer! The main thing to keep in mind that
your JavaScript runs in the browser, on an HTML DOM that has been
transformed by the XForms engine from the original XHTML+XForms
source. So swfobject.js runs on the browser DOM, which is plain HTML.

> but I don't understand how swfobject works using xbl.

Mmh, you don't say what you want to do in the first place. Do you need
any XForms integration at all?

-Erik


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
DL
Reply | Threaded
Open this post in threaded view
|

Re: Re: Integrating Javascript with xform

DL
This post was updated on .
Thanks .. I guess I'll keep swfobject separate from xforms (but merged content seen on the same xforms document).

Mmh, you don't say what you want to do in the first place. Do you need
any XForms integration at all?
Aims: 

- to build flash and html5 components (e.g. charts - but not FusionCharts) to integrate with the rendered xforms view and which do not require such a deep knowledge of java or xhtml.

- to embed flash components (via swfobject) into view.xhtml as proxy components to call PHP (and other) services whose return is seen in the xforms view.

- to intercommunicate between the orbeon xform DOM and the plain html DOM elements

...
This very old thread says it all ... (however openlaszlo is just one framework I can use to creates the flash (or other media) components .. haxe.org is another)

http://orbeon.uservoice.com/forums/27-general/suggestions/118-add-some-jazzed-up-demo-s-like-openlaszlo

I don't want to resort to using iframes to merge the different sources into one browser view.

Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Integrating Javascript with xform

Erik Bruchez
Administrator
DL,

That makes sense.

-Erik

On Sun, May 20, 2012 at 3:46 AM, DL <[hidden email]> wrote:

> Thanks .. I guess I'll keep swfobject separate from xforms (but merged
> content seen on the same xforms document).
>
>
>
>> Mmh, you don't say what you want to do in the first place. Do you need
>> any XForms integration at all?
>>
>
> *Aims:*
>
> to build components (e.g. charts - but not FusionCharts) to integrate with
> the rendered xforms view and which do not require such a deep knowledge of
> java.
>
> to use flash components as a portal to call PHP services seen in the xforms
> view.
>
> to intercommunicate between the orbeon xform DOM and the plain html DOM
>
>
> This very old thread says it all ... (openlaszlo is just one framework I can
> use to creates the flash components)
>
> http://orbeon.uservoice.com/forums/27-general/suggestions/118-add-some-jazzed-up-demo-s-like-openlaszlo
>
> I don't want to resort to using iframes to merge the different sources into
> one browser view.
>
>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Integrating-swfobject-js-Javascript-with-xforms-tp4644977p4646759.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
DL
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Integrating Javascript with xform

DL
This post was updated on .
If anyone hits this thread and wishes to follow up embedding flash objects here is a summary ..

- swfobject scripts can be added in view.xhtml to coexist with other code

- to communicate between browser javascript and embedded flash object use the
ExternalInterface class in creating the flash object (I use the openlaszlo framework running on localhost tomcat to create the *.swf files - SOLO mode - but haxe.org is another framework for compiling flash components)

- import flash.external.ExternalInterface;  // in actionscript

- after embedding flash object in a div (via swfobject notation) data can be passed flash object <--> xform in browser via javascript

- flash object can be a proxy component to access different services and components

- I can post a basic example if required.


[Later Edit]

Here is one example showing data exchange between flash and wrapper html using ExternalInterface class in the compiled flash component:-

http://demos.learnswfobject.com/external-interface/dynamic.html

The host for swfobject can be view.xhtml in any orbeon app.



Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Integrating Javascript with xform

Erik Bruchez
Administrator
DL,

Thanks for sharing!

-Erik

On Wed, May 23, 2012 at 1:45 PM, DL <[hidden email]> wrote:

> If anyone hits this thread and wishes to follow up embedding flash objects
> here is a summary ..
>
> - swfobject scripts can be added in view.xhtml to coexist with other code
>
> - to communicate between browser javascript and embedded flash object use
> the
> ExternalInterface class in creating the flash object (I use the openlaszlo
> framework running on localhost tomcat to create the *.swf files - SOLO mode
> - but haxe.org is another framework for bflash components)
>
> - import flash.external.ExternalInterface;  // in actionscript
>
> - after embedding in a div data can be sent flash object <--> xform in
> browser via javascript
>
> - flash object can be a proxy component to access different services and
> components
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Integrating-swfobject-js-Javascript-with-xforms-tp4644977p4652113.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
DL
Reply | Threaded
Open this post in threaded view
|

Integrating swfobject.js Javascript with xforms .. replace orbeon banner

DL
Here is one example I've tested using swfobject integrated with xform.

Aim:  to replace Orbeon form banner (*.png file) with a flash banner

In /resources/config/theme-examples.xsl

edit line 70:  <xhtml:div class="orbeon-banner">

to add id="embed-banner" .. <xhtml:div id="embed-banner" class="orbeon-banner">

Now swfobject script placed inside <head></head> tags can target the div id="embed-banner" to write in a flash object which in the example below is same width and height (212 x 42) as orbeon banner but can be any size.   The flash object just overwrites the orbeon default banner.

swfobject.embedSWF("swfobject/banner.swf", "embed-banner", "212", "42", "10.0.0", "expressInstall.swf", flashvars, params, attributes);