Hi Mike,

Was kinda hoping someone from Adobe would respond, but oh well..
Maybe it's because I'm used to only call methods when needed (in the creation 
process).

class MyClass {

    private var __prop:String = "";
    private var __hasInitialized:Boolean = false;

    function MyClass() {

        if(__prop.length > 0) {
            setProp();
        }
        __hasInitialized = true;
    }

    private function setProp() {
           // do something with __prop
    }

    function set prop(val) {
        __prop = val;
        if(__hasInitialized) setProp();
    }

}

So setProp is only called:
- from constructor when __prop has a value (because "set prop" is called before 
the constructor)
- from the setter, but only if the constructor has run first (__hasInitialized 
== true).

Looks like I'm gonna have to get used to the new workflow a bit more (using 
flags and invalidate methods, etc..).

Right now I'm not doing much in styleChanged, just checking which style has 
changed and act accordingly.

Was mainly trying to figure out where's the best place to check for graphical 
skin changes and what takes place in what order (which 
methods are called and in what order), that kind of stuff.
The docs aren't really helping when it comes to graphical skins for custom 
components and AS3.
Graphical skinning seems to be mainly focused around mxml and programmatic 
skinning around AS.

But, as always, I wanna do things the hard way, hehe.. :-)

Thanx again for your time.

regards,
Muzak

----- Original Message ----- 
From: "Michael Schmalle" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, March 06, 2007 12:40 PM
Subject: Re: [flexcomponents] styleChanged called twice during initialization 
process


>> - Are those 2 calls really necessary/useful?
>
> I wouldn't trust anyones answer on this except the framework engineers. :)
>
> I would say, if you find there is a lot of processing happening in your
> styleChanged() method, regardless of the null being passed two times, create
> a flag and invalidateProperties(). Then in that call do your processing.
>
> Although this might happen on the same queue, I haven't tested it. If so, it
> still might be a good idea, could you give an example of what you normally
> do in styleChanged(). It's for repainting, setting styleName's etc.
>
>
> In my experience with the Flash 9 Player, you are going to have to do a lot
> of sloppy coding before you will hit the players performance.
>
> Peace, Mike
>


Reply via email to