Groups | Blog | Home
all groups > flash actionscript > september 2004 >

flash actionscript : accessing an outside variable from a MC


garroyo
9/21/2004 11:22:24 PM
NSurveyor
9/21/2004 11:38:53 PM
on(release){
this.newVar = PATHTOVARIABLE.otherVar;
// change otherVar, to the name of the variable
// change newVar to the name you want the variable to be called
// replace the blank line with either the absolute or relative path
// of the variable.
// (If the variable was made on the main timeline, then replace the
PATHTOVARIABLE with _root)
// If you don't know what the path is, paste this code onto
// your button. And then, highlight PATHTOVARIABLE, and click the
// button that looks like an aimer on a gun (target) Now, browse through
// the different levels of your movie until you find the location that
holds
// your variable.
}
garroyo
9/21/2004 11:52:55 PM
I'm actually accessing a function, but I wouldn't expect that to make much
difference.

I tried what you suggested .

on (press) {
_root.thisTrack(2);
}

but I created this error

256 levels of recursion were exceeded in one action list.
This is probably an infinite loop.

any more suggestions?
speedlab1
9/21/2004 11:55:56 PM
var i:Number = 0;

this.movieClip_mc.myButton_btn.onRelease = function() {
trace(i);
}

garroyo
9/22/2004 12:56:42 AM
mat
9/22/2004 1:11:15 AM
It seems like you button is working, but your function is broken. It is
going into an infinite loop. I would make sure that you are incrementing all
counters etc.

Mat


[quoted text, click to view]

abeall
9/22/2004 1:23:14 AM
just to make things more complicated for you:

if you append your function with _global it can be reference without ever appending anything again.

AddThis Social Bookmark Button