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
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
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
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?
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.
Copy link to clipboard
Copied
Look at line 6 of frame 1. Or do a debug test movie, and see where it breaks.
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!!!
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
Copy link to clipboard
Copied
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);