Working with selected objects

When an object is selected, either programmatically (for example, using the dom.selectAll() function) or by a user, you can return (get) or set the value of that object's properties using common notation that will work on various objects. In other words, you can write a command that will get or set the value of an object's properties whether the user selects a Text object, or an Image object, or any other recognized object. In Fireworks, a recognizable object is classified as one of the following element types:

To test whether a text block is selected, type the following code:

firstSelection = fw.selection[0];
if (firstSelection == "[object Text]"){
alert("I am a text block");
}

You can use the information in the following sections to return or set property values.

Note: The return value for a property may be null.


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/fireworks/8/fwextending/fw_02_69.htm