ElementIDs

From MegaZine3
Jump to: navigation, search
Plugin: ElementIDs
Name ElementIDs
Files
  • elementids.swf

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.

Contents

[edit] Attributes

[edit] Elements

id

The id of the element, i.e. the name by which to refer to it.

[edit] 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
Personal tools
Namespaces
Variants
Actions
Navigation
documentation
miscellaneous
Toolbox