Link to home
Start Free TrialLog in
Avatar of SimonAdrian
SimonAdrian

asked on

How do I translate createEmptyMovieClip from AS2 to AS3

What would I do to get the same result as this AS2 creation of a box, if I should do it in AS3:

function container(target:MovieClip, boxWidth:Number, boxHeight:Number, cornerRadius:Number, fillColor:Number, fillAlpha:Number):Void {
      with (target) {
            beginFill(fillColor,fillAlpha);
            moveTo(cornerRadius,0);
            lineTo(boxWidth-cornerRadius,0);
            curveTo(boxWidth,0,boxWidth,cornerRadius);
            lineTo(boxWidth,cornerRadius);
            lineTo(boxWidth,boxHeight-cornerRadius);
            curveTo(boxWidth,boxHeight,boxWidth-cornerRadius,boxHeight);
            lineTo(cornerRadius,boxHeight);
            curveTo(0,boxHeight,0,boxHeight-cornerRadius);
            lineTo(0,boxHeight-cornerRadius);
            lineTo(0,cornerRadius);
            curveTo(0,0,cornerRadius,0);
            lineTo(cornerRadius,0);
            endFill();
      }
}
_root.createEmptyMovieClip("factbox", 4);
        factbox._x = zfbX;
        factbox._y = zfbY;

_root.container(factbox, 120, 200, 8, 0xffffff, 100);
Avatar of cwickens
cwickens
Flag of United States of America image

I haven't used AS3 very much so I can't re-write it for you.  The approach I would take is going through the help section of Flash.

It is pretty extensive; for example I found one issue you will have is the call to "_root" this reference, according to the Flash 9 docs was "Removed. The closest equivalent is the Stage, which serves as the root of the ActionScript 3.0 display list."
Avatar of SimonAdrian
SimonAdrian

ASKER

I have tried to go through the help section and its not worth much, thats why I am asking for help.
I  have to see working examples to understand code, but the help-section practically gives no examples.
ASKER CERTIFIED SOLUTION
Avatar of cwickens
cwickens
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here is a good link I found.

http://blogs.adobe.com/pdehaan/2006/07/creating_new_movieclips_in_act.html

And I was wrong, you were right, there is actually much more examples than Id experienced previously.
hey, no worries there...I wish it was that easy to get my wife to admit a mistake...lol

That link is where I found the example I posted above.