Jump to content
GreenSock

fauzihasnan

Problems with aligning SWFLoader to stage during fullscreen

Recommended Posts

Can someone tell me why is it that, when i loaded an external SWF using greensock's SWFLoader, and i (command+F) to make it full screen, the loader and the whole stage just shifts to the left and doesnt stay at the centre, whereas when I (command+f) on a page where there's no swfLoader, everything stays at the centre. Can anyone tell me how do i make it(the page with the SWFLoader) stay at the centre?

 

I know it sounds easy to solve, but I'm not really that good when it comes to flash, so i dont really know how to solve it.

 

Can someone help me??? I will really appreciate it.

Link to comment
Share on other sites

Hi,

 

I'm having difficulty visualizing how your loaded swf is behaving differently than other content in your swf. Under normal circumstances if your loaded swf is centered prior to the parent being resized, it should remain centered after the parent is resized. I think it would help if I can see how you are loading and positioning your external swf.

 

Can you please provide a very simple example that shows how you are loading and positioning your external swf? The files can be very simple and small. Just enough to illustrate the issue.

 

I'm a little confused by your use of the word "page" as it makes me think you are referring to an HTML page, but I'm assuming you are referring to a swf being displayed in the stand alone Flash player or as a projector. Seeing your files will greatly help us provide a suitable solution.

 

Just create a zip of your files and attach them to this post using "more reply options"

 

Thanks

Link to comment
Share on other sites

ok, inside the zipped file are 3 pics to illustrate what i mean. All 3 pictures are fullscreen. Picture1 is, as u can see, normal, with the alignment just nice at the center. So is Picture2. On picture4, there's an swf which i loaded, using greensock SWFloader and as u can see, the whole stage just shifts to the left, i dont know why. hopefully you understand what i am talking about

Link to comment
Share on other sites

ok, inside the zipped file are 3 pics to illustrate what i mean. All 3 pictures are fullscreen. Picture1 is, as u can see, normal, with the alignment just nice at the center. So is Picture2. On picture4, there's an swf which i loaded, using greensock SWFloader and as u can see, the whole stage just shifts to the left, i dont know why. hopefully you understand what i am talking about

Hi,

I'm having difficulty visualizing how your loaded swf is behaving differently than other content in your swf. Under normal circumstances if your loaded swf is centered prior to the parent being resized, it should remain centered after the parent is resized. I think it would help if I can see how you are loading and positioning your external swf.

Can you please provide a very simple example that shows how you are loading and positioning your external swf? The files can be very simple and small. Just enough to illustrate the issue.

I'm a little confused by your use of the word "page" as it makes me think you are referring to an HTML page, but I'm assuming you are referring to a swf being displayed in the stand alone Flash player or as a projector. Seeing your files will greatly help us provide a suitable solution.

Just create a zip of your files and attach them to this post using "more reply options"

Thanks

 

Link to comment
Share on other sites

Sorry, I don't see your attachments. If you continue to have issues attaching files, just upload them to 

http://ge.tt/ (you don't need to sign up, create an account or even provide an email address).

 

Also, pictures aren't going to help that much. Please provide the files so that I can compile the fla and see what is happening.

 

I have to experiment with your implementation of SWFLoader to see why it is behaving differently than other assets that are remaining centered on resize. The files only have to have enough  code and assets to replicate the issue. Please provide flas for the parent swf and the swf being loaded via SWFLoader.

 

Thanks!

Link to comment
Share on other sites

 

Hi,

 

I'm having difficulty visualizing how your loaded swf is behaving differently than other content in your swf. Under normal circumstances if your loaded swf is centered prior to the parent being resized, it should remain centered after the parent is resized. I think it would help if I can see how you are loading and positioning your external swf.

 

Can you please provide a very simple example that shows how you are loading and positioning your external swf? The files can be very simple and small. Just enough to illustrate the issue.

 

I'm a little confused by your use of the word "page" as it makes me think you are referring to an HTML page, but I'm assuming you are referring to a swf being displayed in the stand alone Flash player or as a projector. Seeing your files will greatly help us provide a suitable solution.

 

Just create a zip of your files and attach them to this post using "more reply options"

 

Thanks

To make things easier for u to visualise, i've made a test file for u. called test.fla. on the file there is a button, when u click, it will load an SWF using a greensock SWFLoader. You can (command+f) it to fullscreen it. when u full screen it, everything will look normal normal. bt once i click on the button to load the SWF, the whole stage and swf just shifts to the left.

 

you can download the file here: https://www.dropbox.com/s/ak4f68hfaflu27x/test%202.zip

 

thanks again!

Link to comment
Share on other sites

Sorry, I don't see your attachments. If you continue to have issues attaching files, just upload them to 

http://ge.tt/ (you don't need to sign up, create an account or even provide an email address).

 

Also, pictures aren't going to help that much. Please provide the files so that I can compile the fla and see what is happening.

 

I have to experiment with your implementation of SWFLoader to see why it is behaving differently than other assets that are remaining centered on resize. The files only have to have enough  code and assets to replicate the issue. Please provide flas for the parent swf and the swf being loaded via SWFLoader.

 

Thanks!

 

To make things easier for u to visualise, i've made a test file for u. called test.fla. on the file there is a button, when u click, it will load an SWF using a greensock SWFLoader. You can (command+f) it to fullscreen it. when u full screen it, everything will look normal normal. bt once i click on the button to load the SWF, the whole stage and swf just shifts to the left.

 

you can download the file here: https://www.dropbox....u27x/test 2.zip

 

thanks again!

Link to comment
Share on other sites

Hi,

 

It took me about 15 minutes to even find the SWFLoader code in test.fla as it is nested inside an invisible movieclip that is nested inside another movie clip.

 

I can not test your test.fla because it is trying to load a file from:

 

files/virtuals/kovan/living.swf (which I don't have)

 

The test.fla file you sent seems overly complicated and from what I can tell it doesn't appear to be the file that created test.swf. 

 

Can you please double to check to make sure that I have the proper files and that they are simplified as much as possible. From what I did see I suspect that kitchen.swf has code in it that is responding to the parent swf going full screen and it is shifting the content around.

 

What you can do as a test is load a very simple swf that has no resize code inside of it and see if you get the same results. Instead of loading kitchen.swf load something else. I think you will see that it will stay in the same relative position as it was before the resize happened.

Link to comment
Share on other sites

Hi,

 

It took me about 15 minutes to even find the SWFLoader code in test.fla as it is nested inside an invisible movieclip that is nested inside another movie clip.

 

I can not test your test.fla because it is trying to load a file from:

 

files/virtuals/kovan/living.swf (which I don't have)

 

The test.fla file you sent seems overly complicated and from what I can tell it doesn't appear to be the file that created test.swf. 

 

Can you please double to check to make sure that I have the proper files and that they are simplified as much as possible. From what I did see I suspect that kitchen.swf has code in it that is responding to the parent swf going full screen and it is shifting the content around.

 

What you can do as a test is load a very simple swf that has no resize code inside of it and see if you get the same results. Instead of loading kitchen.swf load something else. I think you will see that it will stay in the same relative position as it was before the resize happened.

ok, i have simplified the codes and made sure that the files are in order. i'm loading the file 'kitchen.swf'. and kitchen.swf, is an external swf which i do not have the .fla of. hope the file i sent u would be more clear for u.

 

https://www.dropbox.com/s/rcx8orthc9pl1wg/test.zip

 

thanks!!!

Link to comment
Share on other sites

Ok, the latest batch of files is much better.

I wasn't so sure what you were doing with the mask and I replaced your onInit callback that started and ENTER_FRAME listener with a simple onComplete callback just for the sake of simplicity.

 

The onComplete callback simply changes the size of the swf (as you were doing previously) and centers it horizontally on the stage

 

 

 

var loader1:SWFLoader = new SWFLoader("child.swf", {container:this, onComplete:position});




function position(event:Event):void {
        loader1.content.fitWidth = 400;
        loader1.content.fitHeight = 275;
        //dynamically center the swf horizontally
        loader1.content.x = (stage.stageWidth/2) - (loader1.content.fitWidth/2);


}
 

 

After the swf is loaded and placed on the stage, going fullscreen has no effect on the position of the loaded swf. It remains centered horizontally. When you go fullscreen the contents of the main swf are simply scaled. If the content was centered before going fullscreen, it will stay that way when the stage is scaled up.

 

Also note, I am using my own child.swf as opposed to your kitchen.swf.

 

Since this all works perfectly as expected, my previous suspicions of there being a problem in kitchen.swf are confirmed. Kitchen.swf must have code in it that is responding to the stage being resized and that code is altering the position of the object that contains kitchen.swf.

 

There is nothing I can do to try to work around that conflict. I have provided a simple zip of files to show that when loading a normal swf with SWFLoader, nothing moves around unexpectedly on stage resize

 

 

SWFLoaderCenteredHorizontally.zip

Link to comment
Share on other sites

Alright, I have did ask you asked, and you are right, it is the code inside kitchen.swf that's making the whole thing shift its position. Hmm, but do you think there is a way, or a code for me to disable that part of the script that is preventing me from keeping the code at the middle? But again, thanks alot for the help in making me understand

Ok, the latest batch of files is much better.

I wasn't so sure what you were doing with the mask and I replaced your onInit callback that started and ENTER_FRAME listener with a simple onComplete callback just for the sake of simplicity.

 

The onComplete callback simply changes the size of the swf (as you were doing previously) and centers it horizontally on the stage

 

 

 

var loader1:SWFLoader = new SWFLoader("child.swf", {container:this, onComplete:position});




function position(event:Event):void {
        loader1.content.fitWidth = 400;
        loader1.content.fitHeight = 275;
        //dynamically center the swf horizontally
        loader1.content.x = (stage.stageWidth/2) - (loader1.content.fitWidth/2);


}
 

 

After the swf is loaded and placed on the stage, going fullscreen has no effect on the position of the loaded swf. It remains centered horizontally. When you go fullscreen the contents of the main swf are simply scaled. If the content was centered before going fullscreen, it will stay that way when the stage is scaled up.

 

Also note, I am using my own child.swf as opposed to your kitchen.swf.

 

Since this all works perfectly as expected, my previous suspicions of there being a problem in kitchen.swf are confirmed. Kitchen.swf must have code in it that is responding to the stage being resized and that code is altering the position of the object that contains kitchen.swf.

 

There is nothing I can do to try to work around that conflict. I have provided a simple zip of files to show that when loading a normal swf with SWFLoader, nothing moves around unexpectedly on stage resize

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×