Resizing according to the browser page?

Publishing Print2Flash Documents embedding them in Flex applications
Post Reply
psunniaitec
Posts:15
Joined:Tue Jan 22, 2008 5:09 am
Resizing according to the browser page?

Post by psunniaitec » Tue Feb 05, 2008 4:27 am

The p2f document panel is not resizing according to the browser window.

ie. if the browser window opening in small size and after that when we try to maximize it, the document is remaining in small size

and also in other case

ie. the size will remain maximum even after we reduce the browser window size .

how can this be avoided?

jaymz
Posts:14
Joined:Mon Jan 28, 2008 4:29 pm

Re: Resizing according to the browser page?

Post by jaymz » Thu Feb 07, 2008 6:15 pm

When your stage resizes, you want to make sure that your print2flash doc resizes along with it. I got around that problem while embedding in Flash by creating an onResize listener on the Stage itself. Inside the listener, use p2fDoc.setSize, passing Stage.width and Stage.height.

davidrepas
Posts:6
Joined:Wed Mar 05, 2008 11:35 am

Re: Resizing according to the browser page?

Post by davidrepas » Wed Mar 05, 2008 11:39 am

Anyone have any code samples for dealing with the resizing issue? Or other suggestions?

So, far I haven't had any luck making it work.

Many thanks,
David

jaymz
Posts:14
Joined:Mon Jan 28, 2008 4:29 pm

Re: Resizing according to the browser page?

Post by jaymz » Wed Mar 05, 2008 2:36 pm

davidrepas wrote:Anyone have any code samples for dealing with the resizing issue? Or other suggestions?
I don't know Flex... but here is the AS2 code that is working for me:

Code: Select all

var stageListener:Object = new Object();
stageListener.onResize = function () {
	p2fDoc.setSize(Stage.width, Stage.height);
}
Stage.addListener(stageListener);
Call this after your Print2Flash document has loaded [or actually, after the container movie clip has been created]. In this example, it is called "p2fDoc".

Hope it helps!

staff
Posts:267
Joined:Sat Dec 15, 2007 4:48 pm

Re: Resizing according to the browser page?

Post by staff » Thu Mar 06, 2008 3:36 am

In Flex you can use this approach:
1. Add this code into your application:

Code: Select all

import mx.events.ResizeEvent;

public function appInit():void {
  addEventListener(mx.events.ResizeEvent.RESIZE, onResize);
  onResize(null);
}	

public function onResize(event:mx.events.ResizeEvent):void {
  doc.setSize(width,height);
}
2. Call appInit at application start, for example, call it from applicationComplete event handler
3. Set "100%" as a value for width and height application properties. Your application tag should look like this:

Code: Select all

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:ns1="Print2Flash.*" width="100%" height="100%" applicationComplete="appInit()">

davidrepas
Posts:6
Joined:Wed Mar 05, 2008 11:35 am

Re: Resizing according to the browser page?

Post by davidrepas » Thu Mar 06, 2008 9:39 am

Perfect! Thanks.

rusdobr
Posts:3
Joined:Wed Oct 15, 2008 4:21 am

Re: Resizing according to the browser page?

Post by rusdobr » Wed Oct 15, 2008 4:30 am

Hi,

I have same to do with flex 3.

This is error I have when window resized in debug mode. However it works in release mode.

undefined
at mx.managers::SystemManager/Stage_resizeHandler()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\SystemManager.as:2580]

ruslan

Post Reply