Adobe 38039927 - Fireworks CS3 - PC Extended User Manual page 271

Extending fireworks
Hide thumbs Also See for 38039927 - Fireworks CS3 - PC:
Table of Contents

Advertisement

RPCMethods.CreateAutoReleasePool();
var selObject = fw.selection.get(0);
RPCMethods.DestroyAutoReleasePool();
Calling the
CreateAutoReleasePool()
DestroyAutoReleasePool()
calling
DestroyAutoReleasePool()
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()
an object reference from the auto-release pool before exiting the auto-release block.
In this example, the reference to the object defined as
RPCMethods.CreateAutoReleasePool();
var selObject = fw.selection.get(0);
RPCMethods.RemoveFromAutoReleasePool(selObject);
RPCMethods.DestroyAutoReleasePool();
Now you can use the selObject object 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
releases any proxy objects it finds.
A simple RPC example
This example creates a 200 x 200 pixel rectangle in Fireworks when a button in a Flash application is clicked.
To build a Flash application that uses RPC to create a Fireworks object:
Download the supporting ActionScript stub files (a series of supporting ActionScript files) from the Adobe
1
website, you need to put them in your working directory (where the new FLA file will reside).
Open a new document in Flash.
2
In the first frame, add the following in the Actions panel to link the general fireworks stub file to the movie when
3
it is published:
#include "fwstubs.as"
Create a simple button which will activate the RPC script.
4
5
Insert the button in the first frame, in the middle of the Stage.
Attach the following ActionScript code to the button to activate the RPC code when the button is clicked:
6
on(press){
RPCMethods.CreateAutoReleasePool();
var fw = new Fireworks();
function marks the beginning of the auto-release block, and calling the
function marks the end. Any object allocated between these two calls is released by
. Using these two functions, you can write ActionScript code and not worry
function. The
RemoveFromAutoReleasePool()
selObject
ReleaseObject()
function manually removes
is removed:
function iterates through an object's properties and
ADOBE FIREWORKS CS3
267
Extending Guide

Advertisement

Table of Contents
loading

This manual is also suitable for:

Fireworks cs3

Table of Contents