Inserting Flash elements

 < Day Day Up > 

Flash elements are installed through the Extension Manager. Dreamweaver adds Flash elements to documents in the same manner as the objects that are available on the Insert bar or the Insert menu (for details about working with Dreamweaver objects, see "Insert Bar Objects" in Extending Dreamweaver). By clicking on objects on the Insert bar or selecting menu options from the Insert menu, users can add strings of code to documents. Flash elements are available to users through the Insert bar or the Insert menu (meaning you can add a valid Flash element file that is already installed in the Configuration/Objects/FlashElements folder or one of its subfolders to the Insert bar or Insert menu). Extension developers can use the JavaScript function dom.insertFlashElement() in the object definition file to add available Flash elements to a document. When the user selects the Flash element object, Dreamweaver unpacks the SWC file, which contains Flash content (SWF file) and a file that details the parameters the user can edit. Dreamweaver then inserts the SWF file into the user's document.

Adding a Flash element to the Insert Bar

As with other objects, you add a Flash element to the Insert Bar using the button tag. However, a button tag for a Flash element must have both file and command attributes to add the element successfully to the document (see the button tag details in "Insert Bar Objects" in Extending Dreamweaver). Use the file attribute to tell Dreamweaver where the source file for the element resides relative to the Objects folder. Then, use the command attribute to tell Dreamweaver to use the dom.insertFlashElement() function when the user clicks the button on the Insert bar.

The following example shows the code to place in the inserbar.xml file (either as a child of the appropriate category or menubutton tag, depending on where you want the Flash element button to appear):

 <button   name="Navigation"  file="FlashElements\nav.swc"  command="dw.getDocumentDOM().insertFlashElement('nav.swc')" />  

NOTE

The image on the Insert bar for the Flash element is determined within the SWC file. Also, the button tag for a Flash element object must have a file attribute defined.


Adding a Flash Element to a menu

A Flash element can also reside on the Insert menu, or on other menus, in Dreamweaver. Use the JavaScript function dom.insertFlashElement() with the menus.xml file format (see "Menus and Menu Commands" in Extending Dreamweaver) to specify the Flash element menu item location. The following example shows how code within the menus.xml file makes a Navigation Flash element available on the Insert > Flash Element menu:

<menuitem name="Navigation" key=""command="dw.getDocumentDOM().insertFlashElement('nav.swc')" enabled="(dw.getFocus() != 'browser') && (dw.getDocumentDOM() != null && dw.getDocumentDOM ().getParseMode() == 'html')" />

     < Day Day Up > 


    Developing Extensions for Macromedia Dreamweaver 8
    Developing Extensions for Macromedia Dreamweaver 8
    ISBN: 0321395409
    EAN: 2147483647
    Year: 2005
    Pages: 282

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net