I did find topics on this, especially this one: (Edit: I can't post a link to the thread, as I've zero posts....)
But as a complete novice to AS, I'm still at a loss to understand it.
So can we work with a simple example?
On the stage I have a
movie clip in which I have a button, instance name
myButton.
Also on the stage (outside of the aforementioned clip) is a square, instance name
mySquare.
In my simple example, I want to change the alpha of the square to .5. My ActionScript (which is in inside the movie clip
with the button) works fine of course when the square is
in the same movie clip as the button.
Code:
myButton.addEventListener(MouseEvent.CLICK, blueSquare);
function blueSquare (evt:MouseEvent): void
{
mySquare.alpha = .5;
}
But I cannot find a rudimentary explanation or example of what the code should look like when I want to reference that square if it is
on the same level as the movie clip that has the code referencing it, i.e. is outside of the movie clip.
From another thread I found the following, which when changed for my use:
Code:
myButton.addEventListener(MouseEvent.CLICK, blueSquare);
function blueSquare (evt:MouseEvent): void
{
this._parent.mySquare.alpha = .5;
}
But I get a
_parent property no longer supported error. Out of frustration I've tried variations (this.parent....; _root.mySquare....; root.mySquare....)
I feel not knowing how to do something as rudimentary as this is holding back my learning the more advanced ActionScript. Your help will be greatly appreciated.