Monday, November 15, 2010

Passing Data From a Parent to Child SWF (Flash Variables)

Due to performance limitations within Xcelsius, it can be difficult to build large scale dashboards that are easy to manage. Fortunately, Xcelsius comes equipped with components that makes it easier to create a single “Parent” SWF which can load multiple “Child” SWFs inside itself. Perhaps the biggest challenge with this design architecture is enabling the “Parent” SWF to communicate with the “Child” SWF.

Luckily, with the use of Flash Variables and the SWF loader component, we can easily overcome this challenge.

How to do it:

1. Create your child.xlf

2. Establish a cell where your parameter will be passed. I used cell E6 in my example

3. Access the data manager within the child.xlf and add a Flash Variables connection

4. Add a range and give it a name. In my example I named the range “salesman”

5. Select the range in which the data parameter will be passed. Cell E6 is the range in my example

6. Create your parent.xlf

7. Setup a sheet within your parent.xlf as follows:

a) Enter the URL where your will store your child.swf in cell B5

b) Enter the name of the range that you used in your child.swf in cell B7 “salesman”

c) Reserve cell B9 for the parameter that is going to be passed

d) Enter the following formula in cell B11: =B5&”?”&B7&”=”&B9

8. Add a component to input your parameter – I chose to use a list box for my example

9. Bind the output destination of your component to cell B9

10. Add a SWF Loader component to the dashboard

11. Bind the Source URL to cell B11

There you have it. Although my example is fairly simple, this should get you moving in the right direction to developing larger scale dashboard applications that are easier to manage.

As always, feel free to download the source files.

If you enjoyed this post, make sure you subscribe to my RSS feed!

No comments:

Post a Comment