swftools-common
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Swftools-common] Creating a Simple Viewer


From: Stephen More
Subject: [Swftools-common] Creating a Simple Viewer
Date: Wed, 25 Feb 2009 14:40:56 -0500

I am trying to follow "Appendix A: Creating your own Viewers" on
http://www.quiss.org/swftools/pdf2swf_usage.html but I am not having
much luck.

When I try to swfcombine from 2009-02-16-1757 I get error: WARNING
Didn't find anything named viewport in file. No substitutions will
occur.

Here is the Simple Viewer code that I have compiled:

package
{
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.text.TextField;

    public class Main extends MovieClip
    {
        private var backBtn:Sprite;
        private var fwdBtn:Sprite;
        public var viewport:MovieClip;

        public function Main()
        {
            backBtn = new Sprite();
            backBtn.graphics.beginFill( 0x00ff00, 1 );
            backBtn.graphics.drawRect( 0, 0, 100, 100 );
            backBtn.buttonMode = true;
            backBtn.addEventListener( MouseEvent.CLICK, backOne );

            var backField:TextField = new TextField();
            backField.x = 50;
            backField.y = 50;
            backField.text = "Prev";
            backBtn.addChild( backField );
            addChild( backBtn );


            fwdBtn = new Sprite();
            fwdBtn.x = 100;
            fwdBtn.graphics.beginFill( 0xff0000, 1 );
            fwdBtn.graphics.drawRect( 0, 0, 100, 100 );
            fwdBtn.buttonMode = true;
            fwdBtn.addEventListener( MouseEvent.CLICK, fwdOne );

            var fwdField:TextField = new TextField();
            fwdField.x = 50;
            fwdField.y = 50;
            fwdField.text = "Next";
            fwdBtn.addChild( fwdField );
            addChild( fwdBtn );


            viewport = new MovieClip();
            viewport.graphics.beginFill( 0x0000FF, 1 );
            viewport.graphics.drawRect( 0, 0, 200, 200 );
            viewport.graphics.endFill();
            viewport.y = 100;
            addChild( viewport );

        }

        public function backOne( event:MouseEvent ):void
        {
            trace( "back: " + event.target );
            viewport.prevFrame();
        }

        public function fwdOne( event:MouseEvent ):void
        {
            trace( "fwd: " + event.target );
            viewport.nextFrame();
        }
    }
}


Here is the beginning of swfdump:
[HEADER]        File version: 9
[HEADER]        File is zlib compressed. Ratio: 66%
[HEADER]        File size: 1566
[HEADER]        Frame rate: 24.000000
[HEADER]        Frame count: 1
[HEADER]        Movie width: 500.00
[HEADER]        Movie height: 375.00
[045]         4 FILEATTRIBUTES usenetwork as3 symbolclass
[04d]       559 METADATA
[041]         4 SCRIPTLIMITS
[009]         3 SETBACKGROUNDCOLOR (86/9c/a7)
[029]        26 SERIALNUMBER
[02b]         5 FRAMELABEL "Main"
[052]       907 DOABC "frame1", lazy load
....

Thanks for any help in getting this viewer to work.

-Steve More




reply via email to

[Prev in Thread] Current Thread [Next in Thread]