I have witnessed a few people having trouble with their ActionScript import statements going missing inside an <mx:Script> tag within an mxml file.

This is usually due to the xmlns reference at the top of the page including the same import. To solve the problem, remove the xmlns reference that uses the same import.

For example:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
			   xmlns:s="library://ns.adobe.com/flex/spark"
			   xmlns:mx="library://ns.adobe.com/flex/mx"
			   minWidth="955" minHeight="600" xmlns:view="view.*">

	<fx:Declarations>
		<view:TestView/>
	</fx:Declarations>
	<fx:Script>
		<![CDATA[
			import view.TestView;
			private var testView:TestView;
		]]>
	</fx:Script>
</s:Application>

Because the TestView component is referenced in both mxml and ActionScript, the AS version of the import will be prone to disappearing. To solve the problem stick to either AS or mxml (not both) when using the component and don’t forget to remove the “xmlns:” reference.

Incidentally, this problem may have been resolved in FlashBuilder 4. I haven’t noticed any disappearing Imports since upgrading.

Another possible cause is referenced here.




Write a comment


Name




    
FlexBandit is based on WordPress platform, RSS tech , RSS comments design by Gx3.