3 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+2 more
hitek says

I have a full screen flash web site and I am trying to load an external swf file into myLoader clip. The swf file loads in the middle of the stage like it should, but when i resize the page the swf moves to the bottom right and does not stay in the middle of the stage. How do I fix this? Here is my actionscript.. Thanks!

Stage.showMenu = false; Stage.align = “TL”; Stage.scaleMode = “noscale”; Stage.addListener( this ); function onResize(){

myLoader._x = Stage.width / 2 – myLoader._width / 2; myLoader._y = Stage.height / 2 – myLoader._height / 2; onResize();

}
116 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+5 more
encryptme says

If myLoader contains animations starting from outside of the actual height or width, your intended height or width will no longer be the same.. thus causing it to not appear in the center of the screen. You should create a mask covering the stage size in that external swf, so when its loaded in the main swf movie it will read the correct size.

or you can just set a fake width & height for myLoader in the onResize, like :

Stage.showMenu = false; 
Stage.align = “TL”; 
Stage.scaleMode = “noscale”; 
Stage.addListener( this ); 

function onResize(){
myLoader._x = Stage.width / 2 – 600 / 2; 
myLoader._y = Stage.height / 2 – 300 / 2; onResize();
}
3072 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Had an item featured on Envato Market
+5 more
wickedpixel says

one question… why the function onResize() is recalling itself?
function onResize(){
myLoader._x = Stage.width / 2 – 600 / 2;
myLoader._y = Stage.height / 2 – 300 / 2; onResize();
}

730 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 10+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Located in China
+5 more
wangruyi says

onResize() should out of {}

116 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+5 more
encryptme says

haha yeah, didn’t notice that. it just needs to be triggered once. So you can put that outside of that function.

3 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+2 more
hitek says

Thanks encryptme its works perfect now! I have another question for you.. when resizing the page how can I make the bottom and top lines stop resizing once they go to a certain point on the stage. This web site is an example of what I mean http://www.drawingart.org/# the top and bottom will not overlap the content in the center of the stage. Anyone have any ideas?

Also If you watch when the web site loads the bottom will come sliding into place how is that animation done so that it always slides into the right place and sticks to the bottom of the web page?

Thanks!!

by
by
by
by
by
by