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,fillAl pha);
moveTo(cornerRadius,0);
lineTo(boxWidth-cornerRadi us,0);
curveTo(boxWidth,0,boxWidt h,cornerRa dius);
lineTo(boxWidth,cornerRadi us);
lineTo(boxWidth,boxHeight- cornerRadi us);
curveTo(boxWidth,boxHeight ,boxWidth- cornerRadi us,boxHeig ht);
lineTo(cornerRadius,boxHei ght);
curveTo(0,boxHeight,0,boxH eight-corn erRadius);
lineTo(0,boxHeight-cornerR adius);
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);
function container(target:MovieClip
with (target) {
beginFill(fillColor,fillAl
moveTo(cornerRadius,0);
lineTo(boxWidth-cornerRadi
curveTo(boxWidth,0,boxWidt
lineTo(boxWidth,cornerRadi
lineTo(boxWidth,boxHeight-
curveTo(boxWidth,boxHeight
lineTo(cornerRadius,boxHei
curveTo(0,boxHeight,0,boxH
lineTo(0,boxHeight-cornerR
lineTo(0,cornerRadius);
curveTo(0,0,cornerRadius,0
lineTo(cornerRadius,0);
endFill();
}
}
_root.createEmptyMovieClip
factbox._x = zfbX;
factbox._y = zfbY;
_root.container(factbox, 120, 200, 8, 0xffffff, 100);
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.
I have to see working examples to understand code, but the help-section practically gives no examples.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
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.
That link is where I found the example I posted above.
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."