Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

load MC problem with x y

Status
Not open for further replies.

jefargrafx

Instructor
May 24, 2001
273
US
okay.

I got this movie clip that grows in height using oncliptevent:

onClipEvent (enterFrame) {
setProperty ("_root.curtainMC", _y, _y == 0);
setProperty ("_root.curtainMC", _height, _height += 5);
}


as you see this works in the standalone movie. but when I insert it using loadmovie into a blank clip

it grows in both directions, I just wanted the curtain to fall. Yes It would be easier using tweens but that's not a hard, is it.

give it a ponder and let me know


jef
 
okay I got it working,

but I don't understand why it does, can someone look at this code and explain the x y deal within movie clips to me.

here's what fixed it.

onClipEvent (enterFrame) {
setProperty (this, _y, _y += 5);
setProperty (this, _height, _height += 5);
setProperty (this, _y, _y -= 2.5);
}

now it load in the main movie and grows in one directions.

go figure

need a phd in _x and _y, it might help

thanks jef
 
Hey Jef - couple of things about your script...

The first line with...

_y+=5;

moves your clip down the screen five pixels (_y goes from 0 at the top of the screen and the value increases as you head for the bottom - bit backwards but it's what we're stuck with).

Your third line with...

_y-=2.5;

is moving your clip back up the screen 2.5 pixels. Which is kind of 2 steps forward, one step back!

If you lose the third line and just make the first one:

setProperty (this, _y, _y += 3);

you'll get the effect but it's more efficient (I put 3 in instead of 2.5 because sometimes fractions of pixels screw things up).

The _height property could equally well be replaced by _yscale (the vertical size of your clip).
 
cool, thanks for the walk through,

although, do you know if Flash calculates pixels differently winthin a movieclip as it does on the stage.

say x = 100
y = 100 on the stage

is this the same thing as

x = 100
y = 100

in a clip named anything??

thanks jef
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top