263 posts
  • Antarctica
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Sold between 100 and 1 000 dollars
x360c says

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

2309 posts
  • Beta Tester
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 100 and 1 000 dollars
  • United States
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
  • Bought between 1 and 9 items
  • Brazil
  • Exclusive Author
  • Has been a member for 6-7 years
  • Referred between 1 and 9 users
  • Sold between 5 000 and 10 000 dollars
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 a member for 6-7 years
  • Sold between 100 and 1 000 dollars
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
  • Antarctica
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Sold between 100 and 1 000 dollars
x360c says

On enterframe is too resource consuming…

107 posts
  • Has been a member for 6-7 years
  • Sold between 100 and 1 000 dollars
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
  • Bought between 50 and 99 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 50 and 99 users
  • Sold between 50 000 and 100 000 dollars
  • United States
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
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Beta Tester
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
+4 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
  • Bought between 50 and 99 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 50 and 99 users
  • Sold between 50 000 and 100 000 dollars
  • United States
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
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Beta Tester
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
+4 more
ParkerAndKent says
by
by
by
by
by
by