- Microlancer Beta Tester
- Sold between 10 000 and 50 000 dollars
- Author had a Free File of the Month
- Author was Featured
- Bought between 50 and 99 items
- Has been a member for 4-5 years
- Exclusive Author
- Interviewed on the Envato Notes blog
- Item was Featured
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!!
- Bought between 1 and 9 items
- Exclusive Author
- Has been a member for 6-7 years
- Netherlands
- Referred between 50 and 99 users
- Sold between 1 000 and 5 000 dollars
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Sold between 100 000 and 250 000 dollars
- Exclusive Author
- Author was Featured
- Item was Featured
- Beta Tester
- Has been a member for 3-4 years
- Spain
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.
- Microlancer Beta Tester
- Sold between 10 000 and 50 000 dollars
- Author had a Free File of the Month
- Author was Featured
- Bought between 50 and 99 items
- Has been a member for 4-5 years
- Exclusive Author
- Interviewed on the Envato Notes blog
- Item was Featured
So. Here is the code with a little bit of explanation….
I couldnt understand the pastie thing…
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
|| (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.
