Posted by Sankar.G | Posted in AS3 | Posted on 12:40 AM
we can able to Create a Button in Flash using Action Script 3.0 with out do any design
code is Follows
AS3.0
Code:
var a:SimpleButton=new SimpleButton();
a.upState=up();
a.overState=over();
a.downState=down();
a.hitTestState=hit();
addChild(a);
a.addEventListener(MouseEvent.CLICK,fun);
function fun(e:Event)
{
trace("Checking");
}
function up()
{
var a1:Shape=new Shape();
a1.graphics.beginFill(0x0000ff);
a1.graphics.drawRect(0,0,175,125);
return(a1);
}
function down()
{
var a1:Shape=new Shape();
a1.graphics.beginFill(0xffff00);
a1.graphics.drawRect(0,0,175,125);
return(a1);
}
function over()
{
var a1:Shape=new Shape();
a1.graphics.beginFill(0xffff00);
a1.graphics.drawRect(0,0,175,125);
return(a1);
}
function hit()
{
var a1:Shape=new Shape();
a1.graphics.beginFill(0xffff00);
a1.graphics.drawRect(0,0,175,125);
return(a1);
}
we Have 4 state for button we want to define all the state in script to create a button
code is Follows
AS3.0
Code:
var a:SimpleButton=new SimpleButton();
a.upState=up();
a.overState=over();
a.downState=down();
a.hitTestState=hit();
addChild(a);
a.addEventListener(MouseEvent.CLICK,fun);
function fun(e:Event)
{
trace("Checking");
}
function up()
{
var a1:Shape=new Shape();
a1.graphics.beginFill(0x0000ff);
a1.graphics.drawRect(0,0,175,125);
return(a1);
}
function down()
{
var a1:Shape=new Shape();
a1.graphics.beginFill(0xffff00);
a1.graphics.drawRect(0,0,175,125);
return(a1);
}
function over()
{
var a1:Shape=new Shape();
a1.graphics.beginFill(0xffff00);
a1.graphics.drawRect(0,0,175,125);
return(a1);
}
function hit()
{
var a1:Shape=new Shape();
a1.graphics.beginFill(0xffff00);
a1.graphics.drawRect(0,0,175,125);
return(a1);
}
we Have 4 state for button we want to define all the state in script to create a button
Comments (0)
Post a Comment