1 // 2 // Description: 3 // SWFMovieClip Class 4 // 5 // Authors: 6 // Jonathan Shore <jshore@e-shuppan.com> 7 // Based on php wrapper developed by <dave@opaque.net> 8 // 9 // Copyright: 10 // Copyright 2001 E-Publishing Group Inc. Permission is granted to use or 11 // modify this code provided that the original copyright notice is included. 12 // 13 // This software is distributed with no warranty of liability, merchantability, 14 // or fitness for a specific purpose. 15 // 16 17 18 19 20 21 22 23 // 24 // SWFMovieClip Class 25 // movie clip 26 // 27 // Notes 28 // - one simply draws the shapes and adds to the movie at a specific 29 // frame 30 // 31 public class SWFMovieClip extends SWFObject implements SWFMovieClipI { 32 SWFMovieClip()33 public SWFMovieClip () 34 throws SWFException 35 { 36 setHandle (nNew()); 37 } 38 setFrames(int nframes)39 public void setFrames (int nframes) 40 { nSetFrames (handle, nframes); } setNumberOfFrames(int nframes)41 public void setNumberOfFrames (int nframes) 42 { nSetFrames (handle, nframes); } 43 add(SWFObjectI object)44 public SWFDisplayItemI add (SWFObjectI object) 45 throws SWFException 46 { 47 object.eval(); 48 preserve (object); 49 SWFDisplayItemI i = 50 new SWFDisplayItem (nAdd (handle, object.getHandle())); 51 object.getMatrix().apply (i); 52 53 return i; 54 } 55 add(SWFObjectI object, int depth)56 public SWFDisplayItemI add (SWFObjectI object, int depth) 57 throws SWFException 58 { 59 SWFDisplayItemI i = add (object); 60 i.setDepth(depth); 61 return i; 62 } 63 remove(SWFDisplayItemI item)64 public void remove (SWFDisplayItemI item) 65 { nRemove (handle, item.getHandle()); } 66 nextFrame()67 public void nextFrame () 68 { nNextFrame (handle); } labelFrame(String label)69 public void labelFrame (String label) 70 { nLabelFrame (handle, label); } 71 72 finalize()73 protected void finalize() 74 throws Throwable 75 { 76 nDestroy (handle); 77 super.finalize(); 78 } 79 80 81 // native methods 82 nNew()83 protected native int nNew (); nDestroy(int handle)84 protected native void nDestroy (int handle); 85 nSetFrames(int handle, int nframes)86 protected native void nSetFrames (int handle, int nframes); 87 nAdd(int handle, int Hobject)88 protected native int nAdd (int handle, int Hobject); nRemove(int handle, int Hobject)89 protected native void nRemove (int handle, int Hobject); 90 nNextFrame(int handle)91 protected native void nNextFrame (int handle); nLabelFrame(int handle, String label)92 protected native void nLabelFrame (int handle, String label); 93 }; 94 95 96 97 98