Page 1 of 1

Problem loading files

Posted: Mon Nov 10, 2008 2:17 pm
by dentinho
Hi,

I'm using AS3 to load an external print2flash swf file.
When I use the sample.swf from the samples of the
API it works fine, but when I use a file generated by
me it doesn't work. The loading animation blink one
time on the screen and nothing more happens.

Is there any specific way to generate the swf file to
use with AS3 or maybe I'm doing something wrong?

The code is this simple:

Code: Select all

import Print2Flash.*;

var P2FDoc				: Print2FlashDoc;
	P2FDoc				= new Print2FlashDoc( "sample.swf", 0, 0, 1180, 850, this);
Thanks in advance.

Re: Problem loading files

Posted: Mon Nov 17, 2008 9:56 am
by clardic
Hello
In flash use this code (found in the site)

Code: Select all

function LoadPrint2FlashDoc(
    url, // Path of Print2Flash document to load
    x, // x coordinate of the Print2Flash document movie
    y, // y coordinate of the Print2Flash document movie
    width, // Width of Print2Flash document movie
    height, // Height of Print2Flash document movie
    name, // Instance name to assign the Print2Flash document movie
    parent, // Optional: parent object of Print2Flash document movie (default is _root)
    eventSink) // Optional: event handler object
{
    var intervalID = 0;
    if (!parent) parent=_root
    var container:MovieClip = parent.createEmptyMovieClip(name, getNextHighestDepth());
    container._x=x;container._y=y

    var loadFunc = function()
    {
       if (!container.setSize) return;
       container.setSize(width, height);
       container.setCurrentPage(1);
       clearInterval(intervalID);
       eventSink.onLoaded(container);
       container.addListener(eventSink);
    }
   
    intervalID = setInterval(loadFunc, 100);
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    mcLoader.loadClip(url, container);
    return container;
}

var p2f=LoadPrint2FlashDoc("test2.swf", 160,10,630, 485, "test2");
THis last line lod the swf.
regards

Re: Problem loading files

Posted: Tue Nov 18, 2008 4:59 pm
by staff
Make sure that "Disable Print2Flash Document API support" option in the Document Options window is not set when converting your document to Flash.
The code offered by clardic is for AS2 only so it does not suit your case. Use Print2FlashDoc class as you already do.