Adobe 65011817 Extended User Guide - Page 294
RPCMethods.ReleaseObject, Creating auto-release blocks, Accessing proxy objects
UPC - 883919157368
View all Adobe 65011817 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 294 highlights
Last updated 12/8/2009 EXTENDING FIREWORKS 290 Cross-Product Extensions RPCMethods.ReleaseObject() Usage RPCMethods.ReleaseObject(Object) Arguments Object The name of the object to release from memory. Returns Nothing. Description Releases an object from memory. This function searches the specified object and all its properties for proxy objects. If proxy objects are found, they are released from memory. Creating auto-release blocks Rather than constantly tracking which objects to release and how to release them, you can define blocks of code where you access the Fireworks DOM. In these blocks of code, the ActionScript stubs can keep track of all the proxy objects allocated. Then, at the end of the block of code, a single command will automatically release all objects allocated in the block. Here is an example: RPCMethods.CreateAutoReleasePool(); var selObject = fw.selection.get(0); RPCMethods.DestroyAutoReleasePool(); Calling the CreateAutoReleasePool() function marks the beginning of the auto-release block, and calling the DestroyAutoReleasePool() function marks the end. Any object allocated between these two calls is released by calling DestroyAutoReleasePool(). Using these two functions, you can write ActionScript code and not worry about memory management. Accessing proxy objects If you want to access a proxy object outside of an auto-release block, you must use the RemoveFromAutoReleasePool() function. The RemoveFromAutoReleasePool() function manually removes an object reference from the auto-release pool before exiting the auto-release block. In this example, the reference to the object defined as selObject is removed: RPCMethods.CreateAutoReleasePool(); var selObject = fw.selection.get(0); RPCMethods.RemoveFromAutoReleasePool(selObject); RPCMethods.DestroyAutoReleasePool(); Now you can use the selObjectobject outside the auto-release block. Note: You must remember to release the selObject object when you are done with it. Additionally, you can nest auto-release blocks, that is, you can create an auto-release block and then call a function that creates its own auto-release block. The ReleaseObject() function iterates through an object's properties and releases any proxy objects it finds.