335 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+8 more
tiam says

Hi all! :)

Im having problem to align a imported swf.

Here is the thing. When I load the swf inside my main movi clip it doesnt align center but when i change the browser size it does align in the correct position. My assumption is that the movie (swf) loaded is using its own TL alignment and when resize the listener sets in from tha main movie. If that is the case how do i remove the TL from the moviclip…

Thanks!!

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

Could you paste your alignment code in a pastie , so we can see what you are doing?

3748 posts
  • Has referred 200+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Won a competition
+9 more
pezflash says

Try to load the SWF inside another MC (it will load in x0 y0 inside the MC), and align that MC to your desired position. I asumme you can not modify that imported swf.

335 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+8 more
tiam says

So. Here is the code with a little bit of explanation…. I couldnt understand the pastie thing… :S Hope this is ok…

//Here is my align for the specific mc. The MC “tester” is an empty MC on the main timeline _level.tester._x = StageDimensions.alignX(_level.tester); _level.tester._y = StageDimensions.alignY(_level.tester);

//And here is the align parameters for the tester mc (to align the tester MC X cordinate)

public static function alignX(mc:MovieClip, registrationPoint:Number)
{
}
var result:Number;
var mcWidth:Number = mc._width;
if( (registrationPoint  1) || (registrationPoint  4) || (registrationPoint  7) || (registrationPoint  undefined))
{
    result = (_cw / 2 ) - mcWidth/2;    
}
if( (registrationPoint  2) || (registrationPoint  5) || (registrationPoint == 8))
{
    result = _cw / 2;
}
if( (registrationPoint  3) || (registrationPoint  6) || (registrationPoint == 9))
{
    result = (_cw / 2 ) + mcWidth/2;
}
//mc._x = result;
return result;

//And here is the align parameters for the tester mc (to align the tester MC Y cordinate)

public static function alignY(mc:MovieClip, registrationPoint:Number) {

var result:Number;
    var mcHeight:Number = mc._height;
}
if( (registrationPoint  7) || (registrationPoint  8) || (registrationPoint  9) || (registrationPoint  undefined))
{
    result = (_ch / 2) - mcHeight/2 + 60;    
}        
if( (registrationPoint  4) || (registrationPoint  5) || (registrationPoint == 6))
{
    result = _ch / 2 + 60;    
}
if( (registrationPoint  1) || (registrationPoint  2) || (registrationPoint == 3))
{
    result = _ch / 2 + mcHeight/2 + 60;    
}
//mc._y = result;    
return result;

//When i load the MC “tester” I use this… _root.tester._alpha =0; _root.tester.alphaTo(100, 1, “easeinsine”);

}

Keep in mind that it is working when window is resized… The swf goes in the desired place when i resize the window but when first loading the swf it doesnt com in right place. instead the top left corner of the imported swf is centered.

by
by
by
by
by
by