Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
0

Change y-axis of other symbols

Community Beginner ,
Nov 26, 2018 Nov 26, 2018

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:

sym1-6open.png

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:

sym3closed.png

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?

212
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 26, 2018 Nov 26, 2018

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

...
Translate
LEGEND ,
Nov 26, 2018 Nov 26, 2018

HTML5 or Action Script?

You will need a conditional on your click event.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 26, 2018 Nov 26, 2018
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines