When mc1.foo = undefined; // funny KM bug...
Quote:
Originally Posted by blanius
Actually this is fine, I imagine though that pagenumber is just not set.
Friends,
I have been working on this same problem.
First of all you should know this thread came up with a Google search for "koolmoves movie clip event can't read movie clip variables"
I have a variable (msg = "Hello World!") declared in an actionscript statement located on a frame within my movieclip's timeline.
However, I want to call on that variable from an onClipEvent handler which is assigned to the movieclip itself.
If I assign a similar handler to a button on the other hand, there's no problem:
on(Press)
{
_root.txt1var = mc1.msg
}
...renders the familiar Hello World! statement in my root timeline text box.
However, the same statement when assigned to the movieclip does *not* produce results, and this bugged the heck out of me because I really do need actionscript in both parts of the MC (as a clip event and in the frames).
I finally figured out what was happening when I got curious and assigned this clip event to the movieclip:
on(Press)
{
_root.txt1var = this; // what's my name for crying out loud?
}
...and found out that mc1 has been thinking of itself as _level0.mc1
After that I had no problem accessing variable msg as _level0.mc1.msg.
A very minor discovery, to be sure, but one that bugged me for a good hour.
And I wonder if this explains why jimventola had so much trouble accessing a variable within a movieclip, even though (as blanius noted) it should have been entirely possible.
Anyone care? :-D