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

Buttons targeting one movie clip from another

Explorer ,
May 31, 2017 May 31, 2017

Copy link to clipboard

Copied

Hi,

I currently have a button on the main timeline which targets an object in a movieclip.

This is what I have currently:

import fl.transitions.Tween;

import fl.transitions.easing.*;

btn1.addEventListener(MouseEvent.CLICK, ten);

function ten(e: MouseEvent) {

  new Tween(cat1_mc.circle1, "scaleX", Strong.easeOut, 0.0, 0.1, 2, true)

  new Tween(cat1_mc.circle1, "scaleY", Strong.easeOut, 0.0, 0.1, 2, true);

}

But now that button is in another movie clip called "controls_mc" - not on the main timeline.

What would be the path from the button in "controls_mc" to "cat1_mc.circle1 " ???

I've tried numerous recommendations but no result yet!!


Thanks

Views

261

Translate

Translate

Report

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 , May 31, 2017 May 31, 2017

If cat1_mc and controls_mc are at the same level, you would get from within controls_mc to cat1_mc.circle1 like this:

MovieClip(parent).cat1_mc.circle1

Votes

Translate

Translate
LEGEND ,
May 31, 2017 May 31, 2017

Copy link to clipboard

Copied

If cat1_mc and controls_mc are at the same level, you would get from within controls_mc to cat1_mc.circle1 like this:

MovieClip(parent).cat1_mc.circle1

Votes

Translate

Translate

Report

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 ,
May 31, 2017 May 31, 2017

Copy link to clipboard

Copied

That's great thanks. It works perfect.

However . . .  I've started getting this error message when I test the movie.

Are the two things related?

Votes

Translate

Translate

Report

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 ,
May 31, 2017 May 31, 2017

Copy link to clipboard

Copied

this error message sorry:

[SWF] reviewbuttons.swf - 17321 bytes after decompression

TypeError: Error #1009: Cannot access a property or method of a null object reference.

  at reviewbuttons_fla::MainTimeline/frame1()[reviewbuttons_fla.MainTimeline::frame1:6]

  at runtime::ContentPlayer/loadInitialContent()

  at runtime::ContentPlayer/playRawContent()

  at runtime::ContentPlayer/playContent()

  at runtime::AppRunner/run()

  at ADLAppEntry/run()

  at global/runtime::ADLEntry()

[UnloadSWF] reviewbuttons.swf

Test Movie terminated.

Votes

Translate

Translate

Report

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 ,
May 31, 2017 May 31, 2017

Copy link to clipboard

Copied

Look at line 6 of frame 1. Or do a debug test movie, and see where it breaks.

Votes

Translate

Translate

Report

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 ,
May 31, 2017 May 31, 2017

Copy link to clipboard

Copied

I'm just looking at that.

Seem to have a couple of things going on so just untangling that.

It'll be rewarding when it's sorted.

seems to be becoming my method of working in actionscript - do something, it doesn't work, works a bit, break it, fix ... eventually get something done!!!

Votes

Translate

Translate

Report

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
Adobe Employee ,
Jun 01, 2017 Jun 01, 2017

Copy link to clipboard

Copied

Thank you for posting here. Do come back and post your solution here after you have figured it out. This will help other users benefit from your experience.

Thanks,

Preran

Votes

Translate

Translate

Report

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 ,
Jun 05, 2017 Jun 05, 2017

Copy link to clipboard

Copied

LATEST

This is the solution as supplied by Colin Holgate above:

If cat1_mc and controls_mc are at the same level, you would get from within controls_mc to cat1_mc.circle1 like this:

MovieClip(parent).cat1_mc.circle1

So in my project I have the following code which works a treat:

btn1.addEventListener(MouseEvent.CLICK, ten);

function ten(e: MouseEvent) {

  new Tween(MovieClip(parent).cat1_mc.circle1, "scaleX", Strong.easeOut, 0.0, 0.1, 2, true)

  new Tween(MovieClip(parent).cat1_mc.circle1, "scaleY", Strong.easeOut, 0.0, 0.1, 2, true);

}

So to recap, the situation I have is this. There are 2 movie clips on the main timeline called "controls_mc" and "cat1_mc"

In controls_mc I have a button which I want to make an object in cat1_mc expand in size.

So the path to that is as above.


Specifically this:

new Tween(MovieClip(parent).cat1_mc.circle1, "scaleX", Strong.easeOut, 0.0, 0.1, 2, true)

new Tween(MovieClip(parent).cat1_mc.circle1, "scaleY", Strong.easeOut, 0.0, 0.1, 2, true);

Votes

Translate

Translate

Report

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