No, I have never heard of this. I've only ever used dynamic techniques
to evaluate types. If I need to use functions in classes, I include the
classes. If they're included in a separate SWF, I call them there. If
it's a matter of suppressing warnings, I go back to step one. If I need
local instance, I go dynamic.
In all honesty, I can't say I can see why this would ever be necessary.
I mean, I completely understand excluding code out of a SWF when you're
not using it or if it's supplied by a parent SWF. I use this technique
every day to slim down code. But:
1. If I need to use ColorTween, I dynamically evaluate it at runtime so
that I don't need to include it in my child SWF (this is actually better
since I can do something else if the parent doesn't have it for some
reason).
2. Use the generic type *. Whatever's in the parent, use it. Depends on
how important the declaration is.
3. Dynamically determine the type at runtime so that if the parent has
it, I can check to see if it is a ColorTransform and, if so, use it.
The first step allows me to make my own instances, regardless of which
SWF I need to use them in. The second step allows me to reference
existing instances, regardless of which SWF they're in. The third step
allows me to check if, either in step 1 or step 2, the type is correct.
I don't think even think there's a fourth option in this list, is there?
That being said, the only time I could ever see myself needing a class
exclusion is if I simply said something to the effect of:
public var myVar:ColorTransform;
....in foo.fla. But that, to me, seems very dependent and kind of
pointless. If you happen to run this SWF in a parent that doesn't have
ColorTransform...well, that's the end of that, no?. I mean, whatever is
depending on ColorTransform is basically out of luck and you get a
run-time error, is that right?. Using dynamic evaluation, the parent may
or may not have it and your code can continue to run and not toss it's
cookies every time it needs to use a ColorTransform instance. Also,
ColorTransform can be used from another SWF, and not be hard-bound to a
parent instance (pre-existing condition). The only thing is, you simply
don't specify that myVar has to be a ColorTransform, you determine that
at runtime.
If I understand this correctly, you may as well include the
ColorTransorm class in foo.fla because if you're code is depending on it
(using the above declaration), and you need to load the parent to use
it...what's the difference from including it? If it's not required, why
declare it or declare a strong type?
Maybe you can provide me with another example of how this is intended to
work. Like I said, I understand the concept but I fail to see the
practical use. I guess this may explain why I've never heard of
this...the situation where this would be required has simply never come up.
Patrick
[quoted text, click to view] swrb1977 wrote:
> Hi Patrick,
>
> AFAIK, it's just called class exclusion. I'm not surprised if you're not
> familiar with this feature, there is no check box in the IDE to click or
> anything and it's only mentioned once in the documentation. This is how it
> works:
>
> Let's say you have an FLA called foo.fla and let's say that foo.fla uses a
> class called "com.foo.ColorTween". You can tell Flash to publish this FLA
> without the ColorTween class by creating an XML file called "foo_exclude.xml"
> and placing it in the same directory as the FLA. The contents of
> foo_exclude.xml looks like this:
>
> <excludeAssets>
> <asset name="com.foo.ColorTween" />
> </excludeAssets>
>
> When you publish the FLA, Flash will look for this XML file. If it find it, it
> excludes the classes listed ("com.foo.ColorTween").
>
> Now, if you try to run this SWF, the player will freak out when it tries to
> use this class. However, if you loaded this SWF into a parent SWF that already
> contained that class, it would be able to run fine.
>
> This is described pretty well in this link
> (
http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?
> context=LiveDocs_Parts&file=00000817.html). I think Colin Moock also discusses
> the topic in Essential ActionScript 2.
>
> In terms of what I am trying to do specifically, I need to export some library
> items as a swc, but not include the base classes. I won't go too much further
> into why... I don't want to further confuse the issue.
>
> Hope this clarifies things a bit.
>