AudioJungle

Center animation in browser

9 posts
  • Has been a member for 4-5 years
  • Sold between 1 and 100 dollars
Jolt says

Hi

I have a problem, in my code i have the following lines

my_anim.x = stage.stageWidth / 2; my_anim.y = stage.stageHeight / 2;

now when i test it (ctrl+enter) the anim is centered corectly, but when i publish it, the animation is a little off. i believe that it has something to do with stage.scaleMode. but i don’t know.

if i use the movie’s resolution in the index.html (width =’30’, height = ‘30’) nothing happens, it loks normal, but if i use 100%(width = ‘100%’ height = ‘100%’) the animation is off.

Thanks, Jolt

3869 posts Love & Light
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Has been a member for 6-7 years
  • Author had a File in an Envato Bundle
  • Most Wanted Bounty Winner
  • Interviewed on the Envato Notes blog
  • South Africa
+3 more
digitalscience says
my_anim._x = (Stage.width - my_anim._width) / 2; 
my_anim._y = (Stage.height - my_anim._height) / 2; 
9 posts
  • Has been a member for 4-5 years
  • Sold between 1 and 100 dollars
Jolt says
my_anim._x = (Stage.width - my_anim._width) / 2; 
my_anim._y = (Stage.height - my_anim._height) / 2; 

i don’t think this will work. this just centers the animation if the registration point is in the corner, mines is in the center of the animation.

p.s. in my initian post when i said i publish it and it is off, i mean that in the html it is off

4493 posts
  • Exclusive Author
  • Author had a File in an Envato Bundle
  • Elite Author
  • Has been a member for 4-5 years
  • Sold between 100 000 and 250 000 dollars
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • India
+4 more
VF says

Did you checked how the stage aligned?

stage.align = StageAlign.TOP_LEFT;
?
by
by
by
by
by