Understanding the control bar skinning

4 views
Skip to first unread message

Danny

unread,
Aug 23, 2010, 11:23:43 AM8/23/10
to reops
I've been looking at extending one of the stock control bars, and I'm
a bit confused about how the swf components are referenced in the
application. The "dynamic" instantiation of elements is slick, but it
makes it that much more difficult to trace through the code, so I'm
stalled.

For buttons, lets say, the playPause Button, the button is defined
inside the fla file as a PlayPauseButton symbol of type movieclip,
then exported as com.realeyes.osmfplayer.controls.PlayPauseButton in
the exported swf.

- that symbol is instantiated in the playPause_mc layer in the CS4 fla
file,
- a playPause_mc object is declared in Flex in ControlBar.as as a
ToggleButton, but never instantiated,
- listeners are added to handle events on those control bar sub
objects,

I'm not an experienced CS4 guy, and I can't figure out how that
playPause_mc "layer" in the controlBar object in the SWF is seen by
the flex class without getting instantiated. If I breakpoint inside
the ControlBar.as, I can see some of the elements are legit objects,
and for the playPause_mc it is a PlayPauseButton type which is not
even defined in the flex project.

Could someone point me to the linkage between the component in the
layer, and the flex object (and where the missing, probably dynamic),
instantiation takes place.

thanks,
Danny

turbidity

unread,
Aug 23, 2010, 11:38:37 AM8/23/10
to reops
Hi Danny,

The class for the control bar is linked to the control bar symbol in
the FLA. The controls in the control bar have instance names that
correspond to the property names you're seeing. By putting those
control instances on the stage, they get instantiated when the SWF
runs, and the instance name maps those instances to the properties
declared in the class. To do it this way, we have the Declare Stage
Instances option in the AS3 publish options turned to false. Otherwise
Flash tries to createe properties on the class for named instances on
the stage.

Nils

Danny

unread,
Aug 23, 2010, 2:49:38 PM8/23/10
to reops
thanks Nils,

my added component was not showing up in the control bar properties,
but I had forgotten to name the instance in my fla, so despite the
exporting/importing of the control bar swf, I couldn't see the
reference to the new property.

--Danny
> > Danny- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages