Try below code as an example of creating button in action script project:
Note : Here(in this example) we are using/extending sprite class only (i.e. flash.display.Sprite), you can also use fl.controls.Button and other Flash IDE readymade controls (if you have Flash CS Installed). package { import flash.display.*; import flash.events.MouseEvent; public class ActionScriptProject extends Sprite { private var myBtn:myButton; public function ActionScriptProject() { myBtn = new myButton( ); myBtn.x = 150; myBtn.y = 150; addChild(myBtn); myBtn.addEventListener(MouseEvent.CLICK,Button_onClick) } public function Button_onClick(evt:MouseEvent):void { trace("Button_onClick"); if(myButton(evt.target).scaleX == 1) { myButton(evt.target).scaleX = 1.2; myButton(evt.target).scaleY = 1.2; } else { myButton(evt.target).scaleX = 1; myButton(evt.target).scaleY = 1; } } } } import flash.display.*; import flash.events.MouseEvent; internal class myButton extends Sprite { public function myButton() { graphics.clear(); graphics.beginFill(0xff0000, 1); graphics.drawRect(0,0,100,30); graphics.endFill(); addEventListener(MouseEvent.ROLL_OVER,onRollOver); addEventListener(MouseEvent.ROLL_OUT,onRollOut); } private function onRollOver(evt:MouseEvent):void { trace("onRollOver"); graphics.clear(); graphics.beginFill(0xffff00,1); graphics.drawRect(0,0,100,30); graphics.endFill(); } private function onRollOut(evt:MouseEvent):void { trace("onRollOut"); graphics.clear(); graphics.beginFill( 0xff0000 , 1 ); graphics.drawRect(0,0,100,30); graphics.endFill(); } } Regards, Natwar Garg From: flex_india@googlegroups.com [mailto:flex_in...@googlegroups.com] On Behalf Of Gerald Anto Fernando Sent: Wednesday, December 15, 2010 3:47 PM To: flex_india@googlegroups.com Subject: Re: [flex_india:32320] Is therer any way to Run a Action Script Class ok suppose i want to create a button in action script in Action Script project how to do it. if i declare var b:button = new button() , button class is not available Thanks&Regards, Gerald A On Wed, Dec 15, 2010 at 1:17 PM, Natwar Garg <natwar.g...@hytechpro.com> wrote: Flex components are meant for flex projects only, If you want to use any flex framework(UI/Display) controls, you need to use Flex framework (frameworks\libs\frameworks.swc) , depending upon your project requirement you need to choose Project Type (Flex Project/ActionScript Project). ActionScript Project are used when we don't want to use any readymade Flex UI Controls, main purpose is to make lightweight Application. Regards, Natwar Garg From: flex_india@googlegroups.com [mailto:flex_in...@googlegroups.com] On Behalf Of Gerald Anto Fernando Sent: Wednesday, December 15, 2010 11:31 AM To: flex_india@googlegroups.com Subject: Re: [flex_india:32312] Is therer any way to Run a Action Script Class thanx Natwar i have created AC project. now i have a doubt. in my action script class i want to have a Alert Control but i cant import mx.control package here suppose i want to create a button means what can i do? but in Flex Project we can easily import all things is there any way to do that? Thanks&Regards, Gerald A On Tue, Dec 14, 2010 at 4:08 PM, Natwar Garg <natwar.g...@hytechpro.com> wrote: Create/use Actionscript Project instead of Flex Project, to run/use as class without MXML Application. Regards, Natwar Garg -----Original Message----- From: flex_india@googlegroups.com [mailto:flex_in...@googlegroups.com] On Behalf Of Gerald Anto Sent: Tuesday, December 14, 2010 11:40 AM To: Flex India Community Subject: [flex_india:32300] Is therer any way to Run a Action Script Class Hello Friends, is there any way to run a separate Action Script class without linking of MXMl Application Class Thanks&Regards, Gerald A -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_in...@googlegroups.com. To unsubscribe from this group, send email to flex_india+unsubscr...@googlegroups.com <mailto:flex_india%2bunsubscr...@googlegroups.com> . For more options, visit this group at http://groups.google.com/group/flex_india?hl=en. -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_in...@googlegroups.com. To unsubscribe from this group, send email to flex_india+unsubscr...@googlegroups.com <mailto:flex_india%2bunsubscr...@googlegroups.com> . For more options, visit this group at http://groups.google.com/group/flex_india?hl=en. -- Thanks & Regards, A Gerald -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_in...@googlegroups.com. To unsubscribe from this group, send email to flex_india+unsubscr...@googlegroups.com <mailto:flex_india%2bunsubscr...@googlegroups.com> . For more options, visit this group at http://groups.google.com/group/flex_india?hl=en. -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_in...@googlegroups.com. To unsubscribe from this group, send email to flex_india+unsubscr...@googlegroups.com <mailto:flex_india%2bunsubscr...@googlegroups.com> . For more options, visit this group at http://groups.google.com/group/flex_india?hl=en. -- Thanks & Regards, A Gerald -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_in...@googlegroups.com. To unsubscribe from this group, send email to flex_india+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/flex_india?hl=en. -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_in...@googlegroups.com. To unsubscribe from this group, send email to flex_india+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.