Flasher Archive
[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]
Subject: | RE: [flasher] Variable setting help |
From: | Paul Willoughby |
Date: | Thu, 01 Feb 2001 13:42:52 -0000 |
Ezra Schwartz wrote on 31 January 2001:
> I'm having a problem figuring something out which maybe
> someone could help
> me with. From a Movie Clip I'm trying to set a variable on
> the main stage,
> where the variable name is put together by an expression, and
> the Movie
> Clip's _x and _y possitions are used. I found that to set a
> variable like
> this with an expression on the main stage you first need to
> Tell Target
> _level0 then set the variable
You don't need to use Tell Target to set variables in other timelines in
either Flash 4 or 5. If you need to set a variable on the main stage from a
movie clip you can either use (assuming this isn't a loaded movie):
_root.myVariable = whatever expression
or
_level0.myVariable = whatever expression
_root refers to the main timeline of whatever level you're working in. So if
you load a movie into level1 all the clips _root refernces refer to the main
timeline of level 1, *not* the timeline of the original movie. If you're
working with a lot of load movie stuff it's probably best to store and
access your variables with _level rather than _root
If you're working in Flash 4, then putting /: in front of a variable will
put it on the main timeline:
SetVariable: "/:myVariable" = whatever expression
> but this won't work in this
> case because I no
> longer have access to the _x and _y of the movie clip, unless
> I name the
> instance which is impossible in this case. I hope I have
> made my problem
> clear and that someone can help me out. Thanks in advance!
>
> Ezra
I'm not sure of the exact problem here, why can't you name the instance of
the movie clip? If you really can't, the workaround would be to catch the x
and y position in the movieclip and send it to the main timeline with
something like (pseudo code):
_root.myMcX = this._x;
_root.myMCY = this._y
hth
paul
[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]