tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/270-using-a-preloaderfla-seems-to-be-screwing-up-my-injectionRobotlegs: Discussion 2018-10-18T16:35:24Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/57387792011-03-04T15:49:56Z2011-03-04T15:49:56ZUsing a preloader.fla seems to be screwing up my injection<div><p>The only explanation that I can come up with is that, for some
reason,<br>
your preloader compiles in some of the classes that get injected
into<br>
in your main application.</p>
<p>To test that theory, you can enable the "export to SWC" option
in<br>
Flash Pro's publish settings. If that fixes the problem, you
should<br>
investigate which classes the preloader compiles in and why it
does<br>
so.</p>
<p>If it doesn't fix the problem, I'm afraid I can't help without
you<br>
posting some sort of reduced test-case exhibiting the problem.</p></div>Till Schneidereittag:robotlegs.tenderapp.com,2009-10-18:Comment/57387792011-03-04T15:54:09Z2011-03-04T15:54:10ZUsing a preloader.fla seems to be screwing up my injection<div><p>I'll be damned, that fixed it.</p>
<p>OK, I think I see what gets compiled in - since I'm casting the
main application as its own document class, I had to import that
class into the preloader. I may not need to do that, I'll poke
around.</p>
<p>Thanks for your help! If it's not too much trouble, can you
explain how you knew that? Why would having a class get compiled in
break injection like that?</p></div>mbilokonskytag:robotlegs.tenderapp.com,2009-10-18:Comment/57387792011-03-04T15:54:15Z2011-03-04T15:54:15ZUsing a preloader.fla seems to be screwing up my injection<div><p>Till is almost certainly on the right lines here.</p>
<p>2 other thoughts I had:</p>
<p>1) Any chance your swf is being published differently? It's as
if the metadata is being stripped... is it definitely the same swf
that behaves fine if you run it outside the preloader?</p>
<p>2) Any chance you're not holding on to your context? Or that
your context is being overwritten (and thus is available for
garbage collection)? That normally causes silent 'something that
should have happened didn't happen' errors, but it's worth
checking.</p></div>Straytag:robotlegs.tenderapp.com,2009-10-18:Comment/57387792011-03-04T15:58:18Z2011-03-04T15:58:18ZUsing a preloader.fla seems to be screwing up my injection<div><p>If the preloader didn't have the export swc stuff going on then
it would have stripped the [Inject] tags from the classes it
compiled. First definition of a class wins - and there's your
solution :)</p>
<p>Nice one Till!</p></div>Straytag:robotlegs.tenderapp.com,2009-10-18:Comment/57387792011-03-04T16:03:23Z2011-03-04T16:03:23ZUsing a preloader.fla seems to be screwing up my injection<div><p>Thanks Stray!</p>
<p>Apart from causing mischief with your application, casting the
main<br>
application to its real document class also defeats the purpose
of<br>
your preloader: It's probably bigger than the application it is<br>
preloading because it should contain the entirety of that, plus<br>
whatever you're using to show loading progress.</p>
<p>To work around that, either cast to an interface (which will
then also<br>
be duplicated in the preloader and the main application, but being
an<br>
interface, it won't bloat the preloader by more than a few bytes)
or<br>
simply treat is as a Sprite if you don't need to interact with it
in<br>
any application-specific way.</p></div>Till Schneidereittag:robotlegs.tenderapp.com,2009-10-18:Comment/57387792011-03-04T16:04:16Z2011-03-04T16:04:17ZUsing a preloader.fla seems to be screwing up my injection<div><p>Excellent, what great support! You fixed my problem and gave me
some great pointers. Much appreciated! :)</p></div>mbilokonsky