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

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!!

598 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 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
  • 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 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
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Contributed a free file of the month
+9 more
DaniMun says
How would I call the onResize onLoad or after load..?

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

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

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
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Contributed a free file of the month
+9 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
  • 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

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

http://pastie.org/613651

1612 posts
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Contributed a free file of the month
+9 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
  • 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

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 …;)

8378 posts Community Moderator
  • Has referred 10+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Attended one of our Meetups around the world
+9 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…?

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by