Hi.
This is not a question, but an answer to the one I had until a few minutes ago. I found the solution and wanted to share it.
I developed a custom Flash embed dialog which does not use the file brower, but it crawles categories of databased files and then selects one and includes the classic embed code to the editor plus some custom attributes (_fileType, _fileId, _description) cause I need to track in database the file added to the document and show some other information to the user (as a database based description of the file).
The same did for image dialog and link dialog. Those worked fine, but with flash embeds the editor used to lose my custom atributes everytime the editor was loaded or Source code view was set and/or returned from.
I've found that as flash shows in the editting area a fake image (not the live flash movie), it needed to transform it to and from that fake image every time source code was needed and document contents was set.
FCK replaces the embed tag with an <img tag to display the fake image (a flash logo) and adds the real embed tag as an attribute to the img tag (so the real flash embed can be recovered when source code is needed).
That operation performs a clonation of the real embed object with all its attributes.
When working under IE, some attributes may not be properly cloned, so a fix is put there (thanks to Alfonso Martinez stands there).
An array with all necesary attributes needed to be cloned is created in order to iterate them and add them mannually to the cloned embed object (only when working in IE, as I do).
So, what I needed to do is simple. Just added my own custom attributes to the list and voila! They remained there even when the document contents was set and switched to and from source code.
In code:
Look for a function called ''FCKFlashProcessor.ProcessDocument".
There you will find a code like:
var oCloned = oEmbed.cloneNode( true ) ; // On IE, some properties are not getting clonned properly, so we // must fix it. Thanks to Alfonso Martinez. if ( FCKBrowserInfo.IsIE ) { var aAttributes = [ 'scale', 'play', 'loop', 'menu', 'wmode', 'quality' ] ; for ( var iAtt = 0 ; iAtt < aAttributes.length ; iAtt++ ) { var oAtt = oEmbed.getAttribute( aAttributes[iAtt] ) ; if ( oAtt ) oCloned.setAttribute( aAttributes[iAtt], oAtt ) ; } // It magically gets lost after reading it in oType oCloned.setAttribute( 'type', oType.nodeValue ) ; } var oImg = FCKDocumentProcessor_CreateFakeImage( 'FCK__Flash', oCloned ) ; oImg.setAttribute( '_fckflash', 'true', 0 ) ; FCKFlashProcessor.RefreshView( oImg, oEmbed ) ;
In the line:
var aAttributes = [ 'scale', 'play', 'loop', 'menu', 'wmode', 'quality' ] ;
it is neccesary to add the attributes you want to be keeped (cloned).
var aAttributes = [ 'scale', 'play', 'loop', 'menu', 'wmode', 'quality', '_myattr1','_myattr2'] ;
And that's all.
A more dynamic solution may be to iterate by DOM all the attributes of the original embed and check if they were already cloned to the clone version of the embed and add them if needed.
Hope this saves someone the time I spent here today.
Leonardo