A Event Problem
recently,i meet trouble ,below code:
package
{
import flash.display.sprite;
import flash.events.mouseevent;
import flash.display.shape;
public class test extends sprite
{
public function test():void{
this.graphics.beginfill(0xff0000);
this.graphics.drawrect(0,0,100,100);
}
public function clickevent(event:mouseevent):void{
trace("========================================");
}
}
}
in opinion, when clicked rectangle, there print line of "=",but didn't . seems actionscript didn't response mouse event, , don't know why, i'm confused ...
package
{
import flash.display.sprite;
import flash.events.mouseevent;
import flash.display.shape;
public class test extends sprite
{
public function test():void{
this.graphics.beginfill(0xff0000);
this.graphics.drawrect(0,0,100,100);
}
public function clickevent(event:mouseevent):void{
trace("========================================");
}
}
}
in opinion, when clicked rectangle, there print line of "=",but didn't . seems actionscript didn't response mouse event, , don't know why, i'm confused ...
sorry, code upper not correct, below code ,but didn't response mouse event
package
{
import flash.display.sprite;
import flash.events.mouseevent;
import flash.display.shape;
public class test extends sprite
{
public function test():void{
this.graphics.beginfill(0xff0000);
this.graphics.drawrect(0,0,100,100);
this.addeventlistener(mouseevent.click,clickevent);
}
public function clickevent(event:mouseevent):void{
trace("========================================");
}
}
}
package
{
import flash.display.sprite;
import flash.events.mouseevent;
import flash.display.shape;
public class test extends sprite
{
public function test():void{
this.graphics.beginfill(0xff0000);
this.graphics.drawrect(0,0,100,100);
this.addeventlistener(mouseevent.click,clickevent);
}
public function clickevent(event:mouseevent):void{
trace("========================================");
}
}
}
More discussions in Flex (Read Only)
adobe
Comments
Post a Comment