Page 1 of 1

Resizing according to the browser page?

Posted: Tue Feb 05, 2008 4:27 am
by psunniaitec
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?

Re: Resizing according to the browser page?

Posted: Thu Feb 07, 2008 6:15 pm
by jaymz
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.

Re: Resizing according to the browser page?

Posted: Wed Mar 05, 2008 11:39 am
by davidrepas
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

Re: Resizing according to the browser page?

Posted: Wed Mar 05, 2008 2:36 pm
by jaymz
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!

Re: Resizing according to the browser page?

Posted: Thu Mar 06, 2008 3:36 am
by staff
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()">

Re: Resizing according to the browser page?

Posted: Thu Mar 06, 2008 9:39 am
by davidrepas
Perfect! Thanks.

Re: Resizing according to the browser page?

Posted: Wed Oct 15, 2008 4:30 am
by rusdobr
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