Implicit Imports in MXML

You might wonder sometimes why import statements aren’t automatically inserted in MXML Script blocks. This is actually a feature in Flash Builder that uses the set of implicit imports defined by the MXML compiler.

If you add “-keep” to your additional compiler arguments, you can see the .as files generated for your MXML files. You’ll find the generated files in bin-debug/generated/<component name> Here’s the output for a Flex 4 MXML file.

import flash.accessibility.*;
import flash.debugger.*;
import flash.display.*;
import flash.errors.*;
import flash.external.*;
import flash.geom.*;
import flash.printing.*;
import flash.profiler.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
import mx.binding.*;
import mx.core.ClassFactory;
import mx.core.DeferredInstanceFromClass;
import mx.core.DeferredInstanceFromFunction;
import mx.core.IDeferredInstance;
import mx.core.IFactory;
import mx.core.IFlexModuleFactory;
import mx.core.IPropertyChangeNotifier;
import mx.core.mx_internal;
import mx.filters.*;
import mx.styles.*;
Share on Facebook