Problem with getPage in AS3

Publishing Flash documents by embedding them in Flash movies
Post Reply
blaxxun
Posts: 2
Joined: Thu Apr 16, 2009 7:47 pm

Problem with getPage in AS3

Post by blaxxun » Thu Apr 16, 2009 8:23 pm

I have been trying to get a reference to movieclip instance of individual pages of a Print2Flash document.

Code: Select all

import Print2Flash.*;
	
var _mClip:MovieClip;
this.stage.scaleMode = "noScale";
	
var P2FDoc:Print2FlashDoc=new Print2FlashDoc("load/GlobalLocateChipsetDatasheet.swf",0,0,600,800,this);
P2FDoc.addEventListener("onLoaded", onP2FLoaded);
function onP2FLoaded(e:flash.events.Event) {
    trace("file loaded.");
	P2FDoc.setCurrentZoom(100);
	P2FDoc.getCurrentZoom(ongetCurrentZoom);
	P2FDoc.setScrollPosition(new Print2Flash.Point(0,0));
	_mClip = P2FDoc.getPage(1);
	P2FDoc.getScrollPosition(onGetScrollPosition);
}

function onPageChanged(e:PageChangedEvent) {
     trace("page changed to " + e.page.toString());
}

P2FDoc.addEventListener("onPageChanged", onPageChanged);

function ongetCurrentZoom(page:Number):void {
    trace("current zoom  - " + page);
} 

function onGetPageMovie(_mClipVar:MovieClip):void {
    _mClip = _mClipVar;
}

function onGetScrollPosition(ptLocalObj:Object):void {    
	trace(ptLocal);
	var ptLocal:Print2Flash.Point = Print2Flash.Point(ptLocalObj);
	//trace("current position  - " + ptLocal.x + "," + ptLocal.y);
}
When I try to compile the movie, I get this error

1061: Call to a possibly undefined method getPage through a reference with static type Print2Flash:Print2FlashDoc.

I tried replacing the line

Code: Select all

_mClip = P2FDoc.getPage(1);
with

Code: Select all

P2FDoc.getPage(onGetPageMovie, 1);
Tried

Code: Select all

P2FDoc.getPage(1, onGetPageMovie);
But each time same error.

Am facing similar problems with getScrollPosition call as well. The error am getting is

Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095: flash.net.LocalConnection was unable to invoke callback CallBack. error=TypeError: Error #1034: Type Coercion failed: cannot convert Object@5ab69e9 to Print2Flash.Point.

Any insight will be highly appreciated.

Thanks in advance.

blaxxun
Posts: 2
Joined: Thu Apr 16, 2009 7:47 pm

Re: Problem with getPage in AS3

Post by blaxxun » Mon May 18, 2009 6:22 am

So many views and not a single comment. Is this a very stupid question or currently there is no solution to it? Print2Flash being a commercial product, I would have expected the support staff to at least respond to the query. A complete lack of response just makes you wonder whether it is really worth buying :( . At least let me know that it cant be done or that the approach is totally wrong, but one way or other help close the issue.

Post Reply