263 posts
  • 8 Years of Membership
  • Antarctica
  • Author Level 2
  • Collector Level 1
+2 more
x360c
says

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

2309 posts
  • 8 Years of Membership
  • Affiliate Level 2
  • Author Level 2
  • Beta Tester
+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
  • 7 Years of Membership
  • Affiliate Level 1
  • Author Level 4
  • Brazil
+5 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
  • 7 Years of Membership
  • Author Level 2
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
  • 8 Years of Membership
  • Antarctica
  • Author Level 2
  • Collector Level 1
+2 more
x360c
says

On enterframe is too resource consuming…

107 posts
  • 7 Years of Membership
  • Author Level 2
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
  • 7 Years of Membership
  • Affiliate Level 3
  • Author Level 7
  • Collector Level 3
+8 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
  • Affiliate Level 4
  • Author Level 9
  • Collector Level 2
  • Top Monthly Author
+11 more
nepbits
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
  • 7 Years of Membership
  • Affiliate Level 3
  • Author Level 7
  • Collector Level 3
+8 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
  • Affiliate Level 4
  • Author Level 9
  • Collector Level 2
  • Top Monthly Author
+11 more
nepbits
says
by
by
by
by
by
by