Jump to content

ActionScript Shape to MovieClip


xProteuSx

Recommended Posts

I have created a series of rectangles with rounded corners, using the following code:

 

import flash.display.Sprite;

import flash.display.Shape;

 

var hp_box01:Shape = new Shape();

hp_box01.graphics.beginFill(0x006600, 1);

hp_box01.graphics.drawRoundRect(0, 0, 200, 150, 12, 12);

hp_box01.graphics.endFill();

addChild(hp_box01);

 

All displays as it should.  However, I am now unable to do the following:

 

hp_box01.addEventListener(MouseEvent.CLICK, myFunction);

 

It won't let me add an even listener to this shape.  How can I convert the shape to a MC so that I can add event listeners to it?

Link to comment
https://forums.phpfreaks.com/topic/259293-actionscript-shape-to-movieclip/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.