263 posts
  • Has been part of the Envato Community for over 6 years
  • Located in Antarctica
  • Has sold $100+ on Envato Market
  • Has collected 1+ items on Envato Market
+1 more
x360c says

How can I make a listener that calls a function everytime a movieclip’s height changes?

2309 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 10+ members
  • Has sold $100+ on Envato Market
  • Has been a beta tester for an Envato feature
+5 more
theflyingtinman says

Since movieclips don’t change their height unless something in your code tells them to why don’t you just call your “height change handler” from the code that changes the movieclip’s height?

4140 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Located in Brazil
+3 more
tsafi says
How can I make a listener that calls a function everytime a movieclip’s height changes?

i am missing some details here, if you meant you want your move clip to stay at the same position since you animate the movie clip or you are going full screen the best way is to align your movie clip x/y this way you x/y will be fix.

Let’s say you want fix center Middle.x = 0; Middle.y = 0;.

Middle.x = stage.stageWidth * .5; add + or – .

Middle.y = stage.stageHeight * .5; add + or – ..

you can also Tween it so it will always move back to the original position “center” no mater what size your movie clip .

GL .

107 posts
  • Has been part of the Envato Community for over 6 years
  • Has sold $100+ on Envato Market
the_asman says
How can I make a listener that calls a function everytime a movieclip’s height changes?

not a listener but should work

Code

263 posts
  • Has been part of the Envato Community for over 6 years
  • Located in Antarctica
  • Has sold $100+ on Envato Market
  • Has collected 1+ items on Envato Market
+1 more
x360c says

On enterframe is too resource consuming…

107 posts
  • Has been part of the Envato Community for over 6 years
  • Has sold $100+ on Envato Market
the_asman says

yup but if what you are doing isnt that much then it should be fine

or you can use timer class

but its pretty much your only options

1234 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 50+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 50+ items on Envato Market
+5 more
MBMedia says

there is no listener for that, but tinman had a point, that will only ever change if you have code that changes it.

so anywhere where you have my_mc.height = anything put right after it a call to a function, or dispatch your own event, then you’ll be catching it just fine.

3256 posts
  • Has referred 100+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+9 more
ParkerAndKent says

But if the object you’re watching extends the MovieClip class just override its height setter and add the call to your function into it…

Easy and clean… and OOP

1234 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 50+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 50+ items on Envato Market
+5 more
MBMedia says
But if the object you’re watching extends the MovieClip class just override its height setter and add the call to your function into it… Easy and clean… and OOP

About half of my files actually do that somewhere, so why didn’t I think of telling him that? Been a long day I guess. Nice catch :)

EDIT : oooh, post 300!

3256 posts
  • Has referred 100+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+9 more
ParkerAndKent says
by
by
by
by
by
by