I want to create a command that does the following ;: the user selects several items and runs a command that will copy that selection to another frame (prompt for frame number), create a slice around that selection, hide that content on frame 1, insert a hotspot and link that hotspot to the slice as a swap to the chosen frame. Once complete, the user should be able to hit F12 and see their swap in action. This is useful for things like button states, menus, tooltips, or other rollover popups.This would take many of the manual steps out of creating a swap.I think the behavior I'm trying to achieve should be built into Fireworks. The prototyping capabilities are in need of improvement from a workflow perspective..
I can use dom.copyToHotspot() to create the slice (very nice). I'd like to use the addBehavior("MM_swapImage directive to connect my hotspot to my slice. To understand how this works, I manually dragged from a hotspot to a slice and create a swap image and then I looked into the History panel and copy steps. I got the following
fw.getDocumentDOM().addBehavior("MM_swapImage(278038900,1,\"\",1,1)", "onMouseOver", -1);
The number '278038900' causes me some concern. When I look at the documentation for extending Fireworks, I see that that number refers to the target slice. The documentation say "target specifies the slice to which the behavior is attached. Pass1– for this value; all other values are used internally by Fireworks" which I take to mean pass -1 to refer to the selected hotspot/slice. Here's the rub, I don't want to refer to the select hotspot, I wanted to refer to the destination slice. I'm wondering if I could reference the destination slice using a selection array.
This brings up an issue with Fireworks scripting. It would be nice if I could give items an ID so that I could refer to those items by their ID rather than by the contents of a selection. I noticed that in the command 'dom.addSwapImageBehaviorFromPoint(where)', they say that I can select a slice and then refer to a hotspot at where (x,y). That might be an avenue to addressing my problem. But, finding something at point (x,y) is pretty fragile. If I add a hotspot, I'll know the x,y.