Similar Threads:
1.trouble with for loop changing mc properties
Hi,
I have 7 of mc's in a frame, each named box+number (box0, box1, box2,
box3,...).
I have the following script under the actions of this frame:
var BoxLoop;
for (var i=0; i<7; i++) {
BoxLoop = "box" + i;
_root.BoxLoop._visible = false;
}
In theory, the mc's should dissappear one by one when I export the
movie, but they don't.
Any clues? Thanks!
2.Set mc._x property value from an array
Im trying to import x and y points from a external file ("getDevices.txt") and
use them to position a new MovieClip from the library in a loop.
I know I could be using _root.attachMovie("box", "box_mc"+i, 110+i,
{x:something, y:something});
I've just been playing with this all day and tried many different methods, but
still no luck. I think my problem may be in the setup of the array and not how
its presented to _root["box_mc"+i]._y
Because if I create a new array like ypos = new Array(20, 40); it worked
The Actionscript code (Cant seem to find any tags, so I just used Quote)
//get devices and loop through
var mydevices:LoadVars = new LoadVars();
mydevices.load("getDevices.txt");
var ypos = [];
mydevices.onLoad = function() {
for (i=0; i<2; i++) {
//ypos = new Array([this["y"+i]]); //How is this different as
oppose to the next line?
ypos.push([this["y"+i]]);
trace(ypos);
_root.attachMovie("box", "box_mc"+i, 110+i);
_root["box_mc"+i]._y = (ypos);
}
};
I get the values 400 and 200 in the output screen, but need help assinging
them to the objects x and y position.
This is the contents of the text file
&NumofDevices=5&animal0=cow&y0=400&x0=-50&animal1=horse&y1=200&x1=300
Any ideas? where are the AS tags in these forums?
-Jason.:confused;
3.Trouble using variable to get mc property
I'm creating a rollover effect for a collection of 12 mcs so that on mouseover
the clip grows a little bit. This involves locating the x and y coordinates
each clip, and to do so I've tried to farm the job out to a few variables and
one function, so that the onRollOver event simply sets the variables and calls
the function.
It's not working. Flash seems to be implying that I can't use a variable
(string type) to get a property -- ie. variable._x rather than myInstanceName._x
Is this correct, or is my error elsewhere?
Hope you can help.
(By the way, there will of course be an onRollOut event as well. Just getting
this bit to work first.)
Thanks;
Rick
(Here's the code):
// SET UP VARIABLES
var clipPositionx:Number = 0;
var clipPositiony:Number = 0;
var clipName:String = "";
// FUNCTION TO BE CALLED
function rolloverClip() {
clipPositionx = clipName._x;
clipPositiony = clipName._y;
clipName._xscale = 110;
clipName._yscale = 110;
clipName._x = clipPositionx - 4;
clipName._y = clipPositiony - 4;
}
// ROLLOVER ACTIONS
claire_mc.useHandCursor = true;
claire_mc.onRollOver = function() {
clipName = "claire_mc";
rolloverClip();
}
4._x & _y of mc relative to stage and not parent mc
Good Morning all,
I?m trying to get the _x and _y of a movieclip relative to the stage where
said movieclip is nested inside several others, which have been dynamically
rotated.
I?m hoping there is an easy way to get this rather then taking the route of
reverse engineering the position and rotation of each parent movieclip in order
to calculate it.
Thanks in advance
Will
5.Controlling an mc timeline with a mc._x
6. Motion tween stopping when property is changed
7. Tween with changing alpha properties and motion
8. loop throug mc on stage and change properties?