Problem loading files

Publishing Print2Flash Documents embedding them in Flash movies
Post Reply
dentinho
Posts:1
Joined:Fri Nov 07, 2008 3:06 pm
Problem loading files

Post by dentinho » Mon Nov 10, 2008 2:17 pm

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.

clardic
Posts:11
Joined:Mon Nov 17, 2008 9:27 am

Re: Problem loading files

Post by clardic » Mon Nov 17, 2008 9:56 am

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

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

Re: Problem loading files

Post by staff » Tue Nov 18, 2008 4:59 pm

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.

Post Reply