With
ASP.NET Turbine 7 you can include components from other Flash movies
and you can customize them at your own will. These examples demonstrate
the basic concepts about placing components and how easy it is to
inject external data to them.
These
demos use standard components included with the Flash MX editor.
Placing
a Component
This
example shows how to include a component located in a swf file.
To accomplish
the same results directly from the scripting interface, we could write
(component1.aspx):
//
include the component definition file
Turbine.Include("flistboxsymbol.swf");
// place the component
Turbine.Create("<place component='ListBox' pos='10,10'
instance='lst'>");
// now generate
the movie to the web browser
Turbine.GenerateFlash();
And the
final result is:
Passing
Parameters to Components
This
example shows how to pass parameters to a component. Turbine automatically
assumes defaults for any parameters that you don't define. On this
particular example, we are going to pass some values to the component
in the labels argument:
To accomplish
the same results directly from the scripting interface, one could
write (component2.aspx):
//
include the component definition file
Turbine.Include("flistboxsymbol.swf");
// place the
component and pass a value to the labels argument
Turbine.Create("<place component='ListBox' pos='10,10'
instance='lst'>
<param name='labels' value=\"['first', 'second',
'one more']\"/>
</place>");
// now generate
the movie to the web browser
Turbine.GenerateFlash();
And the
final result is:
Injecting
Data to Components
There
are components that can accept data sources, for example DataProvider
sources. For these components, Turbine supports a mechanism called
data injection which makes it very easy to pass data to them, without
any scripting effort.
This particular example shows how to inject data to a common ListBox
component: