keep package functions from starting automatically
hey everyone! this should be simple.
i've got a movie clip which i "exported for actionscript" inside of the properties dialog.
this is the code inside of the package that was created to go along with it (MovieClipName.as)
package { import flash.display.MovieClip; import flash.utils.Timer; import flash.events.TimerEvent; import flash.events.Event; import flash.display.Loader; import fl.transitions.Tween; import fl.transitions.easing.*; import fl.transitions.TweenEvent; import flash.net.URLRequest; import flash.display.Bitmap; import flash.trace.Trace; public class cont extends MovieClip { public var mCONTENT:Array=new Array(); public var mUBTIL:Array=new Array(); public var NOBAR:Boolean = false; public var MASTER:Timer = new Timer(5000,1); public var p:Number = 0; public var q:Number = 1; public var ChurnerI:Tween; public var ChurnerII:Tween; public var lod:Loader = new Loader(); public function startSlideshow() { trace("CONT IS ACTIVE!!!") NOBAR=false; MASTER.addEventListener(TimerEvent.TIMER, reportProcessComplete); MASTER.start(); loadSequentialPictures(); function beginSlideshowLoop() { if (NOBAR != true) { MASTER.start(); loadSequentialPictures(); } } function reportProcessComplete(e:Event) { p++; if (p == 2) { p = 0; movePics(); } } function reportMovementComplete() { wrapper(); beginSlideshowLoop(); } function wrapper() { q++; if (q == mCONTENT.length) { q = 0; } } function loadSequentialPictures() { if (mCONTENT.length > 1) { if (mCONTENT
is Bitmap) { mCONTENT.y = 0; mCONTENT.width = 857; mCONTENT.height = 512; mCONTENT.x = 857 + 2; stage.addChild(mCONTENT); reportProcessComplete(null); } else { loadSeqPic(); } } } function loadSeqPic() { var request:URLRequest = new URLRequest("http://www.jawilsonarchitects.biz/portphot/" + mCONTENT); lod= new Loader(); lod.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, seqLoaded); lod.load(request); } function seqLoaded(e:Event) { var JohnIII:Bitmap = Bitmap(lod.content); mCONTENT.splice(q,1,JohnIII); mCONTENT.y = 0; mCONTENT.width = 857; mCONTENT.height = 512; mCONTENT.x = 857 + 2; stage.addChild(mCONTENT); reportProcessComplete(null); } function movePics() { ChurnerI = new Tween(stage.getChildAt(0),"x",Regular.easeInOut,stage.getChildAt(0).x,-857 - 2,15,false); ChurnerII = new Tween(stage.getChildAt(1),"x",Regular.easeInOut,stage.getChildAt(1).x,0,15,false); ChurnerII.addEventListener(TweenEvent.MOTION_FINISH, reset); } function reset(e:Event) { stage.removeChildAt(0); reportMovementComplete(); } } } }
most of the code shouldn't matter. i'm new to packages and i just want to know how to keep startSlideshow() from triggering when a new instance of this movieclip is created. i would prefer if something like ThisMovieClip.startSlideshow() had to be triggered. please excuse my dorky labels, etc. thank you!
EDIT: oh! and it would be helpful if you could tell me how to add things to the inside of the movieclip from this package. i assumed adding it to the stage would do the trick but i haven't been able to test to find the right method yet. from the timeline i could just use Movieclip.addChild(picture) but i don't know how to do it from within the package. thanks again.
Message was edited by: JohnFour