SWC’s Within SWC’s Confirmed: It Works!

Spent more time than I’ve wanted to today trying to get this to work, and even managed to drag Chafic in with me part of the time. It’s a delicate process, and you can easily screw the whole thing up. Suddenly, I feel good about myself as a human being, claiming that I can create Flash components. Damn straight. EAT IT FLASH, I WIN!!!

“…so lemme get this straight. Your saying that in order for you to feel good about yourself in life, you just need to succeed in creating Flash components?”

SHUT UP, I WIN CHING WONG FONG TONG>>>.jasfjklasjdf.!!!!

:: whips out glock, aims towards celing :: *bang* *bang* *blam*

Yeah, sucka!

11 Replies to “SWC’s Within SWC’s Confirmed: It Works!”

  1. Some Bad Arse: “Well I’ve known that for months… hell, I did it in beta, but thanks for the lively update!”

    GOOD FOR YOU, MOFO! I STILL WIN!!!

  2. Hey Jester,

    So what was the problem? I saw your post on flashcoders. I spend a lot of time creating components and never really had the issue you described…so I am curious and also just want to know in case I run into it. In fact I am sure a lot of people are curious :) I don’t want to end up with a headache like you did.

    I always just put the components on the second frame of the component (with a stop on the first of course) like the documentation suggests and then compile the swc.

  3. I took the shotgun approach to make it work. Therefore, I’ll have to remove each step one by one to determine what it was that caused it to work, and didn’t work. For now, here’s what MAY have caused it to not work (guesses):
    – didnt’ have static var symbolName:String = “MyComponentsSymbolName”; at the top of my class
    – didn’t have static var symbolOwner:Object = my.package.ComponentClass; for my createClassObject to work
    – one of my classes wasn’t compiling in Flash, but the FLA worked just fine. I think the global Flash class path was pointing to an older base class.
    – one of my sub-components used to be a shared library, therefore had Export for runtime sharing. I don’t know why this would negatively affect it as it was exporting, not importing.

    The rest were minor things like you said, putting all of your components on frame 2, etc. I’ll post more once I’ve found the culprit, if any.

  4. Oh yeah… abbreviating class paths. Like, you use import your.package.Class, and then later just do Class as an alias to your class. For some reason, it wasn’t being put into the SWC. For now, I’m writing out all of my class paths. Looking at my SWF ASV’d, Flash just puts them all in there anyway…

  5. Well, there are 2 problems with that.

    First, this:

    import mx.controls.Button

    private var my_b:Button;

    Does NOT export the Button class you think… it’s using Flash’ intrinsic Button class. That was strike #1.

    #2, I thought that this:

    import mx.controls.Label;

    private var my_lbl:Label;

    Exported the class to the SWC, but I don’t know who or what figured that they just wanted for the base class. I consider both of the above explicit references to the class, therefore, Flash should export it, but it wasn’t happening. #2 is iffy, because I don’t know where the problem was in my case.

  6. The problem I’ve had with SWCs in SWCs, is later when you need to have that same “SWC” used by itself somewhere else in your .fla. For example, if you have a SWC with a Button or Combo box component embedded, then you need to use a Button or ComboBox somewhere else in the .fla. This caused *really strange things to happen, and I had to opt out of the SWC within a SWC campaign. I either now compile the source comp (not the swc) in with my SWC, or just document the dependancy.

  7. You might want to ASV (ActionScript Viewer) the source, and see if the #initclip order is changed or not; maybe since Flash see’s the other one, it causes it to be off. I doubt duped classes is the problem, but rather init order.

  8. I’ve been looking around for a while, and I would really appreciate any help you can give me.

    I’ve been looking for a way to set the loading order of classes. In other words, I have a class ( lets say scrollPane ) that uses another class ( lets say scrollbar ). I need to set the scrollbar class to load before the scrollpane class, and I’m really stuck. I used to use #initclip, but this does not work in class files.

    If there is any help you can give me, I would REALLY appreciate it.

    Thanks,

    Paul

Comments are closed.