I'm attempting to use CS4 (PC/Vista, if that matters) to create a SWF file that will basically act as a "library" of commonly used symbols. This SWF would be loaded at runtime by other SWFs, which could then use the symbols within it, including all art and code assets.
To accomplish this, I'm following the directions here: http://help.adobe.com/en_US/Flash/10.0_UsingFlash/WSd60f23110762d6b883b18f10cb1fe1af6-7dc9 a.html#WSd60f23110762d6b883b18f10cb1fe1af6-7dc6a
However, I'm having a strange issue...
My "Clock" symbol (it's a class defined in an external .as file, which extends MovieClip) has an internal "SecondHand" (also a symbol, but just a plain old MovieClip, no external .as file). I have exported both these symbols for runtime sharing as explained on the above page. And put the resulting SWF up on the web, so other SWFs can download it. (This is what I'm considering the "library" SWF.)
Then in my second SWF, I follow the directions as explained under "Link a shared asset to a destination document by entering the identifier and URL". In other words, I make a new symbol, right-click it and select "Properties", check "import for runtime sharing", type in the correct URL of the "library" SWF, and type in the correct Class name of my "clock" symbol from the library SWF. And also make sure the name of the symbol matches the name of the symbol in the "library" SWF.
I run the second SWF, and it does manage to load up the "library" SWF (I can verify this happens in the webserver logs), and the clock appears on the screen - complete with a second hand. However, I then get an error like this:
"Clock.as, Line 29: Access of undefined property secondHand."
secondHand.rotation = (secs % 60) * 6;
It's worth noting here that "secondHand" is an instance of the symbol "SecondHand". This instance was created when I made the "library" SWF in CS4. I double-clicked the "Clock" symbol in the library pane to edit it. Then I dragged a copy of the symbol "SecondHand" into that Clock. Then I used the "Properties" tab to make the name of that instance "secondHand". In other words, I probably did it exactly way you'd expect someone to do this. Nothing fancy or weird, as far as I can tell.
So... there's something very strange going on here. Somehow, my "secondHand" isn't being created when the "Clock" symbol is instantiated. My assumption was that since I dragged and dropped the symbol while I was editing the "Clock" MC, the code to create the "secondHand" instance would get attached to frame1 of the "Clock" symbol. But evidently not...
The thing that really hurts my brain, though is this: if the "secondHand" instance is never being created.... how come the second hand shows up on-screen? I mean sure, there could be some "cache as bitmap" stuff going on behind the scenes, but even so that just seems weird. The loading SWF obviously isn't creating the secondHand object. And yet you can see said object right there on-screen!
I've tried many searches for many variations of "flash runtime import symbol loading", but found nothing relevant. The above linked doc page just blithely assumes that everything will magically work out - as most of the Adobe docs so cutely do.
A) Am I doing something obviously wrong?
B) Has anyone else seen this before? (Known bug?)
C) Does anyone know of a workaround?
If anyone wants .FLAs/SWFs demonstrating the problem, I'm happy to provide. Just ask.
It's the weekend, but I'll try and check back on this topic once or twice a day just in case anyone answers.