Copy link to clipboard
Copied
I have a question I hope someone here can either answer or point me in the right direction to find an answer myself.
I have a set of symbols like so:
I would like to be able to close any given symbol and have the symbols below move up along their y-axis. Lets say I close symbol3, then symbols 4, 5, and 6 would move up like so:
I know I could create an animation for each and every instance however that's a lot of separate frames ( 279936 I think ) and I would think there is an easier way.
Any thoughts on how to go about this?
Hi.
An approach would be:
- Put all of your thumbs inside of a container called something like "column";
- Create a function that positions the thumbs in a column layout;
- Assign a click listener to the column container;
- Check if the clicked object (e.target) is the close button;
- Remove the thumb that the close button belongs to;
- Run again the function that positions the thumbs.
Like this (without using advanced layers mode, supposing that is AS3 and that the close button has its mouseChildren pr
...Copy link to clipboard
Copied
HTML5 or Action Script?
You will need a conditional on your click event.
Copy link to clipboard
Copied
Hi.
An approach would be:
- Put all of your thumbs inside of a container called something like "column";
- Create a function that positions the thumbs in a column layout;
- Assign a click listener to the column container;
- Check if the clicked object (e.target) is the close button;
- Remove the thumb that the close button belongs to;
- Run again the function that positions the thumbs.
Like this (without using advanced layers mode, supposing that is AS3 and that the close button has its mouseChildren property set to false):
AS3 code:
import flash.display.MovieClip;
import flash.events.MouseEvent;
function createColumn(offset:Number = 0):void
{
for (var i:uint = 0, total:uint = column.numChildren; i < total; i++)
{
var child:MovieClip = column.getChildAt(i) as MovieClip;
child.y = (child.height + offset) * i;
}
}
createColumn(10);
column.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void
{
if (e.target.name == "button")
{
e.currentTarget.removeChild(e.target.parent);
createColumn(10);
}
});
FLA download:
animate_cc_as3_resize_column.zip - Google Drive
Regards,
JC
Find more inspiration, events, and resources on the new Adobe Community
Explore Now