ElementIDs

From MegaZine3
Jump to navigation Jump to search
{{#if: | }} {{#if: | }}{{#if: * elementids.swf | }}{{#if: | }}
Plugin: ElementIDs
[[File:{{{image}}}]]
Name ElementIDs
Since version

{{{version}}}

Files
  • elementids.swf
Related plugins

{{{related}}}

The ElemendIDs plugin is meant for developers. It allows referencing elements in the book by using an id set in the book's XML definition.

Attributes

Elements

=== id ==={{#if: String |

  • Type: String}}{{#if: |
  • Valid values: {{{valid}}}}}{{#if: |
  • Default: {{{default}}}}}{{#if: |
  • Overrides: {{{overrides}}}}}{{#if: |
  • Aliases: {{{alias}}}}}{{#if: |
  • Version: {{{version}}}}}

The id of the element, i.e. the name by which to refer to it.{{#if: |

  • See also: {{{see}}}}}

Examples

Defining an element with an id:

<book>
    <chapter>
        <page>
            <img id="namedElement" .../>
        </page>
    </chapter>
</book>

Referencing the element in AS3, the quick and dirty way:

// megazine is the reference to the engine which runs the XML definition above.
var namedElement:IElementProxy = IElementIds(megazine.pluginManager.getPlugin("elementids")).getElementById("namedElement");

Safe way (avoiding possible errors):

// megazine is the reference to the engine which runs the XML definition above.
var elementIds:IElementIds = megazine.pluginManager.getPlugin("elementids") as IElementIds;
if (elementIds) {
    // ElementIds plugin is loaded
    var namedElement:IElementProxy = elementIds.getElementById("namedElement");
}
MegaZine3 Plugin-related articles
Plugins Anchors · Background Sounds · Batchpages · Bookmarks · Console · ElementIDs · Gallery · Google Analytics · Help · JavaScript · Keyboard Navigation · Links · NavigationBar · Options · Overlays · Password · PDFLinks · Print · PrintPDF · SWFAddress· Search · Sidebar · Slideshow · Titles
Plugin Articles Writing a plugin · Writing a plugin II · Plugin development

{{#if: | |}}