1
votes

I have a Flex 4.5.1 application which loads another swf file (as a module which was written and compiled in Flex 3.2 SDK).

I get the illegal override error (see title) the moment the 3.2 swf file is loaded.

Is this even allowed or do modules loaded have to be compiled with the same version?

If so, can you please explain why?

1

1 Answers

3
votes

An IllegalOverride error happens when a class overrides a function from its parent incorrectly. An example of this would be if you extended the Sprite class and created this function:

override public function addChild(value:Number):DisplayObject
{
    ....
}

This is an illegal override because the method signature is not the same (it needs to accept a DisplayObject, not a Number).

It is most likely the case that FlexModuleFactory changed between 3.2 and 4.5. If FlexModuleFactory is used in your parent SWF then its definition exists in the ApplicationDomain. If you load your child SWF into the same ApplicationDomain and that child SWF contains a class that extends FlexModuleFactory, then it will use the version from 4.5 that already exists in the ApplicationDomain rather than the 3.2 version that the child was compiled with.

You might be able to get around this issue by loading your child SWF into a new ApplicationDomain, meaning that it will not share any of the Class definitions from the parent SWF.