Using CuteEditor as a FLASH selector

Last post 10-30-2008, 2:49 AM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  10-24-2008, 11:13 AM 45083

    Using CuteEditor as a FLASH selector

    Hello everyone,
     
    I've been using CuteEditor .Net for a month and I can only say it's a very powerful ans usefull tool to have on a website.
     
    I've use the editor as IMAGE selector, DOCUMENT selector and of course for text editing needs.
     
    Now, I would like to be able to use it as a FLASH selector.  In the page I am currently working on, what you have to know is that the editor is not seen by the user in the page.  In fact, I want to use it the same way as seen in the File Picker tutorial or like the Image selector tutorial.
     
    Curently, I am able to map a button using JavaScript and call : editor1.ExecCommand('InsertFlash'); and get the Insert Flash dialog.  Then, I need to get the path of the SWF file and then think of saving it in my database (I'l figured that out no problem).
     
    What I need to know from you guys is what Javascript propertites I have to set to get that path.
     
    For instance, in the image selector page, I use a JavaScript function like in the Image selector tutorial. :
     
    var editor1 = document.getElementById('<%=editeurBandeau.clientID%>');
    var editdoc = editor1.GetDocument();  
    var imgs = editdoc.images;
                    
    if(imgs.length>0)  
    { [..........] }
     
    What would it be to get the FLASH file path.  Will it be editdoc.flash ?  links ? getTagBy ?
     
    It is probably easy, I think I'm almost there !!!
     
    Thank you very much, any help or lead will be greatly apprectiated.
     
     
    JF Potvin
  •  10-30-2008, 2:49 AM 45193 in reply to 45083

    Re: Using CuteEditor as a FLASH selector

    Hi lanec,
     
     
    You can try this way,It also valid for other file types.
     

    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>

    <%@ Page Language="C#" %>

    <html>
    <head>
        <title>ASP and ASP.NET WYSIWYG Editor - Use CuteEditor as a document selector</title>
    </head>
    <body>
        <form runat="server">
            <table border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="10" nowrap>
                    </td>
                    <td width="20" nowrap>
                    </td>
                    <td valign="top" width="760">
                        <b>Use CuteEditor as a document selector</b>
                        <hr>
                        This example demonstrates how to use CuteEditor as a document selector.
                        <br>
                        <br>
                        <asp:TextBox ID="docFld" Width="300" runat="server" />
                        <input type="button" value="Pick a file" onclick="callInsertImage()" id="Change"
                            runat="server" name="Change">
                        <div>
                            <CE:Editor ID="Editor1" runat="server" Width="1" Height="1" AutoConfigure="None"
                                ShowHtmlMode="False" ShowPreviewMode="False" EnableContextMenu="false" ShowGroupMenuImage="False"
                                ShowBottomBar="False" BackColor="White" BorderColor="White">
                            </CE:Editor>
                            <br>
                        </div>
                    </td>
                </tr>
            </table>
        </form>

        <script language="javascript">
        function callInsertImage() 
        { 
       var editor1 = document.getElementById('<%=Editor1.ClientID%>');
                editor1.FocusDocument(); 
                var editdoc = editor1.GetDocument(); 
                editor1.ExecCommand('new');
                editor1.ExecCommand('insertdocument');
                InputURL();
                document.getElementById("docFld").focus();
        }   
       
        function InputURL()
        {
      var editor1 = document.getElementById('<%=Editor1.ClientID%>');
            var editdoc = editor1.GetDocument(); 
            var links = editdoc.getElementsByTagName("a");      
            if(links.length>0&&links[links.length-1].href!="") 
      { document.getElementById("docFld").value = links[links.length-1].href;      
      } 
      else
      {
       setTimeout(InputURL,500);
      }  
        }      
        </script>

    </body>
    </html>
     
     
    Regards,
     
    Ken
View as RSS news feed in XML