tags:

views:

22

answers:

1

Hello Friends,

We implemented one concept in Flex and now would like to integrate with JavaScript. Earlier we integrated an Applet code but now, we developed the concept in Flex, however, I am unable to integrate the concept in java script.

Can anyone help me out with the procedure to integrate flex swf file in java script ?

Here is my earlier java script code :

var file=gup('query'); //document.write(file); var prevFile=gup('prevFileName'); //document.write(prevFile); document.write("");

document.write(""); function gup( name ) { name = name.replace(/[[]/,"\[").replace(/[]]/,"\]"); var regexS = "[\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return ""; else return results[1]; }

Thanks in advance.

A: 

I'm not exactly clear what you're trying to do… But you'd need to use the ExternalInterface class to let JavaScript code call into Flex, and Flex code call into JavaScript. For example, to call a JS function from Flex:

var result:* = ExternalInterface.call("myFunction", arg1, arg2)

Also, if you're trying to embed the SWF into the HTML page, SWFObject is your friend.

David Wolever
Thanks David, I think I need to refer SWFObject concept.
serenity
Ah, ok — I wasn't entirely sure from your question. If this answers your question, can you hit the checkmark beside it to "accept" the answer?
David Wolever
Actually, I think SWFObject option is only to play swf video files. I verified the documentation of SWFObject and its purely for video files but am not sure whether it help me to integrate my project.
serenity
It'll work with any `.swf` file (like, for example, the ones generated by Flex Builder). Just follow the instructions here: http://code.google.com/p/swfobject/wiki/documentation
David Wolever