This would probably work as well.. Without changing the AS class.

 

--A

 

<?xml version="1.0" encoding="utf- 8"?>
<mx:Application xmlns:mx="http://www.adobe. com/2006/ mxml
<http://www.adobe.com/2006/mxml> " xmlns:inc="includes.*"
layout="absolute" >



<mx:Script>
<![CDATA[
import Includes.ClassTesting;
import mx.messaging.AbstractConsumer ;



public function ansT():void {
    ans.text = tester( frst.text,scnd. text);
}
]]>
</mx:Script> 



<inc:ClassTest />

 

<mx:Button x="52" y="192" label="Button" id="b1" click="ansT( )"
borderColor= "#10DD10" height="26" width="69"/> 
<mx:Text x="52" y="77" text="12" width="293" id="frst" visible="true" />
<mx:Text x="52" y="103" text="23" width="293" id="scnd" visible="true" />
<mx:Text x="52" y="155" text="34" width="293" id="ans" visible="true" /> 
</mx:Application>




 

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Laurent Cozic
Sent: Tuesday, August 12, 2008 4:10 AM
To: [email protected]
Subject: Re: [flexcoders] Class file in flex

 


You can't include a class within a class, you can only include "plain"
ActionScript files. So to fix your issue, you simply need to remove the
"package" and "class" statements from your actionscript file.

You should probably also remove the "import Inculdes.ClassTesting;". Also it
might compile, it won't make any sense once you convert the AS file.


--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com

--- On Tue, 8/12/08, litesh_b321 <[EMAIL PROTECTED]> wrote:

From: litesh_b321 <[EMAIL PROTECTED]>
Subject: [flexcoders] Class file in flex
To: [email protected]
Date: Tuesday, August 12, 2008, 10:59 AM

hi guys,
I am trying action script class in flex 3.0

I have action script class in "Inculdes\ClassTest ing.as" directory
which is situated inside src directory. 

See code below :
<?xml version="1.0" encoding="utf- 8"?>
<mx:Application xmlns:mx="http://www.adobe. com/2006/ mxml
<http://www.adobe.com/2006/mxml> "
layout="absolute" >
<mx:Script>
<![CDATA[
import Inculdes.ClassTesti ng;
import mx.messaging. AbstractConsumer ;
include "Inculdes/ClassTest ing.as";
public function ansT():void
{
ans.text = tester( frst.text,scnd. text);

}
]]>
</mx:Script> 
<mx:Button x="52" y="192" label="Button" id="b1" click="ansT( )"
borderColor= "#10DD10" height="26" width="69"/> 
<mx:Text x="52" y="77" text="12" width="293" id="frst" visible="true" />
<mx:Text x="52" y="103" text="23" width="293" id="scnd" visible="true" />
<mx:Text x="52" y="155" text="34" width="293" id="ans" visible="true" /> 
</mx:Application>

Error I am facing 

Severity and Description Path Resource Location Creation Time Id
Packages cannot be nested. [Generated code (use -keep to save): Path:
C:\Documents and Settings\pacific\ My Documents\Flex Builder
3\test\src\Inculdes \ClassTesting. as, Line: 2, Column: 1] test
Unknown 1218537300687 70656

Please help me out 
ThanX

 

 

Reply via email to