Load eternal swf and align center both when loaded and when stage resize.

335 posts
  • Weekly Top Seller
  • 7 Years of Membership
  • Featured Item
  • Author Level 5
+9 more
tiam
says

As the topic says im having major problems aligning my dynamicly imported swf file center on the stage.

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

My assumption is that the movie (swf) loaded is using its own TL alignment (default) 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… or is there any way to use global alignement…

Help please!!

If someone is willing to help me with this i would gladly pay for it!!

601 posts
  • 6 Years of Membership
  • Affiliate Level 1
  • Author Level 3
  • Collector Level 2
+2 more
SparkyFlash
says

You need to load external swf into a container inside your main.swf file. After its loaded, call onResize function that handles all the alignment of the container and other elements on stage.

335 posts
  • Weekly Top Seller
  • 7 Years of Membership
  • Featured Item
  • Author Level 5
+9 more
tiam
says

Hi SparkyFlash! Thanks for your answer!! I do load the swf inside a movieclip in the maintimeline (mainmovie). How would I call the onResize onLoad or after load..?

1612 posts
  • Affiliate Level 1
  • Author Level 4
  • Collector Level 2
  • Community Superstar
+10 more
DaniMun
says
How would I call the onResize onLoad or after load..?

http://www.gotoandlearn.com/play?id=31 :D

335 posts
  • Weekly Top Seller
  • 7 Years of Membership
  • Featured Item
  • Author Level 5
+9 more
tiam
says

Thanks DaniMun! Not exactly what I was looking for but a good tutorial though!! :)

I was thinking maybe there is a way to call a stagehandler without actually resizing the stage??

1612 posts
  • Affiliate Level 1
  • Author Level 4
  • Collector Level 2
  • Community Superstar
+10 more
DaniMun
says
Thanks DaniMun! Not exactly what I was looking for but a good tutorial though!! :)

Don’t mention it ;)

I was thinking maybe there is a way to call a stagehandler without actually resizing the stage??

Short answer: maybe.
Long answer: it greatly depends on your stage handler method implementation.

In order for other fellow authors to be able to help you, go ahead and post your code using Pastie ;)

335 posts
  • Weekly Top Seller
  • 7 Years of Membership
  • Featured Item
  • Author Level 5
+9 more
tiam
says

Here is a link to the some of the code :)

http://pastie.org/613651

1612 posts
  • Affiliate Level 1
  • Author Level 4
  • Collector Level 2
  • Community Superstar
+10 more
DaniMun
says
Here is a link to the some of the code :)

http://pastie.org/613651

Well I’m about to leave my office so unfortunately I don’t have the necessary time to look into your code more closely, but as far as I can see, the initial alignment issue is due to the fact that you’re loading an external asset into an empty movieclip.

Of course I might be wrong, like I said, I’m about to leave :)

If I was you, I’d drop that code and create a resize handler method from scratch, such as this one

Hope this helps ;)

335 posts
  • Weekly Top Seller
  • 7 Years of Membership
  • Featured Item
  • Author Level 5
+9 more
tiam
says

Thanks a lot for your help:) Ill try some more things before I drop my code and try something else. I cant be the ony person facing this problem I hope …;)

8586 posts Community Moderator
  • United Kingdom
  • 7 Years of Membership
  • Moderator
  • Winner
+10 more
MSFX
Moderator
says

very quickly looking at it I think it may be because the SWFs width / height is 0 / 0 before its initialised…?

maybe place a movieclip alpha = 0 as the background of the swf and try that…?

by
by
by
by
by
by