How can I make a listener that calls a function everytime a movieclip’s height changes?
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?
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 .
On enterframe is too resource consuming…
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
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.
- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Interviewed on the Envato Notes blog
- Author was Featured
- Item was Featured
- Beta Tester
- Author had a File in an Envato Bundle
- Author had a Free File of the Month
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
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!
- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Interviewed on the Envato Notes blog
- Author was Featured
- Item was Featured
- Beta Tester
- Author had a File in an Envato Bundle
- Author had a Free File of the Month

