PDA

View Full Version : Shared runtime library w/components problem



petkusj
July 18th, 2008, 02:30 AM
I've been feeling full of myself lately, but I think I might have run into a trap of my own devising and I'd really appreciate some help.

For the last year or two, I've been working on a Star Trek LCARS-themed website. The Flash 6 version of it can be found at http://www.personal-log.com/ I've since been working on the Flash 9 version (there's a sample at http://personal-log.com/newlog/logs.html; click SHOW PREFS).

I created all my components in a library file and I set the export and runtime sharing for the components. I'm able to import them into a new document and use them without a problem, until I create a symbol (the components work fine on the main timeline), insert the components and then link to a class.

When I test, I get: Error #1009: Cannot access a property or method of a null object reference.

Here are the complications: the library file and the file I'm working on use the same Document class (it defines variable that all the various pieces of the website will use). The components are based on the UIComponent (yeah, big mistake because I never take advantage of the UIComponent).

If, after I import my components, I break the link to the library swf, everything works fine. If the symbols I create aren't linked to a class (I just use frame scripts), everything works fine.

I guess my question is basically this: should I be creating components in the library or is this just asking for trouble? Should I only be importing the pieces of the components, but not the components themselves? I've assumed that it's more efficient to include the components into the runtime swf but I'm struggling to get this to work.

Thanks, Jennifer

BTW, just for grins, I created super stripped down components in a stripped down library, and imported them into a stripped down FLA, both sharing the same stripped down document class. I usually get the 1009, but not always.

petkusj
July 18th, 2008, 12:57 PM
Further thoughts: I know that I'm definitely getting a conflict with the document class of my library and the document class of the file that's using the components imported from the library. All the 1009 and 1056 errors refer to the document class.

I was wondering if the applicationDomain of the shared swf is the problem. If I load an swf, I know that I have to set the applicationDomain to the current domain, but I'm not specifically loading an swf (it's kind of done behind my back).

I can also try not linking to a document class in my library, but I usually put instances of the components I'm creating on the library's stage, just to check them out, and the instances are accessing properties defined in the document class. I suppose I could do some error catching, only do something if the document class property is available, it's just that then I won't be able to test out the component in the library.

Argh! Jennifer

PS Programming makes me talk like a pirate!

petkusj
July 18th, 2008, 01:48 PM
I went ahead and exported my library without a document class. I was surprised that it compiled, even though the components are all checking the document class for color definitions. I was able to import these into another file, but I ended up with the same 1099 error.

Then I went ahead and loaded the library.swf in a previous frame and also tried setting the applicationDomain of the loaded swf to the current domain, but I still get a 1099. Actually, I get a lot of flashing because it cycles between the two frames because the stop() was never registered on frame 1.

Jennifer

petkusj
July 18th, 2008, 05:09 PM
I may be getting close to an answer and the problem may be a confluence of events. I think one of my components has a bug that's generating the 1009 error. That shouldn't be a problem unless I actually use the component, but I put instances of each component on the stage as I test them, so when I test a movie, there's a copy of the buggy component. If I just wiped the stage clean, I'd only encounter the problem if in the destination .fla I actually used the component. Also, I had one import declaration wrong, which oddly didn't always cause the component to fail. And finally, I was having problems using the components imported from the library if they were exported on the first frame. By unchecking this (and giving myself a blank frame before the components were instantiated) I may have solved my problems.

Of course, I've thought that many times before and still had another problem bite me in the butt.

Jennifer