flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Miko <marrtinm...@gmail.com>
Subject Re: RE:Can I Bind a SolidColor Fill Value?
Date Tue, 04 Feb 2014 09:45:02 GMT
Hi Chris,

first of all, I see what you are trying to do, but obviously I failed to
explain it clearly.

There are 2 important things you need to realize:

First, declaring a variable in mxml like:

    <fx:Declarations>
        <presenters:SliderView_Presenter id="presenter" />
    </fx:Declarations>

is equal to:

var presenter:SliderView_Presenter = new SliderView_Presenter();

so you need to reassing it to work properly, but I guess we are clear about
this part now.

Second thing you need to understand is the structure of components and
skins:

very rough representation in pseudo mxml:

<HSlider>
    <skin>
        //UI components of the HSlider skin
        <Button id="thumb">
            <skin>
              // UI components of the HSlider Thumb skin
            </skin>
        </Button>
    </skin>
</HSlider>

hope it's not confusing, but this is roughly what you'd have to do, if
you'd want to declared it in one mxml file
without the skinning machinery that does it for you.

This should give you a rough idea, of how things are structured and that,
if you need to pass an instance of
your presenter from your app, you need to pass it at least through a custom
HSlider, to be able to reach the
skin object, where you want to use it. I provided a code snippet from my
custom HSlider implementation.

If you want or need it, I can make you a demo app with comments, but I'm a
bit busy atm, so you'll have to
wait for a while.


> 1. My SliderView_Presenter class is passed a parameter from the host html
> page which determines the button colour. I could declare a variable of Type
> sparkSkin and using a switch function set this to one of several predefined
> skins depending on the parameter passed in. This variable could be bound to
> the skinClass property of the HSlider. This keeps everything within
> SliderView which is bound to SliderView_Presenter.
>
Might be doable, but imo too complicated.



> 2. My skin definition could change the colour of the Thumb graphic if it
> could be bound, or be passed, the parameter when set in
> SliderView_Presenter.
>
If I understand what you want to pass and where it should be passed, this
is exactly what I tried
to demonstrate and explain, but obviously horribly failed at it. :)



> Could I use a CSS Style and get/set the value? Skins are new to me and I'm
> floundering a little!

AFAIK this is not possible. Or at least not possible as a plain CSS
declaration in a .css file.
It might be doable by accessing component's CSSStyleDeclaration [1], but I
wouldn't go into that.
Seems a bit messy to me, but feel free to try it out.

[1]
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/styles/CSSStyleDeclaration.html
horribly

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message