Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Object factory

Explorer ,
Sep 20, 2015 Sep 20, 2015

How do I get a function to collect a movieclip object, doing that after I catch it, it disappears from the scene ... but can be manufactured again, maybe from a clash between different object?

For example: I picked up the object, disappears from the site. When this same object touching a particular location it back to a position + =% visible, have to be collected again.

The most important topic is how can I make the object disappear when I pick up, and show up when it rings at another secondary object.

Thank you.

TOPICS
ActionScript
445
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

LEGEND , Sep 20, 2015 Sep 20, 2015

The number of frames has no bearing on the approaches I suggested.  In fact, those suggestions would need to occur in just one frame so you don't need to change anything in that regard.

Your explanation of when things disappear or not is not clear, but if touching the object that is supposed to disappear is necessary then you probably only want to change the alpha property from 0 to 1 and vice versa.  An invisible object cannot be interacted with but one that has its alpha set to 0 can be.

Translate
LEGEND ,
Sep 20, 2015 Sep 20, 2015

One way would be to switch its visible property between true (visible) and false (not visible).  Another way would be to remove the object from the display list (removeChild) and then either add it back in, (addChild) or create a new instance of it.  If there is only going to be one of these objects at any time then you are likely better off just have the one and playing with its appearance.

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
Explorer ,
Sep 20, 2015 Sep 20, 2015

But my project takes place in a single frame.

Let's say I create a square and put his name mast, and the object that should go away when a character starts. Should he take the object disappears, and when it touches the mast returns visibility.

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
LEGEND ,
Sep 20, 2015 Sep 20, 2015

The number of frames has no bearing on the approaches I suggested.  In fact, those suggestions would need to occur in just one frame so you don't need to change anything in that regard.

Your explanation of when things disappear or not is not clear, but if touching the object that is supposed to disappear is necessary then you probably only want to change the alpha property from 0 to 1 and vice versa.  An invisible object cannot be interacted with but one that has its alpha set to 0 can be.

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
Explorer ,
Sep 20, 2015 Sep 20, 2015

But woe if I would have to use code to set the value of alpha? Because the only way I use this function is the object of the menu at the top right side.

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
LEGEND ,
Sep 20, 2015 Sep 20, 2015
LATEST

You set the alpha value by setting it to equal 1 (opaque) or 0 (transparent)

mast.alpha = 0;  // can't see it

mast.alpha = 1; // fully visible

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